Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help correct errors! Now, it's your turn to repeat some parts of the procedure above, but for the test data, which is the right

Please help correct errors!
Now, it's your turn to repeat some parts of the procedure above, but for the test data, which is the right way.
Do the following steps:
Create testBrnli by 0-1 encoding testy variable
Transform testX into pandas data frame by with encoded values of all the features. The transformed data frame should still be called
Create vector (i.e. numpy arrray) of predictions, called yhattest, based on the feature values from the test data.
If everything is fine, first couple of values of yhattest should be 1,0,0,1,1,0,0,1,0.
H
# your code here
from sklearn.preprocessing import LabelEncoder, OrdinalEncoder
from sklearn.naive_bayes import CategoricalNB
enc = OrdinalEncoder()
le = Labelencoder()
testBrnli = le.fit_transform(testy)
testX = pd.DataFrame(testX, columns=colnames)
model = CategoricalNB()
model.fit(testX, testBrnli)
yhattest = model.predict(testX)
yhattest[:9]
image text in transcribed

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

What is a stock market index?

Answered: 1 week ago