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 5, but There is something worng in #TODO 13
Complete the TODO by getting our data, training the PocketPerceptron class and making predictions for our training and validation data.
Call the data_prep() function to get the setosa-vs-all 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 labels/targets.
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 10 passes over the data.
4 TODO 13.1
data = data_prep(load_iris(), 'setosa', ['versicolor', 'virginica'], 'class', ['sepal length', 'sepal width'])
I data = data_prep(iris ,
pos_class =[],
neg_class =[1,2],
labe1_nane="class",
return_array=True)
a data = data_prep(
df=iris,
pos_class= "setosa',
neg_class= "versicolor",
label_name= 'labels',
return_array=True
a)
x_trn, y_trn, X_vld, y_vld,.,.., feature_names = data
II TODO 13.2
perceptron = PocketPerceptron(num_passes=10)
perceptron.fit(X_trn, y_trn)
y_hat_trn = perceptron.predict (x?trn)
todo_check([
(np.a11(np.isclose(X_trn[4].flatten(),[1.,0.97932518,1.17336698])),"'X_trn' values are incorrect"),
])
(np.a11(np.isclose(perceptron.w_best, np.array([-0.1254,-0.12089,-0.2218), rtol=.1)), "best weight values potential1y incorrect")
KeyError
Traceback (most recent call last)
Siexthon-ineut-88-c8+2a75b8a48> in #,ipeython-input-79-e103df45c5eg21>2>()
1II TOOO 13.1
2 data =dataprep(1oadiris(),[1,2], "class", ['sepal length", "sepa1 width"])
a data =dataprep(iris,posclass = 'setosa',
#,negclass=["versicolor', 'virginica'],
illabelname="class", returnarray=True)
A1 frames
ipeython-input-79-e103df45c5eg21>inbinarizeclasses(irisdf,posclass, negclass)
# T0005.1
labels =irisdf['class']
4005.2
KeyError: 'class'TODO13
 please help, there nothing worng in #TODO 5, but There is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!