Hi,
I’m trying to save a ScikitLearn pipeline but JLD is encountering a fatal error. A MWE is below. My versions are ScikitLearn@v0.7.0
, JLD@v0.10.0
, PyCallJLD@v0.2.1
. Pkg.status(outdated=true)
returns that PyCallJLD is prohibiting an update in JLD. Any advice for how I can fix the issue? Thanks in advance! (Apologies if the markdown doesn’t come through. I wasn’t clear how to format the code in the discourse.)
using ScikitLearn,JLD,PyCallJLD;
@sk_import preprocessing: (OneHotEncoder,FunctionTransformer);
@sk_import compose: ColumnTransformer;
function colshndl(X0::AbstractArray)
ids = [2,3];
X = hcat(X0,X0[:,ids]);
return X
end;
cols_ft = FunctionTransformer(colshndl);
ohot_ct = ColumnTransformer([("cat1",OneHotEncoder(),[0]),
("cat2",OneHotEncoder(categories=[[-1]],handle_unknown="ignore"),[15]),
("cat3",OneHotEncoder(categories=[[-1]],handle_unknown="ignore"),[16]),
("cat4",OneHotEncoder(),[3]),
("cat5",OneHotEncoder(),[4]),
("cat6",OneHotEncoder(),[5]),
("cat7",OneHotEncoder(categories=[[-1]],handle_unknown="ignore"),[8]),
("cat8",OneHotEncoder(categories=[[-1]],handle_unknown="ignore"),[9]),
("cat9",OneHotEncoder(),[13]),
("cat10",OneHotEncoder(),[14])],
remainder="passthrough");
prepipe = Pipelines.Pipeline([("cols",cols_ft),
("ohot",ohot_ct)]);
X = rand(141,15);
fit!(prepipe,X);
JLD.save("error.jld","prepipe",prepipe);
The error returned is
┌ Warning: JLD incorrectly extends FileIO functions (see FileIO documentation)
└ @ FileIO C:\Users\Colin.julia\packages\FileIO\BE7iZ\src\loadsave.jl:217
Error encountered while save FileIO.File{FileIO.DataFormat{:JLD}, String}(“error.jld”).
Fatal error:
type DataType has no field mutable