Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: L2 Normalization and Norm Comparison | Normalization Techniques
Feature Scaling and Normalization Deep Dive

bookChallenge: L2 Normalization and Norm Comparison

Tarefa

Swipe to start coding

You are given a NumPy array X of shape (n_samples, n_features). Your goal is to L2-normalize each row (sample) and compare norms before and after normalization using np.linalg.norm.

  1. Compute row-wise L2 norms as a column vector row_norms with shape (n_samples, 1) using np.linalg.norm(..., axis=1, keepdims=True).
  2. Create X_l2 by dividing each row of X by its L2 norm via broadcasting.
  3. Compute norms_before and norms_after as 1D arrays (shape (n_samples,)) with np.linalg.norm(..., axis=1).
  4. Assume there are no zero rows in X. Do not modify X in place. Use vectorized NumPy operations.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 4
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

close

Awesome!

Completion rate improved to 5.26

bookChallenge: L2 Normalization and Norm Comparison

Deslize para mostrar o menu

Tarefa

Swipe to start coding

You are given a NumPy array X of shape (n_samples, n_features). Your goal is to L2-normalize each row (sample) and compare norms before and after normalization using np.linalg.norm.

  1. Compute row-wise L2 norms as a column vector row_norms with shape (n_samples, 1) using np.linalg.norm(..., axis=1, keepdims=True).
  2. Create X_l2 by dividing each row of X by its L2 norm via broadcasting.
  3. Compute norms_before and norms_after as 1D arrays (shape (n_samples,)) with np.linalg.norm(..., axis=1).
  4. Assume there are no zero rows in X. Do not modify X in place. Use vectorized NumPy operations.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 4
single

single

some-alt