How to rescale features in Python?
DATA MUNGING DATA CLEANING PYTHON MACHINE LEARNING RECIPES PANDAS CHEATSHEET     ALL TAGS

How to rescale features in Python?

How to rescale features in Python?

This recipe helps you rescale features in Python

2
This python source code does the following: 1. Converts categorical into numerical types. 2. Loads the important libraries and Implements label binarizer. 3. Creates your own numpy feature matrix.
In [ ]:
## How to rescale features in Python 
def Kickstarter_Example_39():
    print()
    print(format('How to rescale features in Python', '*^82'))
    import warnings
    warnings.filterwarnings("ignore")

    # load libraries
    from sklearn import preprocessing
    import numpy as np

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

    # Rescale Feature Using Min-Max
    # Create scaler
    minmax_scale = preprocessing.MinMaxScaler(feature_range=(0, 1))

    # Scale feature
    x_scale = minmax_scale.fit_transform(x)

    # Show feature
    print(); print(x)
    print(); print(x_scale)

Kickstarter_Example_39()

Relevant Projects

Walmart Sales Forecasting Data Science Project
Data Science Project in R-Predict the sales for each department using historical markdown data from the Walmart dataset containing data of 45 Walmart stores.

Build an Image Classifier for Plant Species Identification
In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

Solving Multiple Classification use cases Using H2O
In this project, we are going to talk about H2O and functionality in terms of building Machine Learning models.

Customer Churn Prediction Analysis using Ensemble Techniques
In this machine learning churn project, we implement a churn prediction model in python using ensemble techniques.

Data Science Project - Instacart Market Basket Analysis
Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

Data Science Project on Wine Quality Prediction in R
In this R data science project, we will explore wine dataset to assess red wine quality. The objective of this data science project is to explore which chemical properties will influence the quality of red wines.

Identifying Product Bundles from Sales Data Using R Language
In this data science project in R, we are going to talk about subjective segmentation which is a clustering technique to find out product bundles in sales data.

Ecommerce product reviews - Pairwise ranking and sentiment analysis
This project analyzes a dataset containing ecommerce product reviews. The goal is to use machine learning models to perform sentiment analysis on product reviews and rank them based on relevance. Reviews play a key role in product recommendation systems.

PySpark Tutorial - Learn to use Apache Spark with Python
PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

Machine Learning project for Retail Price Optimization
In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.