srijeda, 24. srpnja 2024.

MinMaxScaler

MinMaxScaler

MinMaxScaler

Here you can upload your dataset by clicking on the Choose file button. By clicking on this button the pop-up "Open" window will appear and you will have to locate the dataset on your computer. After finding the dataset click on the Open window and all the dataset variables will be automatically scaled using MinMaxScaler. This scaler will scaler each dataset variable to 0-1 range. The detailed description of the MinMaxScaler is given below.
Step one: Select a .csv format file.
0%
Step two: Download the file after the process is completed.

What is MinMaxScaler?

MinMaxScaler is the feature (variable) scaling technique which is popular in Machine Learning mostly in scikit-learn library in Python. This scaler transform each feature (variable) by scaling each feature to a given range. So far this scaler can scale to 0-1 range only.

How it works ?

The scaler works by subtracting the minimum value of each feature and then dividing it by the range (maximum value-minimum value) of the feature. The formula for scaling each feature (variable) value can be written as: \begin{equation} x_s = \frac{x-x_{min}}{x_{max} - x_{min}} \end{equation} where:
  • \(x\) is the original feature (variable) value,
  • \(x_{min}\) - is the minimum value of the feature (variable), and
  • \(x_{max}\) - is the maximum value of the feature (variable).

Example of MinMaxScaler

Let's say we have a following array of values: \begin{equation} x = [2,4,6,8,10] \end{equation} The following steps are necessary to scale this array to 0-1 range:
  • Find the minimum value
  • Find the maximum value
  • Apply the min-max scaling formula
  • Calculate scale values

Find the minimum value

The minimum value of the array is 2. \begin{equation} x_{min} = \min([2,4,6,8,10]) = 2 \end{equation}

Find the maximum value

The maximum value of the array is 10. \begin{equation} x_{max} = \max([2,4,6,8,10]) = 10 \end{equation}

Apply the min-max scaling formula

The formula for scaling each value of the array to the range [0,1] can be written as: \begin{equation} x_s = \frac{x-x_{min}}{x_{max} - x_{min}} \end{equation}

Calculate scaled values

  • For \(x_0 = 2\) \begin{equation} x_{s0} = \frac{x_0-x_{min}}{x_{max} - x_{min}} = \frac{2-2}{10-2} = \frac{0}{8} = 0 \end{equation}
  • For \(x_1 = 4\) \begin{equation} x_{s1} = \frac{x_1-x_{min}}{x_{max} - x_{min}} = \frac{4-2}{10-2} = \frac{2}{8} = 0.25 \end{equation}
  • For \(x_2 = 6\) \begin{equation} x_{s2} = \frac{x_2-x_{min}}{x_{max} - x_{min}} = \frac{6-2}{10-2} = \frac{4}{8} = 0.5 \end{equation}
  • For \(x_3 = 8\) \begin{equation} x_{s3} = \frac{x_3-x_{min}}{x_{max} - x_{min}} = \frac{8-2}{10-2} = \frac{6}{8} = 0.75 \end{equation}
  • For \(x_4 = 2\) \begin{equation} x_{s4} = \frac{x_4-x_{min}}{x_{max} - x_{min}} = \frac{10-2}{10-2} = \frac{8}{8} = 1. \end{equation}
  • After scaling the original array [2,4,6,8,10] becomes: \begin{equation} x_s = [0,0.25,0.5,0.75,1] \end{equation}

What are the benefits of utilizing the MinMaxScaler?

The Scaler ensures that all the dataset features (variables) are on the same scale, which is crucial for many machine learning algorithms that are sensitive to the scales of the input features, such as k-nearest neighbors or artificial neural networks.
By scaling features to a fixed range, it can help mitigate the effect of outliers to some extent, although outliers can still influence the scaling. MinMaxScaler is a simple yet effective tool for feature scaling, especially useful when the assumptions of certain machine learning algorithms about the data distribution need to be met.

Nema komentara:

Objavi komentar

CSV to SQL Converter

CSV to SQL Converter Step 1: Choose CSV File ...