示例#1
0
from cryptoml.util.selection_pipeline import Pipeline
from cryptoml.util.import_proxy import SimpleImputer, StandardScaler, MinMaxScaler, XGBClassifier

PARAMETER_GRID = {}

PARAMETERS = {
    "colsample_bylevel": 0.8,
    "colsample_bynode": 1,
    "colsample_bytree": 0.8,
    "learning_rate": 0.3,
    "max_depth": 6,
    "n_estimators": 500,
    "num_parallel_tree": 1,
    "reg_alpha": 0,
    "reg_lambda": 1,
    "subsample": 1,
    "use_label_encoder": False,
    "seed": None,
    "random_state": 0,
    "objective": "multi:softmax",
    "eval_metric": "mlogloss"
}

estimator = Pipeline([
    ('i', SimpleImputer(strategy="mean")),  # Replace nan's with the mean value between previous and next observation
    ('s', StandardScaler()),  # Standardize data so that Mean and StdDev are < 1
    ('c', XGBClassifier(**PARAMETERS)),
])

示例#2
0
from cryptoml.util.selection_pipeline import Pipeline
from sklearn.ensemble import RandomForestClassifier
from cryptoml.util.import_proxy import SimpleImputer, StandardScaler, MinMaxScaler

PARAMETER_GRID = {
    'c__n_estimators': [100, 200, 500],
    'i__strategy': ['mean'],  # 'median', 'most_frequent', 'constant'
    'c__criterion': ['gini'],  # , 'entropy'],
    'c__max_depth': [2, 3, 4],
    'c__min_samples_split': [2],
    'c__min_samples_leaf': [1, 0.05, 0.2],
    'c__max_features': ['auto'],  # 'sqrt',
    'c__class_weight': [None, 'balanced'],  #, 'balanced_subsample'
}

estimator = Pipeline([
    (
        'i', SimpleImputer()
    ),  # Replace nan's with the median value between previous and next observation
    (
        's', StandardScaler()
    ),  # Scale data in order to center it and increase robustness against noise and outliers
    ('c', RandomForestClassifier()),
])
from cryptoml.util.selection_pipeline import Pipeline
from sklearn.svm import SVC
from cryptoml.util.import_proxy import SimpleImputer, MinMaxScaler, StandardScaler


PARAMETER_GRID = {
    'c__C': [1, 5, 10],
    # Regularization parameter. The strength of the regularization is inversely proportional to C. >0
    'c__kernel': ['poly'],
    'c__gamma': ['scale', 'auto'],
    # Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’. (default = 'scale')
    'c__degree': [2, 3, 4],
    # Degree of the polynomial kernel function (‘poly’). Ignored by all other kernels.
    # Independent term in kernel function. It is only significant in ‘poly’ and ‘sigmoid’.
    'c__class_weight': [None, 'balanced']

}

estimator = Pipeline([
    ('i', SimpleImputer()),  # Replace nan's with the median value between previous and next observation
    ('s', StandardScaler()),  # Scale data in order to center it and increase robustness against noise and outliers
    #('n', MinMaxScaler()),  # Scale data in order to center it and increase robustness against noise and outliers
    ('c', SVC(probability=True)),
])