MLClassifier increase maxIterations in CreateML

Hello everyone !


I was in my playground discovering CreateML and i tried MLRegressor and MLClassifier in Swift and I tried different data.


Running my playground I got an error after the execution of MLClassifier :


Completed (Iteration limit reached).

This model may not be optimal. To improve it, consider increasing `max_iterations`.


Here is my code :

let bookTable = try MLDataTable(dictionary: mlData)

let classifier = try MLClassifier(trainingData: bookTable, targetColumn: "word")


It does 10 iterations then it stops sto it's not very accurate. I tried to look inside the class declaration but it seems to be set by a default value of 10.


Is it possible to increase this default value to get more acurate results ? I can't find how !


Thank you !

Replies

I am having the same problem. My training set has 26 columns and 178 rows.


I just found this in a blog: https://www.captechconsulting.com/blogs/a-weekend-with-createml-and-coreml

MaxIterations can be specified on the specific classifiers, e.g. BoostedTreeClassifier, RandomForestClassifier, DecisionTreeClassifier, LogisticRegressionClassifier, or SupportVectorClassifier. This is the same for regressors as well.


let classifier = try MLBoostedTreeClassifier(trainingData: bookTable, targetColumn: "word", parameters: .init(maxIterations: 50))