Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Зниження рівня шуму | Аналіз результатів
Метод Головних Компонент
course content

Зміст курсу

Метод Головних Компонент

Метод Головних Компонент

1. Що таке аналіз головних компонент
2. Основні поняття РСА
3. Побудова моделі
4. Аналіз результатів

book
Зниження рівня шуму

Let's look at the way PCA works, when the algorithm does not act as a data processing stage, but as the main stage. The task of noise reduction in images is just that case. The pipeline in this case looks like this: we load the noisy data into the model, after which we can process other data using PCA and the model will restore that data. How it works? By reducing the number of main components - literally only the most important elements of the image remain, i.e. noise will be reduced. We use the USPS dataset with numbers and the scikit-learn library:

import numpy as np
from sklearn.datasets import fetch_openml
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split

X, y = fetch_openml(data_id = 41082, as_frame = False, return_X_y = True)
X = MinMaxScaler().fit_transform(X)

Let's add some noise to our images:

X_train, X_test, y_train, y_test = train_test_split(
    X, y, stratify = y, random_state = 0, train_size = 1_000, test_size = 100
)

rng = np.random.RandomState(0)
noise = rng.normal(scale = 0.25, size = X_test.shape)
X_test_noisy = X_test + noise

noise = rng.normal(scale = 0.25, size = X_train.shape)
X_train_noisy = X_train + noise 

Create a PCA model:

from sklearn.decomposition import PCA

pca_model = PCA(n_components=40)
pca_model.fit(X_train_noisy)

Let's see what came of it! Initial noisy images:

And here is the result of PCA work:

question mark

Is the PCA method designed to reduce noise in the data?

Select the correct answer

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

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

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

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

Запитати АІ

expand

Запитати АІ

ChatGPT

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

course content

Зміст курсу

Метод Головних Компонент

Метод Головних Компонент

1. Що таке аналіз головних компонент
2. Основні поняття РСА
3. Побудова моделі
4. Аналіз результатів

book
Зниження рівня шуму

Let's look at the way PCA works, when the algorithm does not act as a data processing stage, but as the main stage. The task of noise reduction in images is just that case. The pipeline in this case looks like this: we load the noisy data into the model, after which we can process other data using PCA and the model will restore that data. How it works? By reducing the number of main components - literally only the most important elements of the image remain, i.e. noise will be reduced. We use the USPS dataset with numbers and the scikit-learn library:

import numpy as np
from sklearn.datasets import fetch_openml
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split

X, y = fetch_openml(data_id = 41082, as_frame = False, return_X_y = True)
X = MinMaxScaler().fit_transform(X)

Let's add some noise to our images:

X_train, X_test, y_train, y_test = train_test_split(
    X, y, stratify = y, random_state = 0, train_size = 1_000, test_size = 100
)

rng = np.random.RandomState(0)
noise = rng.normal(scale = 0.25, size = X_test.shape)
X_test_noisy = X_test + noise

noise = rng.normal(scale = 0.25, size = X_train.shape)
X_train_noisy = X_train + noise 

Create a PCA model:

from sklearn.decomposition import PCA

pca_model = PCA(n_components=40)
pca_model.fit(X_train_noisy)

Let's see what came of it! Initial noisy images:

And here is the result of PCA work:

question mark

Is the PCA method designed to reduce noise in the data?

Select the correct answer

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

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

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

Секція 4. Розділ 4
some-alt