All Questions

Tagged with
Filter by
Sorted by
Tagged with
9 votes
4 answers
7k views

Cannot clone object <tensorflow.python.keras.wrappers.scikit_learn.KerasClassifier object

This is with regards to TF 2.0. Please find below my code that performs GridSearch along with Cross Validation using sklearn.model_selection.GridSearchCV for the mnist dataset that works perfectly ...
Surajit Chakraborty's user avatar
5 votes
1 answer
2k views

How to use KerasClassifier validation split and using scitkit learn GridSearchCV

I want to try to test some hyperparameters, thats i want to use the GridSearchCV, because it seems like thats the way to do it. But i also want to use the validation split. To use Callsbacks like ...
Tollpatsch's user avatar
2 votes
2 answers
2k views

ImageDataGenerator.flow_from_directory to a dataset that can be used in Kfold

I am trying to use the cross validation approach for the model I use for classifying images into 3 classes. I use the following code to import images: train_datagen = ImageDataGenerator(rescale=1./255)...
StackOverflowUser's user avatar
2 votes
1 answer
1k views

how to create train, test & validation split of tf.data.Dataset in tf 2.1.0

the following code is copied from : https://www.tensorflow.org/tutorials/load_data/images the code aims to create dataset of images downloaded from the web and stored into folders depending upon ...
Aditya Bachhawat's user avatar
1 vote
1 answer
110 views

ImageDataGenerator Predict Class - Why are the predictions not correctly converting from probabilities to predicted class?

I have a directory set up like this: images -- val --class1 --class2 -- test --all_classes -- train --class1 --class2 In each dir is a set of images. I want to predict if each ...
Slowat_Kela's user avatar
  • 1,447
1 vote
1 answer
1k views

How to export a model created from KerasClassifier and Gridsearchcv using joblib or pickle?

def network(optimizers='rmsprop'): model = tf.keras.models.Sequential() model.add(tf.keras.layers.Embedding(vocab_size, 100, weights=[embedding_matrix], input_length=length, trainable=True)) ...
superduper's user avatar
1 vote
0 answers
107 views

Kernel dying in juypter notebook

My kernel is dying everytime i run the following code. There is no error or anything so i dont know what is happening. I am running python 3.8.8 on the new macbook m1. from sklearn.model_selection ...
LELOUCH's user avatar
  • 29
0 votes
1 answer
692 views

Missing Positional Argument X

I'm currently working to set up a randomized search to help find the best parameters for a model. But I've hit an error that I can't find anywhere on google: Missing positional argument 'x' in the ....
Grant Allan's user avatar
0 votes
1 answer
8k views

AttributeError: 'numpy.ndarray' object has no attribute 'transform'

I want to create a sklearn pipeline that consists of two steps: Custom transformer function Keras classification model This is my data set (of course, I'm providing a reduced subset to show the data ...
Fluxy's user avatar
  • 2,928
0 votes
1 answer
509 views

KerasClassifier object has no attribute model

I'm using CalibratedClassifierCV to calibrate the probabilities of my CNN model. I'm using the following code: from tensorflow.keras.models import load_model from tensorflow.keras.wrappers....
machinery's user avatar
  • 6,092
0 votes
0 answers
40 views

RandomForestClassifier should be a binary classifier

I have written a code that performs rogue device detection using Random Forest and Decision Tree classifiers. The models were successfully trained. However, it returns an error at inference: "...
A. Mohammad's user avatar
0 votes
0 answers
24 views

Class_Weight for Multiclass classification in Neural Network

I am working on a Neural Network for Multiclass classification where class labels are -1,0,1. These class labels imbalanced hence I am using class_weights. And I am getting below error message- ...
Mohit Garg's user avatar
0 votes
0 answers
28 views

My True/false statements in my dataframe change overtime in the code (tenserflow.kerax)

So im ussing NASA asteroids dataset with tenserflow.kerax for some university assignment The first thing i wanted was to standardize the data so i use (1) df = dfprime ss = StandardScaler() df_scaled =...
Diego Pavez Verdi's user avatar
0 votes
0 answers
92 views

What do KerasRegressor object at 0x7f466c02fe20> & rv_frozen object at 0x7f46ed175580> thrown by sklearn.model_selection.RandomizedSearchCV.fit mean?

I am trying to optimize the hyperparameters of a neural network in (Cent OS 8, Anaconda, Jupyter Notebook, Python) with the method sklearn.model_selection.RandomizedSearchCV.fit but the call to this ...
goahead97's user avatar
0 votes
0 answers
125 views

Loss not changing and accuracy remains 0 after calling fit()

I'm new to keras and tensorflow, I have a model that I am trying to train where the loss does not change after epoch #1. my data is the sequence of numbers which I want NN to learn and predict the ...
radkal2's user avatar
  • 63
0 votes
0 answers
303 views

How to use sklearn.metrics.classification_report with generator?

I would like to use sklearn.metrics.classification_report but I cannot use it directly as my testing data is provided by a python generator. The python generator is given below. Let me give you the ...
kakarotto's user avatar
  • 190
0 votes
0 answers
97 views

SKlearn votingClassifier() cloned model showing NOneType for parameter

I have a base estimator class I created that trains a NN from TF.keras something like: TF_NN(BaseEstimator): def __init__(self,...,parameter='defaultstring', metric='accuracy', ...): ...
brian_ds's user avatar
  • 337
-2 votes
1 answer
158 views

What should be the input-shape number when i am adding the input layer in my ANN, considering that I have preprocessed the data with OneHotEncoder?

My dataset has categorical and numerical features. The dataset has 7 independent variables and 1 dependent variable (called as a product). The dataset looks like this: In general, there are 3 ...
Carla Flores's user avatar