1
$\begingroup$

I am running a RandomForestClassifier on my data but my jupyter notebook is very slow. It took almost 2 hours to run the below code:

rf = RandomForestClassifier()
rf_random = RandomizedSearchCV(estimator = rf, param_distributions = 
   random_grid, n_iter = 100, cv = 3, verbose=2, random_state=42, n_jobs = -1)
rf_random.fit(X_train, y_train)

My dataset has 30K rows and 300 features.

I am not sure if something is wrong with my code or jupyter notebook configuration. I am using a remote desktop windows machine.

I would really appreciate any help! Thanks in adnvace

$\endgroup$
  • $\begingroup$ Let me know if the answer below helped you with resolving your issue. If it has, please accept it as the answer. $\endgroup$ – IronKirby Sep 28 '18 at 0:56
2
$\begingroup$

In this case you are running a RandomizedSearchCV which is running 100 iterations. If you consider the fact that for every run of your 30K rows worth of data with youe 300 features (which is a fair amount), you would be looking at an average run time of ~ 1.2 minutes per run.

You could however speed this if you were running thia via GPUs instead of CPUs as you could do more rapid calculations.

So to answer your question the issue is not with your machine or your Jupyter Notebook. Rather it is with how many iterations you have had with your RF Randomized Search Algorithm. If you reduce the iterations, you will also see a reduction in the run time.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.