Question about randomstate usage in an svc example

jmcornil

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.

Alexander L. Hayes

As stated in the SVC documentation:

random_state: Controls the pseudo random number generation for shuffling the data for probability estimates. Ignored when probability 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.

edited at
0

Comments

0 comments
Login to comment

Related

Question about encapsulation with example question

Question about template's value_type usage in Stroustrup's book example

Question About An Time Complexity Example

A question about usage of cloneNode and insertBefore

Question about the Shared Preference usage

PostgreSQL, Window function usage question (with specific example)

Trying to learn about encapsulation example question included

Question about delegate and protocol in swift (with example)

Question about the usage of shared_from_this() in practice

Question about the usage of std::move() in member overloading

Have a question about react hook usage for "useEffect"

Question about TUN/TAP devices usage

The usage of randomstate in Numpy related to seed

I have a question about generic view in Django's tutorial example

Question about java streams dropWhile example in Modern Java in Action

C++: question about move constructor/assignment using Stroustrup example

MISRA 13.5 question about non-compilant example

I have a question about Go pointer usage in package bytes

ARM assembly SVC call - confused about getting SVC instruction with LDRH

About "this" usage

Python: Question about the usage of max() and min() when the input numbers are two-digit

A question about the relationship between MySQL query_cost and actual usage time

wxWidgets wxThreadHelper Example Question

argparse add example usage

Python super usage example

Guava ForwardingList usage example

std::mutex usage example

Example OverlayFS Usage

Example usage of $at register in MIPS