In the first lines of code of this example can someone explain the use of random_state
in the line:
clf = svm.SVC(kernel='linear', C=1, random_state=42)
I am new in scikit-learn and I do not understand the usage of random_state
since probability=False
by default.
As stated in the SVC documentation:
random_state
: Controls the pseudo random number generation for shuffling the data for probability estimates. Ignored whenprobability
is False. Pass an int for reproducible output across multiple function calls.
So in this particular case: random_state=42
does not change the behavior, but neither does it hurt performance.
It is helpful to have reproducible results when sharing/writing documentation. Therefore, it's often good to be in the habit of adding random_state=[something]
, even in cases when it is not strictly needed.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments