0

is kerastuner and Batchdataset is compatible ? Hi All I am trying to add batch dataset combine kerastuner bayesianoptimization and tensorflow ?

X is <BatchDataset shapes: ({Sales: (None,), Quantity: (None,), Discount: (None,), Profit: (None,)}, (None,)), types: ({Sales: tf.float64, Quantity: tf.int64, Discount: tf.float64, Profit: tf.float64}, tf.int32)>

Y is <BatchDataset shapes: (None,), types: tf.int32> Tensors are batch size is 32 . While passing into tuner.search() I am receiving error

y argument is not supported when using dataset as input.

Value of Y : tf.Tensor([1 3 3 3 3 3 3 3 3 1 1 3 3 3 3 3 2 2 3 3 1 3 3 3 3 0 1 3 1 0 3 1], shape=(32,), dtype=int32) tf.Tensor([3 1 3 3 3 3 3 1 1 3 3 0 3 1 0 3 3 1 0 2 1 3 3 1 1 0 3 3 3 3 3 1], shape=(32,), dtype=int32) tf.Tensor([3 3 0 1 3 3 3 1 3 0 3 3 3 1 3 3 3 3 0 3 1 3 3 0 3 3 3 3 1 3 0 3], shape=(32,), dtype=int32) tf.Tensor([1 3 1 0 3 3 3 3 3 1 3 3 3 1 3 3 1 3 3 3 3 3 3 3 3 3 3 0 1 3 3 3], shape=(32,), dtype=int32) tf.Tensor([1 3 1 3 3 3 1 3 1 1 3 1 1 1 3 3 1 3 0 3 3 1 1 3 0 1 3 3 1 3 3 3], shape=(32,), dtype=int32)

Actual Function

def df_to_training_dataset(dataframe, shuffle=True, batch_size=32):
    dataframe = dataframe.copy()
    labels = dataframe.pop(COLUMN_LABEL)
    dataset = tf.data.Dataset.from_tensor_slices((dict(dataframe), labels))

    dataset = dataset.batch(batch_size)
    labels = np.concatenate([y for x,y in dataset], axis=0)
    labels = tf.data.Dataset.from_tensor_slices(labels)
    labels = labels.batch(batch_size)
    return dataset,labels

Calling Function

training_batch_size = training_dataframe.shape[0] training_dataset,training_labels = df_to_training_dataset(training_dataframe, training_batch_size) validation_batch_size = validation_dataframe.shape[0] validation_dataset,validation_labels = df_to_training_dataset(validation_dataframe, validation_batch_size)

Error Function

tuner.search(x=training_dataset, y=training_labels,validation_data=(validation_dataset,validation_labels),epochs=2)

Getting Error

`y` argument is not supported when using dataset as input.
`y` argument is not supported when using dataset as input.

0 Answers0