MLJ.fit! complain "UndefVarError: level not defined" in a sysimage

Hello,

I try to fit a simple logistic regression in Julia, with a sysimage, which loaded these packages :

  • “OhMyREPL” “Plots” “GLMakie” “DataFrames” “RCall” “PyCall” “CSV” “Flux” “Random” “TensorBoardLogger”

Here is my simple code:

using MLJ, ScikitLearn, MLJScikitLearnInterface, DataFrames
# demo data
df3 = DataFrame( X1 = randn(30), 
	X2 = randn(30), 
	X3 = randn(30), 
	y = repeat(["A","B"], 15))
coerce!(df3, :y => Multiclass)
# Then I also check the scitypes
df3 |> schema

mymodel =  machine(LogisticClassifier(),
	select(df3, r"^X"), 
	df3.y)

# here the ERROR happened
MLJ.fit!(mymodel)

when I run the codes in a normal Julia env without sysimage, everything is OK, but when I run with the sysimage env, I got this ERROR:

UndefVarError: level not defined

  1. getproperty @ Base.jl:35 [inlined]
  2. int (::MLJModelInterface.FullInterface, ::CategoricalArrays.CategoricalValue{String, UInt32})@ data_utils.jl:22
  3. var"#int#9" (::Nothing, ::typeof(MLJModelInterface.int), ::CategoricalArrays.CategoricalValue{String, UInt32}) @ data_utils.jl:73

but I have no idea what the level is. Thank for any suggestion to debug or correct my code.

level is in CategoricalArrays.jl but that shouldn’t matter I think.

I don’t have much experience with PackageCompiler.jl, but could there be a mismatch between package versions in your environment and the ones the sysimage was compiled with?

1 Like