Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tanh-estimator Normalization in PYTHON

Does anybody know how to implement tanh-estimator in python? I have a list of numbers which doesn't follow gaussian distribution. I want to use tanh-estimator as the preprocessing step but i don't know how can i implement it in python since there is no defined function for it like MinMaxScaler().

Thanks in advance

like image 473
Shelly Avatar asked Dec 11 '22 12:12

Shelly


1 Answers

There is an example of @UrbanoFonseca's answer:

import numpy as np

unnormalizedData = np.array([[15, 60], [5, 15], [45, 0], [0, 30]], dtype=np.float64)

m = np.mean(unnormalizedData, axis=0) # array([16.25, 26.25])
std = np.std(unnormalizedData, axis=0) # array([17.45530005, 22.18529919])

data = 0.5 * (np.tanh(0.01 * ((unnormalizedData - m) / std)) + 1)
#array([[0.49712291, 0.5076058 ],
#       [0.49711136, 0.49746456],
#       [0.50865938, 0.4940842 ],
#       [0.49710558, 0.50084515]])

Note this code implement a modified tanh-estimators proposed in Efficient approach to Normalization of Multimodal Biometric Scores, 2011

In the original version, the mean and standard deviation are estimated by Hampel estimators (Robust Statistics: The Approach Based on Influence Functions, 1986)

like image 134
CryMasK Avatar answered Dec 13 '22 22:12

CryMasK