Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python MinMaxScaler()

from sklearn.preprocessing import MinMaxScaler

#Normal minmaxscaler function to standarise data.
data = [[-1, 2], [-0.5, 6], [0, 10], [1, 18]]
scaler = MinMaxScaler()
scaler.fit(data)    

#get data for Max and Min from scaler functions, 
#best to store it in a dictionary and use it later make data normal again
print(scaler.transform([[2, 2]]))
Out>>> [[ 1.5  0. ]]

# Inverse transform the the 0-1 dataframe.
print(scaler.inverse_transform([[ 1.5  0. ]]))
Out>>> [[ 2.0  2.0]]
Comment

minmaxscaler python

from numpy import asarray
from sklearn.preprocessing import MinMaxScaler
# define data
data = asarray([[100, 0.001],
				[8, 0.05],
				[50, 0.005],
				[88, 0.07],
				[4, 0.1]])
print(data)
# define min max scaler
scaler = MinMaxScaler()
# transform data
scaled = scaler.fit_transform(data)
print(scaled)
Comment

PREVIOUS NEXT
Code Example
Python :: beuatiful soup find a href 
Python :: list files in directory python with extension 
Python :: find rows not equal to nan pandas 
Python :: use selenium without opening browser 
Python :: shuffle dataframe python 
Python :: create a relu function in python 
Python :: openai gym conda 
Python :: sum number in a list python using recursion 
Python :: convert pdf to docx python 
Python :: python generate dates between two dates 
Python :: python numpy installation 
Python :: how to check datatype of column in dataframe python 
Python :: python datetime remove timezone 
Python :: pipenv freeze requirements.txt 
Python :: Generate random image np array 
Python :: how to wait in python 
Python :: join video moviepy 
Python :: import status in django rest framework 
Python :: HOw to use passlock password manager python 
Python :: open image from link python 
Python :: python pyodbc install 
Python :: np array n same values 
Python :: pygame change logo 
Python :: filter dataframe with list 
Python :: python find all pairs in list 
Python :: how to get pc name with python 
Python :: pandas series values into strings 
Python :: extract ints from strings in Pandas 
Python :: add sheet to existing workbook openpyxl 
Python :: unban discord.py 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =