Skip to content

Commit 3a56ad3

Browse files
committed
rename a struct in tests
1 parent 21383ab commit 3a56ad3

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

test/integration/static_algorithms.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,24 @@ end
6969
# This a variation of `Selector` above that stores the names of rejected features in the
7070
# output of `fit`, for inspection by an accessor function called `rejected`.
7171

72-
struct Selector2
72+
struct FancySelector
7373
names::Vector{Symbol}
7474
end
75-
Selector2(; names=Symbol[]) = Selector2(names) # LearnAPI.constructor defined later
75+
FancySelector(; names=Symbol[]) = FancySelector(names) # LearnAPI.constructor defined later
7676

77-
mutable struct Selector2Fit
78-
algorithm::Selector2
77+
mutable struct FancySelectorFitted
78+
algorithm::FancySelector
7979
rejected::Vector{Symbol}
80-
Selector2Fit(algorithm) = new(algorithm)
80+
FancySelectorFitted(algorithm) = new(algorithm)
8181
end
82-
LearnAPI.algorithm(model::Selector2Fit) = model.algorithm
83-
rejected(model::Selector2Fit) = model.rejected
82+
LearnAPI.algorithm(model::FancySelectorFitted) = model.algorithm
83+
rejected(model::FancySelectorFitted) = model.rejected
8484

8585
# Here we are wrapping `algorithm` with a place-holder for the `rejected` feature names.
86-
LearnAPI.fit(algorithm::Selector2; verbosity=1) = Selector2Fit(algorithm)
86+
LearnAPI.fit(algorithm::FancySelector; verbosity=1) = FancySelectorFitted(algorithm)
8787

8888
# output the filtered table and add `rejected` field to model (mutatated!)
89-
function LearnAPI.transform(model::Selector2Fit, X)
89+
function LearnAPI.transform(model::FancySelectorFitted, X)
9090
table = Tables.columntable(X)
9191
names = Tables.columnnames(table)
9292
keep = LearnAPI.algorithm(model).names
@@ -98,15 +98,15 @@ function LearnAPI.transform(model::Selector2Fit, X)
9898
end
9999

100100
# fit and transform in one step:
101-
function LearnAPI.transform(algorithm::Selector2, X)
101+
function LearnAPI.transform(algorithm::FancySelector, X)
102102
model = fit(algorithm)
103103
transform(model, X)
104104
end
105105

106106
# note the necessity of overloading `is_static` (`fit` consumes no data):
107107
@trait(
108-
Selector2,
109-
constructor = Selector2,
108+
FancySelector,
109+
constructor = FancySelector,
110110
is_static = true,
111111
tags = ("feature engineering",),
112112
functions = (
@@ -120,7 +120,7 @@ end
120120
)
121121

122122
@testset "test a variation that reports byproducts" begin
123-
algorithm = Selector2(names=[:x, :w])
123+
algorithm = FancySelector(names=[:x, :w])
124124
X = DataFrames.DataFrame(rand(3, 4), [:x, :y, :z, :w])
125125
model = fit(algorithm) # no data arguments!
126126
@test !isdefined(model, :reject)

0 commit comments

Comments
 (0)