592 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
23
views
LinearRegression object has no attr coef_ (in pipeline)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
num_features, bin_features, cat_features = split_features(X)
preprocessor = ColumnTransformer([
('num', ...
0
votes
1
answer
57
views
Nested parallelism with GridSearchCV causes infinite hang
I'm running a GridSearchCV optimization into a parallelized function. The pseudocode looks like this
from tqdm.contrib.concurrent import process_map
from sklearn.model_selection import GridSearchCV
...
1
vote
0
answers
1k
views
AttributeError: 'super' object has no attribute 'sklearn_tags' when using GridSearchCV with KerasClassifier
I am working on a binary classification problem using a neural network with TensorFlow/Keras and scikit-learn's GridSearchCV for hyperparameter tuning. However, I am encountering an AttributeError ...
0
votes
1
answer
49
views
GridSeachCV custom profit function results with an error: missing 1 required positional argument: 'y'
I am trying to optimize my model with GridSearchCV, using a custom profit function. However, when I Run my code, I end up with the following error message: TypeError: profit_scorer() missing 1 ...
2
votes
1
answer
152
views
Have only 2 classes but why am I getting ValueError: Target is multiclass but average = 'binary'. Please choose another average setting
I am trying build an employee churn prediction model using GridSearchCV on OneClassSVM. My code is as below:
from sklearn.svm import OneClassSVM
from sklearn.model_selection import GridSearchCV
from ...
1
vote
1
answer
57
views
GridSearchCV with data indexed by time
I am trying to use the GridSearchCV from sklearn.model_selection. My data is a set of classification that is indexed by time. As a result, when doing cross validation, I want the training set to be ...
1
vote
0
answers
45
views
ERROR: raise ValueError(f"Shape of passed values is {passed}, indices imply {implied}") when using GridSearchCV
I tried to use GridSearchCV to train pipeline model but I met this error. When I trained without GridSearchCV, there is no error, so I don't understand what is the problem.
class FeatureEngineering(...
-1
votes
1
answer
143
views
Understanding K-Fold Cross-Validation, Model Training, and R² Scores
I'm working with K-Fold Cross-Validation in a Grid Search setup for hyperparameter tuning. I have a few questions about how the model is trained and evaluated:
When I use GridSearchCV, the model is ...
0
votes
1
answer
224
views
AttributeError: 'Sequential' object has no attribute 'compiled' while using gridsearch.fit
All the 2880 fits failed.
It is very likely that your model is misconfigured.
You can try to debug the error by setting error_score='raise'.
Below are more details about the failures:
2880 fits failed ...
0
votes
2
answers
544
views
Problems with selecting OptunaSearchCV pipeline parameters
I have a code with which I iterate over the hyperparameters of both the model itself and the entire pipeline
preprocessor = ColumnTransformer(
[
('OneHotEncoder', ...
1
vote
0
answers
81
views
GridSearchCV runs smoothly when scoring='accuracy', but not when scoring=accuracy_score
When I run the following piece of code in a Jupyter notebook inside Visual Studio Code, it runs smoothly.
from sklearn.datasets import load_iris
from sklearn.neighbors import KNeighborsClassifier
from ...
1
vote
0
answers
65
views
sklearn LeaveOneOut with cross_validate/GridSearchCV: how can I use confusion matrix-based scores as the custom scoring functions?
I’m using LeaveOneOut from sklearn, along with GridSesrchCV and cross_validate. I’m working on a medical problem so I’m interested in finding sensitivity and specificity.
However, because LeaveOneOut ...
-4
votes
1
answer
92
views
TypeError: create_lstm_model() missing 1 required positional argument: 'optimizer'
def create_lstm_model(optimizer, neurons, activation):
model = Sequential()
model.add(LSTM(units=neurons, input_shape=(X_train.shape[1], X_train.shape[2])))
model.add(Dropout(0.2))
...
0
votes
1
answer
86
views
"numpy.ndarray" is not callable
I am getting a type error if I run this code twice or multiple times. That means if I run it once, it won't show any error but if I run it multiple times it will show an error.
Some parts of the code:
...
0
votes
0
answers
722
views
ModuleNotFoundError: No module named 'keras.wrappers'
I'm trying to use GridSearchCV for a machine learning classification task, however I keep getting an error with this line, any suggestions?
from keras.wrappers.scikit_learn import KerasClassifier
my ...