I am working on VSCode trying to use MLJ to learn classification models in Julia. My dataset is of medium size (100 instances, 3500 predictor features of comparable magnitude and 2 classes in which to classify my examples). I am currently training an SVM, and the code I am using for tuning the model is the following:
t_svc = TunedModel(model=svc_model, ranges=[rcost, rgamma], tuning=Grid(resolution=3),
resampling=str_cv, measure=misclassification_rate)
where
rcost = range(svc_model, :cost, lower=0.01, upper=100, scale = :log)
rgamma = range(svc_model, :gamma, lower=0.01, upper=100, scale = :log)
str_cv = (StratifiedCV(nfolds=10, shuffle=true, rng=Random.GLOBAL_RNG))
which runs fine.
However, I would like to use a higher resolution than 3 to try out a larger number of values for C and gamma, but when I increase it to 4 or more, the terminal crashes. I get an error message for a really brief moment (so short it's impossible to know what it says) and then it terminates with the following pop-up message:
The terminal process "C:\Users\ivica\AppData\Local\Programs\Julia\Julia-1.4.2\bin\julia.exe '-i', '--banner=no', '--project=c:\Users\ivica\Documents\GitHub\Mozzie_diagnostics', 'c:\Users\ivica.vscode\extensions\julialang.language-julia-1.0.10\scripts\terminalserver\terminalserver.jl', '\.\pipe\vsc-julia-repl-21120', '\.\pipe\vsc-jl-cr-21120', 'USE_REVISE=true', 'USE_PLOTPANE=true', 'DEBUG_MODE=undefined'" terminated with exit code: 1.
Find below a small reproducible example:
using MLJ
using Random
X = MLJ.table(rand(100, 100))
y = categorical(rand((0, 1), 100), ordered = true)
@load SVC pkg=LIBSVM
svc_model = SVC()
svc_mach = machine(svc_model, X, y)
rcost = range(svc_model, :cost, lower=0.01, upper=100, scale = :log)
rgamma = range(svc_model, :gamma, lower=0.001, upper=10, scale = :log)
str_cv = (StratifiedCV(nfolds=5))
t_svc = TunedModel(model=svc_model, ranges=[rgamma, rcost], tuning=Grid(resolution=5),
resampling=str_cv, measure=misclassification_rate)
svc_mach_tuned = machine(t_svc, X, y)
fit!(svc_mach_tuned, verbosity = 5, force = true)
Important: I have found that the error only happens sometimes, being more likely to happen with higher resolution values. If you try the example above and it works fine, please evaluate the last line again to retrain the machine and see if it always works. It has never worked twice in a row for me with resolution = 5.