Skip to content

Commit 08d973f

Browse files
authored
Merge pull request #26 from JuliaAI/add-callable-and-better-errors
✨ Add callable features and better error testing
2 parents 98893ea + 52ba39d commit 08d973f

File tree

20 files changed

+131
-54
lines changed

20 files changed

+131
-54
lines changed

.github/workflows/CI.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
matrix:
2525
version:
2626
- '1.10'
27-
- '1.6'
2827
- 'nightly'
2928
os:
3029
- ubuntu-latest

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ScientificTypes = "3.0"
2626
StatsBase = "0.34"
2727
TableOperations = "1.2"
2828
Tables = "1.11"
29-
julia = "1.6.7"
29+
julia = "1.10"
3030

3131
[extras]
3232
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

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
output_type::Type

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
output_type::Type = Float32,

0 commit comments

Comments
 (0)