Make grid search functions in sklearn to ignore empty models
问题 Using python and scikit-learn, I'd like to do a grid search. But some of my models end up being empty. How can I make the grid search function to ignore those models? I guess I can have a scoring function which returns 0 if the models is empty, but I'm not sure how. predictor = sklearn.svm.LinearSVC(penalty='l1', dual=False, class_weight='auto') param_dist = {'C': pow(2.0, np.arange(-10, 11))} learner = sklearn.grid_search.GridSearchCV(estimator=predictor, param_grid=param_dist, n_jobs=self.n