Challenge: Manual Feature Centering
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.
Solução
Obrigado pelo seu feedback!
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Awesome!
Completion rate improved to 5.26
Challenge: Manual Feature Centering
Deslize para mostrar o menu
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.
Solução
Obrigado pelo seu feedback!
single