[PYTHON] [Question] In sk-learn random forest regression, an error occurs when the number of parallels is set to -1.

Premise

I'm trying to load a csv file with pandas and do a random forest regression with sk-learn. On the referring site, n_jobs of the following code was **-1 **, so when I copied it as it was, the following error was thrown.

sklearn.externals.joblib.my_exceptions.JoblibValueError: JoblibValueError

Here's the code that works fine:

r_forest = RandomForestRegressor(
    n_estimators=100,
    criterion='mse',
    random_state=1,
    n_jobs=1,
)

r_forest.fit(X_train, Y_train) #I get an error here
y_traing_preq = r_forest.predict(X_train)
y_test_preq = r_forest.predict(X_test)

I would appreciate it if anyone could teach me.

Recommended Posts

[Question] In sk-learn random forest regression, an error occurs when the number of parallels is set to -1.
[Python] I want to know the variables in the function when an error occurs!
[python] What to do when an error occurs in send_keys of headless chrome
Is the number equivalent to an integer?
[OSX] [pyenv] What to do when an SSL error occurs in pip
An example of the answer to the reference question of the study session. In python.
Set the number of elements in a NumPy one-dimensional array to a power of 2 (0 padded)
Set an upper limit on the number of recursive function iterations in Python
[Python] Type Error:'WebElement' object is not iterable What to do when an error occurs
Find a guideline for the number of processes / threads to set in the application server
How to get the number of digits in Python
[For beginners] I want to explain the number of learning times in an easy-to-understand manner.
How to specify an infinite number of tolerances in the numeric argument validation check of argparse
VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
When a character string of a certain series is in the Key of the dictionary, the character string is converted to the Value of the dictionary.
How to find the optimal number of clusters in k-means
Examine the margin of error in the number of deaths from pneumonia
What to do when an error occurs with import _ssl
I got an error when I tried to process luigi in parallel on windows, but the solution
How to get rid of the "Tags must be an array of hashes." Error in the qiita api
When I try to execute the make command of Makefile with os / exec of golang, the second and subsequent executions result in an error.
How to intentionally issue an error in the shell During testing
How to know the internal structure of an object in Python
[Python] Let's reduce the number of elements in the result in set operations
[Beanstalk] What to do when an error occurs with import uuid
[Note] Items to check when an infinite loop occurs in pyenv
The solution when an empty object is returned in go's json.Marshal
Error in ordinal number when importing Numpy in Anaconda environment of Windows
What to do when the value type is ambiguous in Python?
Solution when an error occurs when hiding the console screen with PyInstaller
[Python] What to do when PEP8 is violated in the process of importing from the directory added to sys.path
[Linux] What is the method to solve the package dependency error of yum and rpm in the actual workplace?
I want to display the number of num_boost_rounds when early_stopping is applied using XGBoost callback (not achieved)
[Django] What to do if an Integrity Error occurs when registering data from the management site to the database
[Python] I tried to summarize the set type (set) in an easy-to-understand manner.
What to do when the result downloaded via scrapy is in English
Python Note: When you want to know the attributes of an object
[Python] Calculate the number of digits required when filling in 0s [Note]
[Python] What to do when an error related to SSL authentication is returned
What to do if an error occurs when importing numpy with VScode
I want to leave an arbitrary command in the command history of Shell
What to do when the warning "The environment is in consistent ..." appears in the Anaconda environment
I get an error ~ is zero, singular U when passing the covariance matrix from the Linear layer to MultivariateNormal
An engineer who has noticed the emo of cryptography is trying to implement it in Python and defeat it