I use GridSearchCV
as follows:
gsearch_lgb = GridSearchCV(
model(**self.model_params),
param_grid=self.model_params,
n_jobs=2,
verbose=99,
scoring=self.cv_scoring,
cv=4,
)
But joblib still uses my all cores:
I also tried n_jobs=-19
since sklearn document said
"For n_jobs below -1, (n_cpus + 1 + n_jobs) are used"
But still not working, all my cpus are used.
How should I modified my code to reduce CPU usage?
It turns out I have to set n_jobs
as lgbm.Regressor parameter also, so the total CPU usage would be:
total_cpu
= GridSeaechCV.fit n_jobs
x lgbm.fit n_jobs