Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What's the max number of iterations in max iter?


Asked by Melany Knox on Dec 07, 2021 FAQ



max_iter : int, default: 300 Maximum number of iterations of the k-means algorithm for a single run. But in my opinion if I have 100 Objects the code must run 100 times, if I have 10.000 Objects the code must run 10.000 times to classify every object.
Furthermore,
I'd like to understand the parameter max_iter from the class sklearn.cluster.KMeans. According to the documentation: max_iter : int, default: 300 Maximum number of iterations of the k-means algorithm for a single run.
Also, 2) In my experience, solver not "liblinear" requires more max_iter iterations to converge given the same input data. 3) I didn't see any 'max_iter set in your code snippet. It currently defaults to 100` (sklearn 0.22). 4) I saw you set the the regularization parameter C=100000.
Besides,
Maximum number of iterations. The solver iterates until convergence (determined by ‘tol’) or this number of iterations. For stochastic solvers (‘sgd’, ‘adam’), note that this determines the number of epochs (how many times each data point will be used), not the number of gradient steps. Whether to shuffle samples in each iteration.
Just so,
The default maximum number of iterations is 25, and I **doubt** you will get anything by changing it to anything larger. The accuracy is 1e-08, which is already very small.