Challenge: Manual Feature Centering
Compito
Swipe to start coding
You are given a small dataset X as a NumPy array of shape (n_samples, n_features). Your goal is to manually center each feature (column) by subtracting its mean, without using scikit-learn. Use vectorized NumPy operations.
- Compute the per-feature means as a 1D array
feature_meansof shape(n_features,). - Create
X_centered = X - feature_meansusing broadcasting. - Compute column means of
X_centeredto verify they are approximately zero. - Do not use loops and do not modify
Xin place.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 4
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
Awesome!
Completion rate improved to 5.26
Challenge: Manual Feature Centering
Scorri per mostrare il menu
Compito
Swipe to start coding
You are given a small dataset X as a NumPy array of shape (n_samples, n_features). Your goal is to manually center each feature (column) by subtracting its mean, without using scikit-learn. Use vectorized NumPy operations.
- Compute the per-feature means as a 1D array
feature_meansof shape(n_features,). - Create
X_centered = X - feature_meansusing broadcasting. - Compute column means of
X_centeredto verify they are approximately zero. - Do not use loops and do not modify
Xin place.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 4
single