374ca541aaf62aba88a144acbbc7398ca3e995ef,category_encoders/helmert.py,HelmertEncoder,fit_helmert_coding,#Any#Any#Any#,213
Before Change
@staticmethod
def fit_helmert_coding(values, handle_missing, handle_unknown):
if handle_missing == "value":
del values[np.nan]
if len(values) < 2:
return pd.DataFrame()
After Change
@staticmethod
def fit_helmert_coding(values, handle_missing, handle_unknown):
if handle_missing == "value":
values = values[values > 0]
if len(values) == 0:
return pd.DataFrame()
helmert_contrast_matrix = Helmert().code_without_intercept(values.get_values())
df = pd.DataFrame(data=helmert_contrast_matrix.matrix,
columns=helmert_contrast_matrix.column_suffixes,
index=values.get_values())
if handle_unknown == "return_nan":
df.loc[-1] = np.nan
elif handle_unknown == "value":
df.loc[-1] = np.zeros(len(values) - 1)
if handle_missing == "return_nan":
df.loc[values.loc[np.nan]] = np.nan
elif handle_missing == "value":
df.loc[-2] = np.zeros(len(values) - 1)
return df
@staticmethod
def helmert_coding(X_in, mapping):
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 22
Instances
Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: 374ca541aaf62aba88a144acbbc7398ca3e995ef
Time: 2018-11-26
Author: jcastaldo08@gmail.com
File Name: category_encoders/helmert.py
Class Name: HelmertEncoder
Method Name: fit_helmert_coding
Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: 374ca541aaf62aba88a144acbbc7398ca3e995ef
Time: 2018-11-26
Author: jcastaldo08@gmail.com
File Name: category_encoders/polynomial.py
Class Name: PolynomialEncoder
Method Name: fit_polynomial_coding
Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: 374ca541aaf62aba88a144acbbc7398ca3e995ef
Time: 2018-11-26
Author: jcastaldo08@gmail.com
File Name: category_encoders/backward_difference.py
Class Name: BackwardDifferenceEncoder
Method Name: fit_backward_difference_coding
Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: 374ca541aaf62aba88a144acbbc7398ca3e995ef
Time: 2018-11-26
Author: jcastaldo08@gmail.com
File Name: category_encoders/sum_coding.py
Class Name: SumEncoder
Method Name: fit_sum_coding
Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: 374ca541aaf62aba88a144acbbc7398ca3e995ef
Time: 2018-11-26
Author: jcastaldo08@gmail.com
File Name: category_encoders/helmert.py
Class Name: HelmertEncoder
Method Name: fit_helmert_coding