Questions tagged [gridsearchcv]

This tag is for questions on the process of running an exhaustive search over specified parameter values for an estimator using the class GridSearchCV from Python's scikit-learn library.

597 questions
-1
votes
1 answer

How to Customize Metric for GridSearchCV in Scikit Learn to tune for specific class?

I have a use case in ML where I have 2 classes, 0 and 1 for a given text. Class-0: Can afford some misclassifications Class-1: Very Important, can't afford any misclassifications There's a huge imbalance in samples for both classes, about 30000…
-1
votes
1 answer

Splitting data in python such that each subject stays in one fold (m fold cross validation)

So here is the thing. I am applying a binary classifier for 5 patients(P1,P2,...P5). each patients has 100 samples of data and the output is either 0 or 1. So I put one patient aside(say P5) as a testing data and used the remaining for validation…
Nevi
  • 89
  • 8
-1
votes
1 answer

GridSearchCV fitting

I'm having problems to fit my classifier using binarized labels. clf_linear = GridSearchCV(SVC(kernel='linear', class_weight='balanced'), param_grid, cv=5) clf_linear = clf_linear.fit(X_train_pca, y_train) y_train was…
-2
votes
0 answers

LSTM Dense Layer is 3 but does not create the expected (1000,3) output and does (1000,) instead?

Some background. I am using gridsearchCV on an LSTM model. I am running on Jupyter notebook. My dense layer is as such: model.add(Dense(3,activation = 'softmax')) my y data is of the shape (1000,3) However, the model.predict does not create a…
PythNoob
  • 139
  • 1
  • 1
  • 7
-2
votes
1 answer

How can I implement RandomizedSearchCV for GradientBoostingRegressor in scikit-learn instead of GridSearchCV?

I am trying to run a regression model using sklearn GradientBoostingRegressor. I have seen some GridSearchCV implementations for the hyperparameter tuning, however in order to reduce the computation time I would like to implement RandomizedSearch.…
-2
votes
1 answer

when I run GridSearchCV() classifier with parameters so i get this kind of error:-ValueError: could not convert string to float: 'text'

so please how can I resolve this kind of error, anyone's guide me please X = df.iloc[:,:-2] y = df.My_Labels from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score,confusion_matrix,classification_report from…
-2
votes
1 answer

GridSearchCV with Random Forest- Invalid Parameter Error

I'm trying to find best parameters using GridSearchCV but I'm getting Invalid parameter error. from sklearn.model_selection import GridSearchCV from sklearn.ensemble import RandomForestRegressor from sklearn import metrics clf=…
svn_21
  • 17
  • 6
-2
votes
1 answer

Is there a way two predict more than one model in GridSearchCV in sci-kit?

I am using GridSearchCV from the sk.learn library at the moment. When you call the predict method of GridSearchCV it always predicts on the test set with the best scoring estimator in the training set. However there are such problems as overfitting…
DerBenutzer
  • 311
  • 1
  • 5
  • 20
-3
votes
2 answers

Does anybody know Hyperparameters of GridSearchCV for MultiOutputClassifier model?

from sklearn.model_selection import GridSearchCV *parameters = {**?????**}* search = GridSearchCV(_pipeline, n_jobs=1, cv= 5, param_grid=parameters) #multi_target_linear = MultiOutputClassifier(search) search.fit(X,…
-3
votes
2 answers

pipeline for RandomOversampler, RandomForestClassifier & GridSearchCV

I am working on a binary text classification problem. As the classes are highly imbalanced, I am using sampling techniques like RandomOversampler(). Then for classification I would use RandomForestClassifier() whose parameters need to be tuned using…
1 2 3
39
40