Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to fix the error caused by .as_matrix in google colab, as this doesn't work anymore. I have tried using .value and .Numpy and get

How to fix the error caused by .as_matrix in google colab, as this doesn't work anymore. I have tried using .value and .Numpy and get an error converting numpy to tf

student submitted image, transcription available below 

from keras.optimizers import SGD # Stochastic Logistic Regression model = Sequential() # Model model.add(Dense(units=4, input_shape=[_train.shape[1]], activation='relu', kernel_regularizer=12 (0.001))) model.add(Dense (units=2, activation='relu', kernel_regularizer=12(0.001))) model.add(Dense(units=1,| Compile model activation='sigmoid', kernel_regularizer=12 (0.001))) sgd = SGD (learning_rate=0.1) model.compile(loss='binary_crossentropy', optimizer=sgd) Os # Fit the model history = model.fit (_train.as matrix( ), y_train.as_matrix().reshape(-1,1), batch_size = 256, epochs = 15, verbose=2, validation_data= (X_test.as_matrix(),y_test.as_matrix().reshape(-1,1))) [] 0 AttributeError Traceback (most recent call last) in () 1 # Fit the model -> 2 history = model.fit(X_train.as_matrix(), y_train.as_matrix().reshape(-1,1), batch_size = 256, 15, verbose=2, validation_data=(X_test.as_matrix(),y_test.as_matrix().reshape(-1,1))) 3 epochs = /usr/local/lib/python3.10/dist-packages/pandas/core/generic.py in _ getattr _ (self, name) 5900 5901 ): -> 5902 5903 5904 def AttributeError: return self [name] return object. _ _getattribute (self, name) setattr (self, name: str, value) -> None: 'DataFrame' object has no attribute 'as_matrix'

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Human Resource Management

Authors: David A DeCenzo, Stephen P Robbins, Susan L Verhulst

12th Edition

1119032741, 9781119032748

More Books

Students also viewed these Programming questions

Question

Is there something else less expensive that would be just as good?

Answered: 1 week ago

Question

Which model would you choose? Explain your answer.

Answered: 1 week ago