Suppose you make KNN and must choose between k=[1,2,3,4,5, ... 1000] . Even if you set n_jobs=2 , GridSearchCV will first create 1000 jobs, each of which will have one choice of your k , and also make 1000 copies of your data (perhaps blow up your memory if your data is large) and then send these 1000 jobs up to 2 processors (most jobs will, of course, be expected). GridSearchCV does not just generate 2 jobs for two processors, because the on-demand sawing process is expensive. It directly creates an equal number of tasks in the form of combinations of parameters (1000 in this case). In this sense, n_jobs may be misleading. Now, using pre_dispatch , you can set how many predefined tasks you want to create.
source share