4e1bb8d51e8b01c22cf52a0a5a8d7466083dd2da,category_encoders/polynomial.py,PolynomialEncoder,polynomial_coding,#Any#Any#,238
Before Change
for switch in mapping:
col = switch.get("col")
mod = switch.get("mapping")
new_columns = []
for i in range(len(mod.columns)):
c = mod.columns[i]
new_col = str(col) + "_%d" % (i, )
X.loc[:, new_col] = mod[c].loc[X[col]].values
new_columns.append(new_col)
old_column_index = cols.index(col)
cols[old_column_index: old_column_index + 1] = new_columns
cols = ["intercept"] + cols
X = X.reindex(columns=cols)
return X
After Change
X = X_in.copy(deep=True)
cols = X.columns.values.tolist()
X["intercept"] = pd.Series([1] * X.shape[0], index=X.index)
for switch in mapping:
col = switch.get("col")
mod = switch.get("mapping")
base_df = mod.loc[X[col]]
base_df.set_index(X.index, inplace=True)
X = pd.concat([base_df, X], axis=1)
old_column_index = cols.index(col)
cols[old_column_index: old_column_index + 1] = mod.columns
cols = ["intercept"] + cols
return X.reindex(columns=cols)
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 39
Instances
Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: 4e1bb8d51e8b01c22cf52a0a5a8d7466083dd2da
Time: 2018-12-21
Author: jcastaldo08@gmail.com
File Name: category_encoders/polynomial.py
Class Name: PolynomialEncoder
Method Name: polynomial_coding
Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: bdc3fe70d33b85cfdaa5ed02ccfd60807ae4f1da
Time: 2018-12-21
Author: jcastaldo08@gmail.com
File Name: category_encoders/helmert.py
Class Name: HelmertEncoder
Method Name: helmert_coding
Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: fc4917ae8a7320fc9a258b50d82a177ed2124a91
Time: 2018-12-21
Author: jcastaldo08@gmail.com
File Name: category_encoders/backward_difference.py
Class Name: BackwardDifferenceEncoder
Method Name: backward_difference_coding
Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: ea2d40dce8f0295e9c66d4f5ff34539b36b92ba8
Time: 2018-12-21
Author: jcastaldo08@gmail.com
File Name: category_encoders/sum_coding.py
Class Name: SumEncoder
Method Name: sum_coding
Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: 4e1bb8d51e8b01c22cf52a0a5a8d7466083dd2da
Time: 2018-12-21
Author: jcastaldo08@gmail.com
File Name: category_encoders/polynomial.py
Class Name: PolynomialEncoder
Method Name: polynomial_coding