Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do the following steps: Create testBrnli by 0 - 1 encoding testy variable Transform testX into pandas data frame by with encoded values of all

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 testX.
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.
est
# your code here
from sklearn.preprocessing import LabelEncoder, OrdinalEncoder
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]

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

Database Development For Dummies

Authors: Allen G. Taylor

1st Edition

978-0764507526

More Books

Students also viewed these Databases questions