Challenge: Unsupervised Metrics
Uppgift
Swipe to start coding
You will perform a full unsupervised model evaluation pipeline, consisting of anomaly detection, dimensionality reduction, and clustering.
Perform the following steps:
1. Anomaly Detection Evaluation
- Use the
make_classificationdataset from scikit-learn with strong class imbalance (weights=[0.95, 0.05]). - Train an IsolationForest model to detect anomalies.
- Compute:
- Precision.
- Recall.
- ROC–AUC.
2. Dimensionality Reduction Evaluation
- Apply PCA to the dataset (2 components).
- Compute:
- Explained Variance Ratio.
- Reconstruction Error between original and inverse-transformed data.
3. Clustering Evaluation
- Apply KMeans with
n_clusters=3on the PCA-reduced data. - Compute:
- Inertia.
- Silhouette Score.
- Davies–Bouldin Score.
- Calinski–Harabasz Score.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 3. Kapitel 5
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Awesome!
Completion rate improved to 6.25
Challenge: Unsupervised Metrics
Svep för att visa menyn
Uppgift
Swipe to start coding
You will perform a full unsupervised model evaluation pipeline, consisting of anomaly detection, dimensionality reduction, and clustering.
Perform the following steps:
1. Anomaly Detection Evaluation
- Use the
make_classificationdataset from scikit-learn with strong class imbalance (weights=[0.95, 0.05]). - Train an IsolationForest model to detect anomalies.
- Compute:
- Precision.
- Recall.
- ROC–AUC.
2. Dimensionality Reduction Evaluation
- Apply PCA to the dataset (2 components).
- Compute:
- Explained Variance Ratio.
- Reconstruction Error between original and inverse-transformed data.
3. Clustering Evaluation
- Apply KMeans with
n_clusters=3on the PCA-reduced data. - Compute:
- Inertia.
- Silhouette Score.
- Davies–Bouldin Score.
- Calinski–Harabasz Score.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 3. Kapitel 5
single