Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

im trying to build a feedforward NN using the iris dataset and for some reason ive been getting this error and I cannot train the

im trying to build a feedforward NN using the iris dataset and for some reason ive been getting this error and I cannot train the model please help asap
image text in transcribed
image text in transcribed
\[ \begin{array}{l} \text { In [2]: } \quad \mathbf{M} d f=p d \text {. read_csv("iris.csv") } \\ \text { In }[3]: \quad \mathrm{M} X=\mathrm{X} \text {. iloc[:, :-1]. values } \\ y=d f, i \operatorname{loc}[:,-1] \text {.values } \\ \end{array} \] In[4]:M#splittingthedatasetintotrainandtestdatasets \[ \text { X_train, } x_{\text {_test, }} \text {, } \text { _train, }_{\text {_test }} \text { = train_test_split }(x, y \text {, test_size=0.2, randon_sta } \] In [5]: M Feature Scaling scaler = MinMaxScaler() X train = scaler. fit_transform(X_train) X.test = scaler.transform(X_test) model = tf. keras. models. Sequential() In [7]: M A Adding the input Layer and the first hidden Layer model. add(tf.keras. layers. Dense(units =4, activation= 'relu', input_shape= (4)),)) In [9]: M "Adding the second hidden Layer model.add(tf.keras. layers. Dense(units=1, activation='relu'))) In [12]: M Adding the output Layer model.add(tf.keras. layers. Dense(units=1, activation=' softmax'))) In [13]: M FCompiting the model model. compile(optinizer=' adam', lossw" categorical_crossentropy', metrics=['accuracy']) In [14]: M "Training the model model.fit (x_train, y_train, epochs=se, batch_size=32) Epoch 1/50 UnimplementedError - \AppDatalLocaliTemplipykernel_137sel3979561441.py in racest recent call last) 1 \# Training the model 2 model.fit (x_train, y_train, epochsnse, batch_size=32) - \anaconda3lenus|tf\1iblsite-packageslkeraslutilsitraceback_utils.py in error_ handler("args 68 i To get the full stack trace, call: a) tf.debugging-disable_traceback_filtering() raise e.with_traceback(filtered_tb) from None finally: Node: 'categorical cast(y_true, y pred.dtype) Cast string to float is not supported [[\{\{node categorical_crossentropy/Cast\}\}]]] [0p:_inference_train_function_727

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions

Question

Differentiate 3sin(9x+2x)

Answered: 1 week ago

Question

Compute the derivative f(x)=(x-a)(x-b)

Answered: 1 week ago

Question

8. Describe how cultural spaces are formed.

Answered: 1 week ago