Skip to content

Commit

Permalink
snn
Browse files Browse the repository at this point in the history
  • Loading branch information
pchavanne committed Jun 13, 2017
1 parent 3506f6f commit 7c8e3bf
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions yadll/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@
from .utils import *


def normalize(x):
x_min = x.min()
x_max = x.max()
z = (x - x_min) / (x_max - x_min)
return z, x_min, x_max


def revert_normalize(z, x_min, x_max):
return z * (x_max - x_min) + x_min


def standardize(x):
x_mean = x.mean()
x_std = x.std()
z = (x - x_mean) / x_std
return z, x_mean, x_std


def revert_standardize(z, x_mean, x_std):
return (z * x_std) + x_mean


def one_hot_encoding(arr, N=None):
"""
One hot encoding of a vector of integer categorical variables in a range [0..N].
Expand Down

0 comments on commit 7c8e3bf

Please sign in to comment.