Question

I'm using scikit-learn to train classifiers. I'm particularly using linear_model.LogisticRegression. But my question is: what's the stopping criteria for the training?! because I don't see any parameter that indicates the number of epochs!

Also the same for random forests?

Was it helpful?

Solution

There's no hard limit to the number of iterations for LogisticRegression; instead it tries to detect convergence with a specified tolerance, tol: the smaller tol, the longer the algorithm will run.

From the source code, I gather that the algorithms stops when the norm of the objective's gradient is less than tol times its initial value, before training started. This is worth documenting.

As for random forests, training stops when n_estimators trees have been fit of maximum depth max_depth, constrained by the parameters min_samples_split, min_samples_leaf and max_leaf_nodes. Tree learning is completely different from iterative linear model learning.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top