import numpy as np
from sklearn.preprocessing import QuantileTransformer
[docs]class StandardScaler(object):
"""Impliments standard (mean/std) scaling."""
def __init__(self):
self.mean = None
self.std = None
[docs] def fit(self, x):
self.mean = x.mean()
self.std = x.std()
[docs]class GaussRankScaler(object):
"""
So-called "Gauss Rank" scaling.
Forces a transformation, uses bins to perform
inverse mapping.
Uses sklearn QuantileTransformer to work.
"""
def __init__(self):
self.transformer = QuantileTransformer(output_distribution='normal')
[docs] def fit(self, x):
x = x.reshape(-1, 1)
self.transformer.fit(x)
[docs]class NullScaler(object):
def __init__(self):
pass