Skip to content

Instantly share code, notes, and snippets.

@andreaschandra
Created April 2, 2018 15:40
Show Gist options
  • Save andreaschandra/44e994ffbeb5e46c1efef6c8028d0b3e to your computer and use it in GitHub Desktop.
Save andreaschandra/44e994ffbeb5e46c1efef6c8028d0b3e to your computer and use it in GitHub Desktop.
data_normalized_l1 = preprocessing.normalize(input, norm='l1')
data_normalized_l2 = preprocessing.normalize(input, norm='l2')
print("\nL1 normalized data:\n", data_normalized_l1)
print("\nL2 normalized data:\n", data_normalized_l2)
L1 normalized data:
[[ 0.61538462 0.15384615 0.23076923]
[ 0.33333333 0.58333333 0.08333333]
[ 0.52941176 0.11764706 0.35294118]]
L2 normalized data:
[[ 0.91168461 0.22792115 0.34188173]
[ 0.49236596 0.86164044 0.12309149]
[ 0.81818182 0.18181818 0.54545455]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment