9951 explained code solutions for 126 technologies


python-scikit-learnNormalize data example


from sklearn import preprocessing
data = [1,2,3,4,5,6,6,6,3,4,2,4]

norm = preprocessing.normalize([data])ctrl + c
from sklearn import

import module from scikit-learn

data

list of values to normalize

.normalize(

scales given values to unit norm


Usage example

from sklearn import preprocessing
data = [1,2,3,4,5,6,6,6,3,4,2,4]

norm = preprocessing.normalize([data])

print(norm)
output
[[0.06933752 0.13867505 0.20801257 0.2773501  0.34668762 0.41602515
  0.41602515 0.41602515 0.20801257 0.2773501  0.13867505 0.2773501 ]]

Related