i use this model
model = Sequential([
Dense(units=10, input_shape=(1,), activation='relu'),
Dense(units=32, activation='relu'),
Dense(units=10, activation='softmax')
])
model.compile(optimizer=Adam(learning_rate=0.0001), loss='sparse_categorical_crossentropy', metrics=['accuracy'])
model.fit(x_train, y_train, batch_size=10, epochs=30)
but model.fit always return this error
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float).
however i converted my data as following
x_train = np.array(x_train)
y_train = np.array(y_train)
x_test= np.array(x_test)
y_test = np.array(y_test)
y_train, x_train = shuffle(y_train, x_train)
y_test, x_test = shuffle(y_test, x_test)
this is my model summary
and this is the shape of my data x_train as 1D of array for each input sample, and y_train is a label for each sample and values from (1 to 10).
can any one helps me Regards in advance !
and i define my data as following
from google.colab import files
uploaded = files.upload()
import io
dset = pd.read_csv(io.BytesIO(uploaded['1-210.csv']))
y= dset.Readername
x=dset.drop('Readername',axis=1)
x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=0.2)