Closed ghost closed 5 years ago
Which version of Talos you are on?
import talos
talos.__version__
I'm on 0.4.9
You can overcome this by manually splitting your data, and then passing it explicitly through Scan( ... x_val, y_val ...)
.
Regarding the issue, in my system I can't replicate it. What I had done is:
import wrangle
normed_train_data, train_labels = wrangle.utils.create_synth_data(n=6181, features=26)
NOTE: as you can see the changes are insubstantial in the sense that the workings of the model is not changed, but the things I changed, threw a non-Talos error before changing it.
The below runs on my system. Can you follow the same steps on your system and see if you can replicate the error you are getting.
import keras
import talos
import tensorflow as tf
import time
import os
def build_and_fit_model(normed_train_data, train_labels, x_val, y_val, params):
model = keras.Sequential([
keras.layers.Dense(256, activation=tf.nn.relu, input_shape=[26]),
keras.layers.Dense(params['first_neuron'], activation=tf.nn.relu),
keras.layers.Dense(1)
])
model.compile(loss='mean_squared_error',
optimizer='RMSprop',
metrics=['mean_absolute_error', 'mean_squared_error'])
# Saving the model during training
timestr = time.strftime("%Y%m%d-%H%M%S")
checkpoint_path = 'test' + "_" + timestr + "/cp-{epoch:04d}.ckpt"
checkpoint_dir = os.path.dirname(checkpoint_path)
# Create checkpoint callback
cp_callback = tf.keras.callbacks.ModelCheckpoint(
checkpoint_path, verbose=1, save_weights_only=True,
# Save weights, every 5-epochs.
period=15)
# The patience parameter is the amount of epochs to check for improvement
early_stop = keras.callbacks.EarlyStopping(monitor='val_loss', patience=10)
# With early stop
history = model.fit(normed_train_data, train_labels, epochs=1000,
validation_data=[x_val, y_val], verbose=1, callbacks=[cp_callback, early_stop])
return history, model
t = talos.Scan(x=normed_train_data, y=train_labels, params=p, model=build_and_fit_model, val_split=0.1275)
I was passing a dataframe into the model as the data, which talos did not seem to like. The earlier error is now fixed, however because I want to minimize my mean squared error and mean absolute error I was wondering if there is sort of a rounds2low instead of a rounds2high, since this is not what I want. Thank you!
Also, when trying to evaluate the models, I get a AxisError: axis 1 is out of bounds for array of dimension 1
error, even with the wrangler data. Do you have the same problem?
wondering if there is sort of a rounds2low instead of a rounds2high, since this is not what I want. Thank you!
Can you clarify what you mean with this?
Also, when trying to evaluate the models, I get a AxisError: axis 1 is out of bounds for array of dimension 1 error, even with the wrangler data. Do you have the same problem?
Please create a new issue for this.
Closing here as it seems to be resolved and no updates.
Thanks so much for coming here to raise an issue. Please take a moment to 'check' the below boxes:
[x] I'm up-to-date with the latest release:
pip install -U talos
[x] I've confirmed that my Keras model works outside of Talos.
If you still have an error, please submit complete trace and a code with:
You can provide the code in pastebin / gist or any other format you like.
I'm trying to optimize only the first node count, but talos seems to return a pandas error. x shape: (6181, 24) y shape: (6181, 1)
Using this model:
When trying to run the code it gives the following error:
I don't know where the problem lies, so if someone could help me that would be awesome.