Exemple #1
0
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import MinMaxScaler

from regression_model.processing import preprocessors as pp
from regression_model.processing import features
from regression_model.config import config

import logging

_logger = logging.getLogger(__name__)

price_pipe = Pipeline([
    ('categorical_imputer',
     pp.CategoricalImputer(variables=config.CATEGORICAL_VARS_WITH_NA)),
    ('numerical_inputer',
     pp.NumericalImputer(variables=config.NUMERICAL_VARS_WITH_NA)),
    ('temporal_variable',
     pp.TemporalVariableEstimator(variables=config.TEMPORAL_VARS,
                                  reference_variable=config.DROP_FEATURES)),
    ('rare_label_encoder',
     pp.RareLabelCategoricalEncoder(tol=0.01,
                                    variables=config.CATEGORICAL_VARS)),
    ('categorical_encoder',
     pp.CategoricalEncoder(variables=config.CATEGORICAL_VARS)),
    ('log_transformer',
     features.LogTransformer(variables=config.NUMERICALS_LOG_VARS)),
    ('drop_features',
     pp.DropUnecessaryFeatures(variables_to_drop=config.DROP_FEATURES)),
    ('scaler', MinMaxScaler()), ('forest', Lasso(random_state=0))
])
Exemple #2
0
from sklearn.pipeline import Pipeline

import regression_model.preprocessors as pp

from sklearn.linear_model import Lasso
from sklearn.preprocessing import MinMaxScaler
from regression_model.config import config
from regression_model.processing import features



price_pipe = Pipeline(
    [("categorical_imputer", pp.CategoricalImputer(variables=config.CATEGORICAL_VARS)),

    ("numerical_imputer", pp.NumericalImputer(variables=config.NUMERICAL_VARS_WITH_NA)),

    ("rare_label_encoder", pp.RareLabelCategoricalEncoder(tol=0.01, variables=config.CATEGORICAL_VARS)),

    ("categorical_encoder", pp.CategoricalEncoder(variables=config.CATEGORICAL_VARS)),

    ("log_transformer", features.LogTransformer(variables=config.NUMERICAL_LOG_VARS)),

    ("drop_features", pp.DropUnnecessaryFeatures(variables_to_drop=config.DROP_FEATURES)),

    ("scaler", MinMaxScaler()),

    ("linear_model", Lasso(alpha=0.005, random_state=0))])


        "categorical_imputer",
        pp.CategoricalImputer(variables=config.CATEGORICAL_VARS_WITH_NA),
    ),
    (
        "numerical_imputer",
        pp.NumericalImputer(variables=config.NUMERICAL_VARS_WITH_NA),
    ),
    (
        "temporal_varibales",
        pp.TemporalVariableEstimator(variables=config.TEMPORAL_VARS),
    ),
    (
        "rare_label_encoder",
        pp.RareLabelCategoricalEncoder(tol=0.01,
                                       variables=config.CATEGORICAL_VARS),
    ),
    (
        "categorical_encoder",
        pp.CategoricalEncoder(variables=config.CATEGORICAL_VARS),
    ),
    (
        "log_transform",
        fe.LogTransformer(variables=config.NUMERICAL_LOG_VARS),
    ),
    (
        "drop_features",
        pp.DropUnecessaryFeatures(variables_to_drop=config.DROP_FEATURES),
    ),
    ("scalar", MinMaxScaler()),
    ("Linear_model", Lasso(alpha=0.005, random_state=0)),
])
from regression_model.processing import features
from regression_model.processing import preprocessors as pp
from regression_model.config import config

import logging

_logger = logging.getLogger(__name__)

price_pipe = Pipeline([
    (
        "categorical_imputer",
        pp.CategoricalImputer(variables_path=config.CATEGORICAL_VARS_FILE),
    ),
    (
        "numerical_inputer",
        pp.NumericalImputer(variables_path=config.NUMERICAL_VARS_FILE),
    ),
    (
        "rare_label_encoder",
        pp.RareLabelCategoricalEncoder(
            tol=0.01, variables_path=config.CATEGORICAL_VARS_FILE),
    ),
    ("log_transformer",
     features.LogTransformer(variables_path=config.NUMERICAL_LOG_VARS_FILE)),
    (
        "scaler",
        MinMaxScaler(),
    ),
    ("Linear_model", Lasso(alpha=0.005, random_state=0)),
])