Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
0 votes
0 answers
70 views

How to speed up Keras Tuning on multi core machine?

This question is related to the Distributed hyperparameter tuning strategy of keras tuner to get the possible hyperparameters for my model. The search space is huge. The worker thread is as in the ...
Don Woodward's user avatar
2 votes
1 answer
71 views

Cannot see all `Dense` layer info from `search_space_summary()` when using `RandomSearch Tuner` in Keras-Tuner?

I am trying to use keras-tuner to tune hyperparameters, like !pip install keras-tuner --upgrade import keras_tuner as kt from tensorflow.keras.models import Sequential from tensorflow.keras.layers ...
ThomasIsCoding's user avatar
0 votes
0 answers
90 views

Not obtaining optimal results with Keras Tuner - Not receieving the same optimal model that keras tuner suggests I can get

Keras tuner suggests that the best val_loss I can get is 9920.19 but when I run a model with the best parameteres I am not obtaining a best val_loss anywhere near that. It also suggests the best ...
leakie's user avatar
  • 1
0 votes
1 answer
47 views

Is validation split implemented in keras-tuner?

I am trying to tune a scikit-learn Random Forest Classifier with the appropiate keras tuner interface, but passing validation_split=0.3 doesn't seem to work. Here is my code: def build_model(hp): ...
jordi pomada's user avatar
4 votes
1 answer
646 views

Google Colab TPU suddenly not found anymore

Issue Since Monday or Thuesday this week (10.03.2025) the Google Colab TPUs are not found anymore. Can someone help me please? I am using TensorFlow Version: 2.18.1 Keras-Tuner Version: 1.4.7 These ...
Albert Blarer's user avatar
0 votes
0 answers
70 views

How to resolved the import error with scipy when using keras_tuner?

I have download the tensorflow nightly version 2.19.0.dev20241219 (cpu version) and download the version keras_tuner 1.4.7 and keras 3.7.0. I also check my system has the scipy version 1.15.0. ...
Nghiệp Le's user avatar
0 votes
0 answers
16 views

Keras tuner with functional model, incorrect results

I'm trying to use the Keras Tuner package to do a hyperparameter search, including tuning the number of layers in my NN. My code looks as follows: def model_builder(hp): inputs = Input(shape=(40,...
Nir's user avatar
  • 61
2 votes
1 answer
300 views

Keras Error 'keras.layers' has no attribute 'RandomRotation'

I am trying to optimize a CNN made with KERAS. For that I wanted to use the KERAS TUNER module. However, when importing the module i get the error message: "AttributeError: module 'tensorflow....
Phasco's user avatar
  • 31
1 vote
1 answer
191 views

Attribute error when running tuner.search (keras tuner)

I have an issue when I run the function tuner.search from the keras-tuner library. I am trying to tune my hyperparameters but when I call this function, it stops after 3 tries and in each try it is ...
kyasz's user avatar
  • 11
0 votes
1 answer
88 views

Keras Hyperparameter Tuning with Functional API

I am trying to user Keras Tuner to optimize some hyperparameters, and this is the code: def criar_modelo(hp): lstm_input = Input(shape=(x_train_lstm.shape[1], 1), name='LSTM_Input_Layer') ...
Murilo's user avatar
  • 679
0 votes
1 answer
133 views

How do I solve this Error while using keras tuner in building LSTM model?

