Challenge: Evaluating the Perceptron
To evaluate the previously created perceptron, you will use a dataset containing two input features and two distinct classes (0
and 1
):
This dataset is balanced, with 500 samples from class 1
and 500 samples from class 0
. Therefore, accuracy is a sufficient metric for evaluation in this case, which can be calculated using the accuracy_score()
function:
accuracy_score(y_true, y_pred)
y_true
represents the actual labels, while y_pred
represents the predicted labels.
The dataset is stored in perceptron.py
as two NumPy arrays: X
(input features) and y
(corresponding labels), so they will be simply imported. This file also contains model
, which is the instance of the Perceptron
class you previously created.
Swipe to start coding
Obtain predictions from the trained model and evaluate its performance:
- Split the dataset into training (80%) and testing (20%) sets.
- Train the model for 10 epochs with a learning rate of
0.01
. - Obtain predictions for all examples in the test set.
- Calculate the accuracy by comparing the predicted labels with the actual test labels.
Solution
Merci pour vos commentaires !
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Résumer ce chapitre
Expliquer le code dans file
Expliquer pourquoi file ne résout pas la tâche
Awesome!
Completion rate improved to 4
Challenge: Evaluating the Perceptron
Glissez pour afficher le menu
To evaluate the previously created perceptron, you will use a dataset containing two input features and two distinct classes (0
and 1
):
This dataset is balanced, with 500 samples from class 1
and 500 samples from class 0
. Therefore, accuracy is a sufficient metric for evaluation in this case, which can be calculated using the accuracy_score()
function:
accuracy_score(y_true, y_pred)
y_true
represents the actual labels, while y_pred
represents the predicted labels.
The dataset is stored in perceptron.py
as two NumPy arrays: X
(input features) and y
(corresponding labels), so they will be simply imported. This file also contains model
, which is the instance of the Perceptron
class you previously created.
Swipe to start coding
Obtain predictions from the trained model and evaluate its performance:
- Split the dataset into training (80%) and testing (20%) sets.
- Train the model for 10 epochs with a learning rate of
0.01
. - Obtain predictions for all examples in the test set.
- Calculate the accuracy by comparing the predicted labels with the actual test labels.
Solution
Merci pour vos commentaires !
Awesome!
Completion rate improved to 4single