ML EXPT 4
ML EXPT 4
OUTPUT
Shape of the feature matrix (X): (150, 4)
Shape of the target vector (y): (150,)
Target counts:
{0: 50, 1: 50, 2: 50}
OUTPUT
Training set size: (105, 4)
Testing set size: (45, 4)
# Accuracy score
accuracy = accuracy_score(y_test, y_pred)
print(f"\nAccuracy on test set: {accuracy:.2f}")
# Classification report
print("\nClassification Report:\n", classification_report(y_test, y_pred,
target_names=data.target_names))
# Confusion matrix
print("\nConfusion Matrix:\n", confusion_matrix(y_test, y_pred))
OUTPUT
Accuracy on test set: 1.00
Classification Report:
precision recall f1-score support
accuracy 1.00 45
macro avg 1.00 1.00 1.00 45
weighted avg 1.00 1.00 1.00 45