Reputation: 31
I am trying to use RandomizedSearchCV from sklearn on an MLPRegressor model, and I have scaled the data using standardScaler. The code for the model is presented below. When I try to run the code I get this error from the ann_random.fit(x_train,y_train.flatten()):
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
I have checked if the dataset contains any nan or infinite values, but there seems like there is none. I have also tried to run the code with an MLPRegressor model with the given hyperparametes:
model = MLPRegressor(activation='relu', solver='adam', hidden_layer_sizes=(150,100,50), max_iter=500)
and the code works fine when I run the MLPRegressor model without the randomizedsearch.
What can be the cause of this error?
Upvotes: -1
Views: 861
Reputation: 278
before tarin model first take look at your data : first find missing value with thid code :
df.isnall().sum()
if in your data have missing value remove them or fill them
df = df.dropna()
second: normalize your data between 0 and 1 i hope my solution help you
Upvotes: 0