Question: please help, there nothing worng in #TODO 5 , but There is something worng in #TODO 1 3 Complete the TODO by getting our data,
please help, there nothing worng in #TODO but There is something worng in #TODO
Complete the TODO by getting our data, training the PocketPerceptron class and making predictions for our training and validation data.
Call the dataprep function to get the setosavsall data where the sepal length and width features are dropped. To do so pass the
arguments corresponding to the following descriptions:
Pass the Iris dataset.
Set setosa as the positive class.
Set versicolor and virginica to represent the negative class.
Set the column 'class' to act as the labelstargets
Drop the 'sepal length' and 'sepal width' features.
Return all data as NumPy arrays.
Create an instance of the PocketPerceptron. Make sure to pass the arguments corresponding to the following descriptions:
Allow for training to occur for passes over the data.
TODO
data datapreploadiris 'setosa', versicolor 'virginica' 'class', sepal length', 'sepal width'
I data dataprepiris
posclass
negclass
labenane"class",
returnarrayTrue
a data dataprep
dfiris,
posclass "setosa',
negclass "versicolor",
labelname 'labels',
returnarrayTrue
a
xtrn ytrn Xvld yvld featurenames data
II TODO
perceptron PocketPerceptronnumpasses
perceptron.fitXtrn ytrn
yhattrn perceptron.predict
todocheck
npanpiscloseXtrnflattenXtrn values are incorrect"
npanpiscloseperceptronwbest, nparray rtol "best weight values potentialy incorrect"
KeyError
Traceback most recent call last
Siexthonineutcaba in #
TOOO
data repris "class", length", "sepa width"
a data replass 'setosa',
#lass 'virginica'
ame"class", rrayTrue
frames
lasseslass, lass
#
labels
KeyError: 'class'TODO
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
