I have made input data for machine learning as csv file . The data are 2D arrays input and label Example
[[55:32:1:23:41:243:255:11:182:192:231:201],"play"]
[[23:222:225],"talk"]
[[23:132:215:111:29:192],"talk"]
[55:32:1:23:41:243:255:11:182:192:231:201] | play |
[23:222:225] | talk |
I tried to train using the follwing code
import tensorflow as tf
import numpy as np
np.set_printoptions(precision=3, suppress=True)
import pandas as pd
from tensorflow.keras import layers
from tensorflow.keras.layers.experimental import preprocessing
import io
data = pd.read_csv('./newTest4.csv', header=None)
data_features=data.copy()
data_labels=data_features.pop(0)
data_features=np.array(data_features)
data_labels=np.array(data_labels)
data_labels
data_model=tf.keras.Sequential ([
layers.Dense(64),
layers.Dense(1)
])
data_model.compile(loss=tf.losses.MeanSquaredError(),optimizer=tf.optimizers.Adam())
data_model.fit(data_features,data_labels,epochs=100)
But the output was
UnimplementedError: Cast string to float is not supported
[[node mean_squared_error/Cast (defined at <ipython-input-18-ce25e735eaa4>:1) ]] [Op:__inference_train_function_1561]
Function call stack:
train_function
strings
as inputs toML
orDL
models, you have to encode the strings into vectors of numbers using different techniques available and then use them as inputs to your model.