Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

STandardScaler use example

from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
scaled_data = scaler.fit_transform(data)
Comment

standardscaler in machine learning

# example of a standardization
from numpy import asarray
from sklearn.preprocessing import StandardScaler
# define data
data = asarray([[100, 0.001],
				[8, 0.05],
				[50, 0.005],
				[88, 0.07],
				[4, 0.1]])
print(data)
# define standard scaler
scaler = StandardScaler()
# transform data
scaled = scaler.fit_transform(data)
print(scaled)
Comment

sklearn standardscaler

from sklearn.preprocessing import StandardScaler
data = [[0, 0], [0, 0], [1, 1], [1, 1]]
scaler = StandardScaler()
print(scaler.mean_)
>>>[0.5 0.5]
print(scaler.transform(data))
>>>[[-1. -1.]
   [-1. -1.]
   [ 1.  1.]
   [ 1.  1.]]
Comment

standardscaler

# Preprocessing allows us to standarsize our data
from sklearn import preprocessing
# define standard scaler
scaler = StandardScaler()
# transform data
scaled = scaler.fit_transform(data)
Comment

PREVIOUS NEXT
Code Example
Python :: how to make text to speech in python 
Python :: try python 
Python :: inser elemts into a set in python 
Python :: matplotlib histogram python 
Python :: docker build python fastapi 
Python :: pandas groupby and show specific column 
Python :: concatenate string and int python 
Python :: beautifulsoup import 
Python :: list in list python 
Python :: distance of a point from a line python 
Python :: hungry chef 
Python :: ram clear in python 
Python :: django cleanup settings 
Python :: change key of dictionary python 
Python :: python dictionary sort by value then alphabetically 
Python :: User serializer in django rest framework 
Python :: get url param in get django rest 
Python :: Delete python text after 1 sec 
Python :: regex_2/_regex.c:50:10: fatal error: Python.h: No such file or directory 
Python :: transpose matrix in python without numpy 
Python :: python cast to float 
Python :: numpy generate sequence 
Python :: iterate a list of tuples 
Python :: histogram seaborn python 
Python :: get file parent directory python 
Python :: python check array exists 
Python :: python try else 
Python :: if string in list python 
Python :: colon in array python 
Python :: Got AttributeError when attempting to get a value for field `name` on serializer 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =