Skip to content

Commit 194c53e

Browse files
committed
πŸ‘¨β€πŸ”§ Fix types for features
1 parent c784e50 commit 194c53e

File tree

15 files changed

+319
-311
lines changed

15 files changed

+319
-311
lines changed

β€Žsrc/encoders/contrast_encoder/contrast_encoder.jlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Fit a contrast encoing scheme on given data in `X`.
7979
"""
8080
function contrast_encoder_fit(
8181
X,
82-
features::AbstractVector{Symbol} = Symbol[];
82+
features = Symbol[];
8383
mode::Union{Symbol, AbstractVector{Symbol}} = :dummy,
8484
buildmatrix = nothing,
8585
ignore::Bool = true,

β€Žsrc/encoders/contrast_encoder/interface_mlj.jlβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
### ContrastEncoding with MLJ Interface
22

33
# 1. Interface Struct
4-
mutable struct ContrastEncoder{AS <: AbstractVector{Symbol}} <: Unsupervised
5-
features::AS
4+
mutable struct ContrastEncoder{ASS <: Union{Symbol, AbstractVector{Symbol}}, A1 <: Any, A2 <: Any} <: Unsupervised
5+
features::A1
66
ignore::Bool
7-
mode::Union{Symbol, AS}
8-
buildmatrix::Any
7+
mode:: ASS
8+
buildmatrix::A2
99
ordered_factor::Bool
1010
end;
1111

β€Žsrc/encoders/frequency_encoding/frequency_encoding.jlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ categorical features with their (normalized or raw) frequencies of occurrence in
2020
"""
2121
function frequency_encoder_fit(
2222
X,
23-
features::AbstractVector{Symbol} = Symbol[];
23+
features = Symbol[];
2424
ignore::Bool = true,
2525
ordered_factor::Bool = false,
2626
normalize::Bool = false,

β€Žsrc/encoders/frequency_encoding/interface_mlj.jlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
### FrequencyEncoding with MLJ Interface
22

33
# 1. Interface Struct
4-
mutable struct FrequencyEncoder{AS <: AbstractVector{Symbol}} <: Unsupervised
5-
features::AS
4+
mutable struct FrequencyEncoder{A <: Any} <: Unsupervised
5+
features::A
66
ignore::Bool
77
ordered_factor::Bool
88
normalize::Bool

β€Žsrc/encoders/missingness_encoding/interface_mlj.jlβ€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
# 1. Interface Struct
44
mutable struct MissingnessEncoder{
5-
AS <: AbstractVector{Symbol},
65
T <: Type,
76
A <: Any,
87
} <: Unsupervised
9-
features::AS
8+
features::A
109
ignore::Bool
1110
ordered_factor::Bool
1211
label_for_missing::Dict{T, A}

β€Žsrc/encoders/missingness_encoding/missingness_encoding.jlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ types that are in `Char`, `AbstractString`, and `Number`.
2727
"""
2828
function missingness_encoder_fit(
2929
X,
30-
features::AbstractVector{Symbol} = Symbol[];
30+
features = Symbol[];
3131
ignore::Bool = true,
3232
ordered_factor::Bool = false,
3333
label_for_missing::Dict{<:Type, <:Any} = Dict(

β€Žsrc/encoders/ordinal_encoding/interface_mlj.jlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
### OrdinalEncoding with MLJ Interface
22

33
# 1. Interface Struct
4-
mutable struct OrdinalEncoder{AS <: AbstractVector{Symbol}} <: Unsupervised
5-
features::AS
4+
mutable struct OrdinalEncoder{A <: Any} <: Unsupervised
5+
features::A
66
ignore::Bool
77
ordered_factor::Bool
88
end;

β€Žsrc/encoders/ordinal_encoding/ordinal_encoding.jlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Fit an encoder to encode the levels of categorical variables in a given table as
1818
"""
1919
function ordinal_encoder_fit(
2020
X,
21-
features::AbstractVector{Symbol} = Symbol[];
21+
features = Symbol[];
2222
ignore::Bool = true,
2323
ordered_factor::Bool = false,
2424
)

β€Žsrc/encoders/target_encoding/interface_mlj.jlβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
### TargetEncoding with MLJ Interface
22

33
# 1. Interface Struct
4-
mutable struct TargetEncoder{R1 <: Real, R2 <: Real, AS <: AbstractVector{Symbol}} <:
4+
mutable struct TargetEncoder{R1 <: Real, R2 <: Real, A <: Any} <:
55
Unsupervised
6-
features::AS
6+
features::A
77
ignore::Bool
88
ordered_factor::Bool
99
lambda::R1
@@ -45,7 +45,7 @@ end
4545
struct TargetEncoderResult{
4646
I <: Integer,
4747
S <: AbstractString,
48-
A <: Any # Useless but likely can't do much better
48+
A <: Any, # Useless but likely can't do much better
4949
} <: MMI.MLJType
5050
# target statistic for each level of each categorical feature
5151
y_stat_given_feat_level::Dict{A, A}

β€Žsrc/encoders/target_encoding/target_encoding.jlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Fit a target encoder on table X with target y by computing the necessary statist
132132
function target_encoder_fit(
133133
X,
134134
y::AbstractVector,
135-
features::AbstractVector{Symbol} = Symbol[];
135+
features = Symbol[];
136136
ignore::Bool = true,
137137
ordered_factor::Bool = false,
138138
lambda::Real = 1.0,

0 commit comments

Comments
Β (0)