Answered step by step
Verified Expert Solution
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 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 ie 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
H
# your code here
from sklearn.preprocessing import LabelEncoder, OrdinalEncoder
from sklearn.naivebayes import CategoricalNB
enc OrdinalEncoder
le Labelencoder
testBrnli lefittransformtesty
testX pdDataFrametestX columnscolnames
model CategoricalNB
model.fittestX testBrnli
yhattest model.predicttestX
yhattest:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started