示例#1
0
from measure import measure_encoder
from category_encoders import BinaryEncoder

measure_encoder(BinaryEncoder, save_results=True)
from measure import measure_encoder
from category_encoders import BaseNEncoder

measure_encoder(BaseNEncoder, save_results=True)
示例#3
0
from measure import measure_encoder
from category_encoders import TargetEncoder

measure_encoder(TargetEncoder, save_results=True)
from measure import measure_encoder
from category_encoders import CountEncoder


class RobustCountEncoder:
    def __init__(self, cols=None):
        self.nominal_cols = cols

    def fit(self, X, y=None):
        self.encoder = CountEncoder(cols=self.nominal_cols).fit(X, y)
        return self

    def transform(self, X):
        X = self.encoder.transform(X)
        X = X.fillna(0)
        return X


measure_encoder(RobustCountEncoder, 'CountEncoder', save_results=True)
示例#5
0
from measure import measure_encoder

class DropEncoder:
    def __init__(self, cols=None):
        self.drop_cols=cols
    
    def fit(self, X, y=None):
        return self

    def transform(self, X):
        return X.drop(columns=self.drop_cols)
    
measure_encoder(DropEncoder, save_results=True)
from measure import measure_encoder
from category_encoders import LeaveOneOutEncoder

measure_encoder(LeaveOneOutEncoder, save_results=True)
from measure import measure_encoder
from category_encoders import PolynomialEncoder

class RobustPolynomialEncoder:
    def __init__(self, cols=None):
        self.nominal_cols=cols
    
    def fit(self, X, y=None):
        self.encoder = PolynomialEncoder(cols=self.nominal_cols).fit(X,y)
        return self

    def transform(self, X):
        X = self.encoder.transform(X)
        X = X.fillna(0)
        return X

measure_encoder(RobustPolynomialEncoder, 'PolynomialEncoder', save_results=True)
from measure import measure_encoder
from category_encoders import BackwardDifferenceEncoder

measure_encoder(BackwardDifferenceEncoder, save_results=True)
from measure import measure_encoder
from category_encoders import JamesSteinEncoder

measure_encoder(JamesSteinEncoder, save_results=True)
示例#10
0
from measure import measure_encoder
from category_encoders import GLMMEncoder

measure_encoder(GLMMEncoder, save_results=True)
示例#11
0
from measure import measure_encoder
from category_encoders import SumEncoder

metrics = measure_encoder(SumEncoder, save_results=True)
示例#12
0
from measure import measure_encoder
from category_encoders import CatBoostEncoder

measure_encoder(CatBoostEncoder, save_results=True)
示例#13
0
from measure import measure_encoder
from category_encoders import HashingEncoder

measure_encoder(HashingEncoder, save_results=True)
示例#14
0
from measure import measure_encoder
from category_encoders import MEstimateEncoder

measure_encoder(MEstimateEncoder, save_results=True)
示例#15
0
from measure import measure_encoder
from category_encoders import OneHotEncoder

measure_encoder(OneHotEncoder, save_results=True)