sklearn-Standardized label Labelencoder

Source: Internet
Author: User

Sklearn.preprocessing.LabelEncoder (): Standardized labeling

Standardscaler==features with a mean=0 and variance=1
Minmaxscaler==features in a 0 to 1 rangenormalizer==feature vector to a Euclidean length=1
Normalizationbring the values of each of the feature vectors on a common scalel1-least absolute deviations-sum of absolute values (  On each row) =1;it are insensitive to outliersl2-least squares-sum of squares (on each row) =1;takes outliers in consideration During traing
#-*-Coding:utf-8-*-"" "Created on Sat April 09:09:41 2018@author:toby standardscaler==features with a mean=0 and Varia Nce=1minmaxscaler==features in a 0 to 1 rangenormalizer==feature vector to a Euclidean length=1normalizationbring the Valu Es of each feature vector in a common scalel1-least absolute deviations-sum of absolute values (on each row) =1;it is Insens Itive to Outliersl2-least squares-sum of squares (on all row) =1;takes outliers in consideration during Traing "" "from Sklea RN Import Preprocessingimport NumPy as Npdata=np.array ([[2.2,5.9,-1.8],[5.4,-3.2,-5.1],[-1.9,4.2,3.2]]) bindata= Preprocessing. Binarizer (threshold=1.5) transform (data) print (' binarized data: ', Bindata) #mean removalprint (' mean (before) = ', Data.mean (axis=0)) print (' Standard deviation (before) = ', DATA.STD (axis=0)) #features with a mean=0 and variance=1scaled_ Data=preprocessing.scale (data) print (' Mean (before) = ', Scaled_data.mean (axis=0)) print (' Standard deviation (before) = ', SCALED_DATA.STD (axis=0)) print (' Scaled_data: ', scaled_data) "Scaled_data: [[0.10040991 0.91127074-0.16607709] [1.171449-1.39221918-1.1332319] [-1.27185891 0.4809484 4 1.29930899]] "#features in a 0 to 1 rangeminmax_scaler=preprocessing. Minmaxscaler (feature_range= (0,1)) data_minmax=minmax_scaler.fit_transform (data) print (' Minmaxscaler applied on the          Data: ', Data_minmax) ' Minmaxscaler applied on the data: [[0.56164384 1].          0.39759036] [1.        0.0.          ] [0.        0.81318681 1. ]] ' ' Data_l1=preprocessing.normalize (data,norm= ' L1 ') data_l2=preprocessing.normalize (data,norm= ' L2 ') print ('   l1-normalized data: ', DATA_L1) ' [[0.22222222 0.5959596-0.18181818] [0.39416058-0.23357664-0.37226277] [-0.20430108 0.4516129 0.34408602] "print (' l2-normalized data: ', DATA_L2) ' [[0.3359268 0.90089461-0.2748492] [0.6676851-0 .39566524-0.63059148] [-0.33858465 0.74845029 0.57024784]] "

  

sklearn-Standardized label Labelencoder

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.