Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: L2 Normalization and Norm Comparison | Normalization Techniques
Feature Scaling and Normalization Deep Dive

bookChallenge: L2 Normalization and Norm Comparison

Завдання

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.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 4
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Suggested prompts:

Can you explain this in simpler terms?

What are the next steps I should take?

Can you provide an example?

close

Awesome!

Completion rate improved to 5.26

bookChallenge: L2 Normalization and Norm Comparison

Свайпніть щоб показати меню

Завдання

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.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 4
single

single

some-alt