Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'verbose' argument in scikit-learn

Many scikit-learn functions have a verbose argument that, according to their documentation, "[c]ontrols the verbosity: the higher, the more messages" (e.g., GridSearchCV).

Unfortunately, no guidance is provided on which integers are allowed (e.g., can a user set verbosity to 100?) and what level of verbosity corresponds to which integers. I cannot find this information anywhere in the documentation.

My question is, which integers map to which levels of verbosity?

like image 215
Gyan Veda Avatar asked May 01 '15 21:05

Gyan Veda


People also ask

What does verbose do in Sklearn?

Verbose is a general programming term for produce lots of logging output. You can think of it as asking the program to "tell me everything about what you are doing all the time". Just set it to true and see what happens.

What is verbose argument in Python?

VERBOSE : This flag allows you to write regular expressions that look nicer and are more readable by allowing you to visually separate logical sections of the pattern and add comments.

What is verbose parameter?

The -verbose parameter tells you what has been done. If you are doing something risky, then the verbose parameter doesn't provide protection against ill-advised actions like the -whatif or =confirm parameters, at least if you haven't worked out the precise effect of the command.

What is verbose in Kmeans?

Verbose means that it will output messages which could be useful for debugging and for understanding how the training is doing. The inertia is the sum of the squared distance for each point to it's closest centroid, i.e., its assigned cluster.


2 Answers

Higher integers map to higher verbosity as the docstring says. You can set verbosity=100 but I'm pretty sure it will be the same as verbosity=10. If you are looking for a list of what exactly is printed for each estimator for each integer, you have to look into the source. I think most estimators only have two or three levels of verbosity, I think 3 or above will be the most verbose you can get.

like image 105
Andreas Mueller Avatar answered Oct 02 '22 23:10

Andreas Mueller


Might be a bit late, but since I stumbled over the same question when setting up my GridSearch, I found this in the docstring in the deepest depths of the submodule sklearn\externals\joblib\parallel.py:

"The verbosity level: if non zero, progress messages are printed. Above 50, the output is sent to stdout. The frequency of the messages increases with the verbosity level. If it more than 10, all iterations are reported."

In addition, the Glossary (search for "verbose") says this:

"Logging is not handled very consistently in Scikit-learn at present, but when it is provided as an option, the verbose parameter is usually available to choose no logging (set to False). Any True value should enable some logging, but larger integers (e.g. above 10) may be needed for full verbosity. Verbose logs are usually printed to Standard Output. Estimators should not produce any output on Standard Output with the default verbose setting."

like image 29
s6hebern Avatar answered Oct 02 '22 23:10

s6hebern