Challenge: Manual Feature Centering
Tarea
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.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 1. Capítulo 4
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Awesome!
Completion rate improved to 5.26
Challenge: Manual Feature Centering
Desliza para mostrar el menú
Tarea
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.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 1. Capítulo 4
single