Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

i'm trying to build a feedforward neural network here I'm trying to split the data and I keep getting this error I tried using data

i'm trying to build a feedforward neural network here I'm trying to split the data and I keep getting this error I tried using data values and converted the DF to numpy but I still get the same error how do I solve it PS it's not necessary to use the helper thats whT the prof said
image text in transcribed
\# Read the data. filename = os.path.join(path, "iris.csv") df= pd.read_csv(filename, na_values =[NA,,?]) \# df= pd.read_csv(filename, nade text values to indexes (i.e., [1],[2],[3] for (red,green, blue) values). species = helper. encode_text_index(df, "species") \#Convert a Pandas Dataframe to the (x,y) inputs that Tensorflow needs. x,y= helper.to_xy(df, "species") \#Split the data into training and testing sets. x_train, x_test, y_train, y_test = train_test_split (x,y, test_size =0.2, random_state =42) AttributeError 9 (T) 9 in 10 \#Convert a Pandas Dataframe to the (x,y) inputs that Tensorflow needs. 11x,y= helper,to_xy(df, "species") 12 \#Split the data into training and testing sets. 30 \# Classification dummies = pd.get_dummies (df[ target ]) return df.as_matrix(result), astype(np.float32), dunmies.as_matrix().astype(r else: \# Regression \( \begin{array}{l} 5485 \text { ): } \\ 5486 \text { return self[name] } \\ 5487 \\ 5488 \text { return object._getattribute__(self, name) } \\ 5489\end{array} \quad \) def _ setattr__(self, name: str, value) None: AttributeError: '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 with AI-Powered 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

Students also viewed these Databases questions