Skip to content

Commit 5c662af

Browse files
committed
format
1 parent 52de582 commit 5c662af

File tree

5 files changed

+30
-9
lines changed

5 files changed

+30
-9
lines changed

test/estimators.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ emp_norm(l::LossFunction) = 2 * quadgk(x -> exp(-RobustModels.rho(l, x)), 0, Inf
5050

5151
if !isnothing(estimator)
5252
if estimator == "Tau"
53-
# @test isa(loss(est), Tuple{BoundedLossFunction, BoundedLossFunction})
53+
# @test isa(loss(est), Tuple{BoundedLossFunction, BoundedLossFunction})
5454
@test isa(loss(est), CompositeLossFunction)
5555
@test typeof(first(loss(est))) == typeloss
5656
@test typeof(last(loss(est))) == typeloss
@@ -104,18 +104,21 @@ emp_norm(l::LossFunction) = 2 * quadgk(x -> exp(-RobustModels.rho(l, x)), 0, Inf
104104
@test isfinite(RobustModels.tuning_constant(est))
105105

106106
@testset "Estimator norm: $(name)" begin
107+
est_norm = RobustModels.estimator_norm(est)
107108
if !isbounded(est)
108-
@test emp_norm(est) RobustModels.estimator_norm(est) rtol = 1e-5
109+
@test emp_norm(est) est_norm rtol = 1e-5
109110
else
110-
@test !isfinite(RobustModels.estimator_norm(est))
111+
@test !isfinite(est_norm)
111112
end
112113
end
113114

114115
if !in(name, ("L2", "L1"))
115116
@testset "Estimator high efficiency: $(name)" begin
116117
vopt = estimator_high_efficiency_constant(typest)
117118
if name != "HardThreshold"
118-
v = efficiency_tuning_constant(typest; eff=0.95, c0=0.9 * vopt)
119+
v = efficiency_tuning_constant(
120+
typest; eff=0.95, c0=0.9 * vopt
121+
)
119122
@test isapprox(v, vopt; rtol=1e-3)
120123
end
121124
end
@@ -124,14 +127,18 @@ emp_norm(l::LossFunction) = 2 * quadgk(x -> exp(-RobustModels.rho(l, x)), 0, Inf
124127
if isbounded(est)
125128
@testset "Estimator high breakdown point: $(name)" begin
126129
vopt = estimator_high_breakdown_point_constant(typest)
127-
v = breakdown_point_tuning_constant(typest; bp=0.5, c0=1.1 * vopt)
130+
v = breakdown_point_tuning_constant(
131+
typest; bp=0.5, c0=1.1 * vopt
132+
)
128133
@test isapprox(v, vopt; rtol=1e-3)
129134
end
130135

131136
@testset "τ-Estimator high efficiency: $(name)" begin
132137
vopt = estimator_tau_efficient_constant(typest)
133138
if name != "HardThreshold"
134-
v = tau_efficiency_tuning_constant(typest; eff=0.95, c0=1.1 * vopt)
139+
v = tau_efficiency_tuning_constant(
140+
typest; eff=0.95, c0=1.1 * vopt
141+
)
135142
@test isapprox(v, vopt; rtol=1e-3)
136143
end
137144
end

test/interface.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ est2 = MEstimator(loss2)
1919
VERBOSE && println(m1)
2020
VERBOSE && println(" lm : ", coef(m1))
2121

22+
#! format: off
2223
# Formula, dense and sparse entry and methods :cg and :chol
2324
@testset "interface: $(typeof(A)),\t$(method)" for (A, b) in data_tuples, method in nopen_methods
25+
#! format: on
2426

2527
name = if (A == form)
2628
"formula"

test/qreg.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@
6565

6666
@test_nowarn fit(QuantileRegression, A_missing, b; dropmissing=true)
6767
@test_nowarn fit(QuantileRegression, A, b_missing; dropmissing=true)
68-
@test_nowarn fit(QuantileRegression, A_missing, b_missing; dropmissing=true)
68+
@test_nowarn fit(
69+
QuantileRegression, A_missing, b_missing; dropmissing=true
70+
)
6971
end
7072
end
7173
end

test/robustridge.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ est2 = MEstimator(loss2)
1313

1414
@testset "Ridge M-estimator " begin
1515

16+
#! format: off
1617
@testset "linear: Ridge M-estimator $(lossname)" for lossname in ("L2", "Huber", "Tukey")
18+
#! format: on
1719
typeloss = getproperty(RobustModels, Symbol(lossname * "Loss"))
1820
l = typeloss()
1921
est = MEstimator(typeloss())
2022

23+
#! format: off
2124
# Formula, dense and sparse entry and methods :cg and :chol
2225
@testset "$(typeof(A)),\t$(method)" for (A, b) in data_tuples, method in nopen_methods
26+
#! format: on
2327

2428
aspace = (method in (:cg, :qr)) ? " " : " "
2529
name = "MEstimator($(typeloss)),\t"
@@ -70,7 +74,9 @@ est2 = MEstimator(loss2)
7074

7175
@testset "linear: Ridge L2 estimator methods" begin
7276
m2 = fit(RobustLinearModel, form, data, est1; method=:chol, initial_scale=:L1)
73-
m3 = fit(RobustLinearModel, form, data, est1; method=:chol, initial_scale=:L1, ridgeλ=1)
77+
m3 = fit(
78+
RobustLinearModel, form, data, est1; method=:chol, initial_scale=:L1, ridgeλ=1
79+
)
7480

7581
@testset "method: $(f)" for f in interface_methods
7682
# make sure the interfaces for RobustLinearModel are well defined

test/univariate.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ using RobustModels: mean_and_sem, compatdims
8686
y3 = reshape(yorig, (1, 3, 102))
8787
y4 = reshape(yorig, (17, 18, 1))
8888

89+
#! format: off
8990
@testset "robust univariate statistics: Array size: $(size(a))" for a in (y, y1, y2, y3, y4)
91+
#! format: on
9092
@testset "dims=$(dims)" for dims in (1, 2, (1,), (1, 2), (3, 1), 4, (:))
9193
## Mean
9294
m = @test_nowarn mean(est, a; dims=dims)
@@ -103,7 +105,9 @@ using RobustModels: mean_and_sem, compatdims
103105
s = @test_nowarn func(est, a; dims=dims)
104106

105107
## Test `mean_and_<dispersion> == (mean, <dispersion>)`
106-
func_tup = getproperty(RobustModels, Symbol("mean_and_" * String(disp_name)))
108+
func_tup = getproperty(
109+
RobustModels, Symbol("mean_and_" * String(disp_name))
110+
)
107111
ms = @test_nowarn func_tup(est, a; dims=dims)
108112
@test length(ms) == 2
109113
@test ms[1] m

0 commit comments

Comments
 (0)