# Load libraries
from sklearn import preprocessing
import numpy as np

"""
Explanation: Title: Rescale A Feature
Slug: rescale_a_feature
Summary: How to rescale a feature for machine learning in Python. 
Date: 2016-09-06 12:00
Category: Machine Learning
Tags: Preprocessing Structured Data
Authors: Chris Albon
<a alt="MinMax Scaling" href="https://machinelearningflashcards.com">
    <img src="rescale_a_feature/MinMax_Scaling_print.png" class="flashcard center-block">
</a>
Preliminaries
End of explanation
"""


# Create feature
x = np.array([[-500.5], 
              [-100.1], 
              [0], 
              [100.1], 
              [900.9]])

"""
Explanation: Create Feature
End of explanation
"""


# Create scaler
minmax_scale = preprocessing.MinMaxScaler(feature_range=(0, 1))

# Scale feature
x_scale = minmax_scale.fit_transform(x)

# Show feature
x_scale

"""
Explanation: Rescale Feature Using Min-Max
End of explanation
"""


