FWIW, I get a different error (possibly using different data) than you. It seems to suggest that the types at the end of the pipeline before learner
don’t match what fit!
expects:
using CombineML.Util
using CombineML.Transformers
import RDatasets
iris = RDatasets.dataset("datasets", "iris")
X = convert(Array, iris[[:SepalLength, :SepalWidth, :PetalLength, :PetalWidth]])
y = convert(Array, iris[:Species]);
learner = StackEnsemble(Dict(
:learners => [
PrunedTree(),
RandomForest(),
DecisionStumpAdaboost()
],
:stacker => RandomForest()
));
# Create pipeline
pipeline1 = Pipeline(Dict(
:transformers => [
OneHotEncoder(), # Encodes nominal features into numeric
Imputer(), # Imputes NA values
StandardScaler(), # Standardizes features
PCA(),
learner # Predicts labels on features
]
));
fit!(pipeline1, X, y)
the error being
ERROR: MethodError: no method matching fit!(::StackEnsemble, ::LinearAlgebra.Adjoint{Float64,Array{Float64,2}}, ::Array{String,1})
Closest candidates are:
fit!(::StackEnsemble, ::Array{T,2} where T, ::Array{T,1} where T) at /Users/tlienart/.julia/packages/CombineML/p9oKU/src/combineml/ensemble.jl:84
fit!(::Transformer, ::Array{T,2} where T, ::Array{T,1} where T) at /Users/tlienart/.julia/packages/CombineML/p9oKU/src/types.jl:27
fit!(::Baseline, ::Array{T,2} where T, ::Array{T,1} where T) at /Users/tlienart/.julia/packages/CombineML/p9oKU/src/combineml/baseline.jl:34
showing that the issue is that whatever comes out of your pipeline, once it gets to the learner, the dimensions and or types are not ok.
In fact just applying your learner
directly on the data works
julia> fit!(learner, X, y)
Dict{Symbol,Any} with 4 entries:
:learners => Learner[PrunedTree(Decision Tree…
:keep_original_features => false
:stacker => RandomForest(Ensemble of Decision Trees…
:label_map => LabelMap (with 3 labels):…
So maybe a couple of pointers to try:
- apply the same
using
as in the example so not loading CombineML
by itself
- make sure that the pipeline doesn’t alter types and dimensions differently than what you’d expect