I am using glove embeddings in embeddings layer of LSTM. I wrote a function to build model as below: def build_model(hp): model = keras.Sequential() model.add(Embedding(input_dim=vocab_size, # ...
Rohit Jain's user avatar
0 votes
1 answer
446 views

Having Trouble Using F1 Score as a Metric in Keras-Tuner

I want to optimize the f1-score for a binary image classification model using keras-tuner. I know the default F1 Score metric is removed for keras, so I tried using Tensorflow Addons' F1Score() class, ...
user22931525's user avatar
3 votes
0 answers
466 views

Keras-Tuner parallel processing using multi-core CPU

I am currently running a hyperparameter search in Keras-Tuner using GridSearch. I wanted to get some clarification on whether or not Keras-Tuner can utilize multiple CPU cores/threads to speed up the ...
ibnfaisalc's user avatar
1 vote
0 answers
2k views

RuntimeError: Number of consecutive failures exceeded the limit of 3 during Keras Tuner search

I'm encountering a RuntimeError when using Keras Tuner to search for the best hyperparameters for my image segmentation model. The error indicates that the number of consecutive failures has exceeded ...
sysOut's user avatar
  • 427
0 votes
1 answer
153 views

keras_tuner does not work in time series forecasting

I tried to tune hyperparameters of my gru model using keras_tuner, but it did not work. It worked when I run the code without validation data here:tuner.search(x_train, epochs=5, validation_data=x_val)...
Ten's user avatar
  • 43
1 vote
0 answers
362 views

Only keep the best trial using keras-tuner (Hyperband)

How can I tell keras_tuner to only save the best model (overwriting each trial) and not create any checkpoints or directories for each trial? There has been discussion already about how to reduce the ...
m13op22's user avatar
  • 2,379
0 votes
1 answer
971 views

AttributeError: module 'keras_tuner.engine' has no attribute 'tuner'

I am using google colab and i have been trying to import autokeras, however when i do so, I get this error below. I have tried !pip install autokeras. I have tried to updated tensorflow, autokeras, ...
Kaitlin Rentmeester's user avatar
1 vote
1 answer
151 views

keras_tuner found dict_keys([]) after using custom Callback function

I have a problem using the Keras tuner for hyperparameter tuning while using a custom callback function. In my callback function I basically want to evaluate every trained model and save some specific ...
Lukas's user avatar
  • 11
0 votes
1 answer
74 views

Tensorflow: Graph of the iterator is different from the graph the dataset was created in

While using the Keras_tuner library I got the error in the title. I have no clue how to fix it and could not find any solutions for some time. I am using Tensorflow BatchDatasets and passing them for ...
Meno's user avatar
  • 1
-1 votes
1 answer
457 views

Understanding Keras Tuner

I am trying to understand the use of Keras tuner in obtaining optimal value of hyperparameters for a simple MLP model. The code that I am using is as follows: def build_model2(hp): model = tf....
A. Gehani's user avatar
2 votes
0 answers
725 views

keras_tuner.RandomSearch. ValueError: Received incompatible tensor with shape (352,) when attempting to restore variable with shape (64,)

I am trying to build an autoencoder using HyperModel to later perform hyperparameter tuning using RandomSearch. After training the autoencoder with my data (2 matrices of shape(600, 411001) where each ...
Lucía Santadino's user avatar
1 vote
0 answers
187 views

KeyError(f"{name} does not exist.") while using keras tuner

I am using the Keras Tuner for optimizing a CNN. I am able to get the optimal values for the filter and kernel size. But when I try to do the same for the pool size it gives me an error: File "C:\...
A. Gehani's user avatar
1 vote
0 answers
296 views

keras tuner difference between max_epochs in hyperband(() and epochs in search()

I am using this in my code: stop_early = tf.keras.callbacks.EarlyStopping(monitor='loss', patience=3) tuner = kt.Hyperband( model_builder, objective='val_loss', max_epochs=100, factor=2, ...
Robbe Van Renne's user avatar
1 vote
2 answers
3k views

Integrate batch size in keras tuner

I am new to Keras and have been using KerasTuner for the hyperparameters. This works very well, but I have not yet managed to tune the batch size. There is an official way from Keras, which was ...
AndyEverything's user avatar
1 vote
0 answers
389 views

How to run Keras-tuner with on multiple CPU cores/threads

I have the sample code and want to run the net evaluation in parallel. I have a Desktop with four cores and it can run two threads per core, so I want to have 8 parameter settings running in parallel. ...
martin's user avatar
  • 11
0 votes
1 answer
164 views

Tensorsflow keras tuner will run once but not again

my code will run only one time after that it will only display how many images found in each flow from directory. It run the tuner once and then won't run it again, maybe it thinks I have already ran ...
benjam's user avatar
  • 1
1 vote
1 answer
212 views

Cannot Restore Checkpoint without Error Keras Tuner

I'm using Keras Tuner to hyper parameterize my CNN to process EMG data. The code is being run on 4 nvidia gpus and 5 cpus with TensorFlow's mirrored strategy. When I run the tuner, it's able to run ...
Bykaugan's user avatar
0 votes
1 answer
2k views

Using keras tuner for hyperparameter tuning and extracting trial statistics with Tensorboard workaround

I'm using keras tuner for hyperparameter tuning my sequential neural network in keras. My aim is to let keras tuner do a lot of trials and then save all statistics - loss, hyperparameters, trial ...
Tobitobitobi's user avatar
0 votes
1 answer
650 views

KeyError: {objective} in Keras Tuner regression search

I am trying to use Keras Tuner to do hyperparameter tuning on a regression ANN. When I do a hyperparameter search, I receive KeyError: 'val_mean_absolute_error. Here is my code: def build_model(hp): ...
Tim's user avatar
  • 1
-1 votes
1 answer
292 views

Get Second/Third Best Hyperparameters for comparison (keras tuner)

i want to ask about keras tuner method. I know that get_best_hyperparameters() return the value of the best hyperparameters. How about a method to return the second/third/etc best hyperparameters. Is ...
heyhofriend's user avatar
0 votes
1 answer
371 views

Keras Tuner how to do basic grid search

Keras Tuner offers several tuning strategies in the form of tuner classes. I fail to find an implementation for the most basic tuning strategy, which is a grid search. Did I oversee it? If not, is ...
Viktor's user avatar
  • 611
0 votes
1 answer
218 views

Keras Tuner on autoencoder - Add condition : first hidden layer units greater than or equal next hidden layer units

I want to use Keras-tuner to tune an autoencoder hyperparameters. It is a symetric AE with two layers. I want the number of units in the first layer always greater than or equal the units in the ...
Larel5000's user avatar
1 vote
1 answer
135 views

How can I extract all arguments I am passing to a TensorFlow function?

It is difficult to retrain my models in new data because I never remember my initial optimizer, loss function, and hyperparameters. How can I extract all arguments I am passing to a TensorFlow ...
deijany91's user avatar
0 votes
1 answer
129 views

Simple Tensor Flow Example with keras_tuner

I am new to Tensorflow and keras_tuner. I am working with PyCharm, Anaconda3, Python 3.9.12. Below you can find a minimal working example. The code trains in the first part a simple reference ANN with ...
Zeit's user avatar
  • 47
3 votes
1 answer
856 views

Save keras-tuner results as pandas Dataframe

Is there a possibility of saving the results of keras-tuner as Dataframe? All I can find are printing functions like result_summary(), but I cannot access the printed content. The example below both ...
Enes's user avatar
  • 43
1 vote
1 answer
535 views

Expected the return value of HyperModel.fit() to be a single float when `objective` is left unspecified

I am training my LSTM model using keras tuner. I am getting an error Expected the return value of HyperModel.fit() to be a single float when objective is left unspecified. Recevied return value: <...
Sanchit Jain's user avatar
1 vote
1 answer
216 views

Keras Tuner returning an empty list when calling get_best_hyperparameters() and get_best_models(num_models=1)?

I am trying to use Keras Tuner to tune hyperparameters but I am running into trouble. After I run tuner.search() with well-formed inputs and the search successfully runs, tuner....
Anonymous's user avatar
  • 152
0 votes
1 answer
692 views

Kerastuner search doesn't get restarted even with Overwrite flag set to true

Tuning is done as follows: tuner = kt.RandomSearch( MyHyperModel(), objective="mae", max_trials=30, overwrite=True, directory=results_dir, project_name="...
Caterina's user avatar
  • 1,097
0 votes
1 answer
668 views

Keras_tuner TypeError('Inputs to a layer should be tensors... )

I was able to finally get the below code, up to the keras_tuner, I mention this as I'm not exactly sure I'm even working out the class structure correctly. I'm doing all of this so as to try put in my ...
Relative0's user avatar
  • 1,827
0 votes
0 answers
173 views

Model is stuck at 0.51-0.52 accuracy and not improving

This is for a kaggle competition wherein I have essays which I have to grade/predict on 6 parameters (vocabulary, cohesion, conventions, grammar, phraseology, syntax). I have implemented RandomSearch ...
Chris Elroy Lewis's user avatar
0 votes
1 answer
1k views

how do you see the results for each trial execution using keras tuner?

I am trying to use keras tuner hyperband to select hyperparameters for my autoencoder model. Here's some pseudo code: class AEHyperModel(kt.HyperModel): def __init_(self, input_shape): self....
YoungResearcher's user avatar
0 votes
0 answers
221 views

Neural network written with keras outputs only 0

my neural network written in keras, for the problem of binary image classification, after selecting hyperparameters using the keras tuner, produces only zeros. import keras_tuner from kerastuner ...
Eduard Ganzha's user avatar
1 vote
0 answers
534 views

What is the correct way to define conditional hyperparameters in Keras Tuner

I want to create autoencoder and optimize its hyperparameters using Keras Tuner. I want it to contain from 1 to 3 layers in encoder part and each layer to contain less neurons than the previous layer (...
xdrm's user avatar
  • 11
1 vote
1 answer
738 views

Keras Tuner hyperband epoch

I am running Keras Tuner(Hyperband) since Random search does not find optimal solution, I would like to know how we can control the number of models and epochs to run. In Randomsearch we can clearly ...
Jegatheesan's user avatar
0 votes
1 answer
252 views

Keras Hyper tuning - Final model state

I am new to Deep learning and would like to understand on the below points. Can you please help. If I give number of epochs as 100 to train and try to evaluate the model, does it take the best epoch ...
Jegatheesan's user avatar
1 vote
1 answer
173 views

KerasTuneR only printing output of first trial

The fit_tuner function in KerasTuneR, when used in Rstudio, only prints its progress for the first trial. The simplified code below library(tidyverse) library(tensorflow) library(keras) library(...
Mas's user avatar
  • 361
2 votes
1 answer
1k views

Keras Tuner: select number of units conditional on number of layers

I am using Keras Tuner to tune the hyperparameters of my neural network. I want to search the optimal number of hidden layers and the optimal number of units in each layer. To avoid overparametrizing ...
NC520's user avatar
  • 407
5 votes
1 answer
2k views

How to interperet the 'num_layers' line when using Keras Tuner

I'm reading an article about tuning hyperparameters in keras tuner. It includes code to build a model that has this code: def build_model(hp): """ Builds model and sets up ...
Yoseph Ismail's user avatar
2 votes
1 answer
375 views

Hyperparameters tuning with keras tuner for classification problem

I an trying implement both classification problem and the regression problem with Keras tuner. here is my code for the regression problem: def build_model(hp): model = keras.Sequential() ...
Rezuana Haque's user avatar
0 votes
0 answers
48 views

Parameter adjustment using kerastuneR packet deep neural network

What is the cause of the following code error? library(magrittr) x_data <- matrix(data = runif(500,0,1),nrow = 50,ncol = 5) y_data <- ifelse(runif(50,0,1) > 0.6, 1L,0L) %>% as.matrix() ...
TUSTLGC's user avatar
  • 117