Challenge: One-Class SVM for Novelty Detection
Tâche
Swipe to start coding
You are given a 2D dataset of normal points and a few anomalies. Your task is to train a One-Class SVM model to detect novelties, visualize prediction results, and print anomaly proportions.
Follow these steps:
- Import and initialize
OneClassSVMfromsklearn.svm.- Use
kernel='rbf',gamma=0.1,nu=0.05.
- Use
- Fit the model on normal data only (
X_train). - Predict labels for test data (
X_test).- Label meaning:
1→ normal,-1→ novel/anomalous.
- Label meaning:
- Compute the fraction of anomalies in
X_test. - Print:
- Shapes of train/test sets.
- Number and fraction of anomalies detected.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 5. Chapitre 3
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
Awesome!
Completion rate improved to 4.55
Challenge: One-Class SVM for Novelty Detection
Glissez pour afficher le menu
Tâche
Swipe to start coding
You are given a 2D dataset of normal points and a few anomalies. Your task is to train a One-Class SVM model to detect novelties, visualize prediction results, and print anomaly proportions.
Follow these steps:
- Import and initialize
OneClassSVMfromsklearn.svm.- Use
kernel='rbf',gamma=0.1,nu=0.05.
- Use
- Fit the model on normal data only (
X_train). - Predict labels for test data (
X_test).- Label meaning:
1→ normal,-1→ novel/anomalous.
- Label meaning:
- Compute the fraction of anomalies in
X_test. - Print:
- Shapes of train/test sets.
- Number and fraction of anomalies detected.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 5. Chapitre 3
single