random_seed = 42

lr_estimator = LogisticRegression(solver='liblinear', random_state=random_seed)

search_params = { "C" : [1.e-01, 1.e+00, 1.e+01], "penalty" : [ "l1", "l2" ] }

######### skrobot Code

# Build an Experiment
experiment = Experiment('experiments-output').set_source_code_file_path(__file__).set_experimenter('echatzikyriakidis').build()


# Run Feature Selection Task
features_columns = experiment.run(FeatureSelectionCrossValidationTask (estimator=lr_estimator,
                                                                       train_data_set_file_path=train_data_set_file_path,
                                                                       random_seed=random_seed).custom_folds(folds_file_path=folds_file_path))

# Run Hyperparameters Search Task
hyperparameters_search_results = experiment.run(HyperParametersSearchCrossValidationTask (estimator=lr_estimator,
                                                                                          search_params=search_params,
                                                                                          train_data_set_file_path=train_data_set_file_path,
                                                                                          feature_columns=features_columns,
                                                                                          random_seed=random_seed).random_search().custom_folds(folds_file_path=folds_file_path))

# Run Evaluation Task	
evaluation_results = experiment.run(EvaluationCrossValidationTask(estimator=lr_estimator,
                                                                  estimator_params=hyperparameters_search_results['best_params'],
                                                                  train_data_set_file_path=train_data_set_file_path,
                                                                  test_data_set_file_path=test_data_set_file_path,
                                                                  export_classification_reports=True,
示例#2
0
from os import path

from sklearn.linear_model import LogisticRegression

from skrobot.core import Experiment
from skrobot.tasks import FeatureSelectionCrossValidationTask

######### Initialization Code

random_seed = 42

lr_estimator = LogisticRegression(solver='liblinear', random_state=random_seed)

######### skrobot Code

# Build an Experiment
experiment = Experiment('experiments-output').set_source_code_file_path(
    __file__).set_experimenter('echatzikyriakidis').build()

# Run Feature Selection Task
features_columns = experiment.run(
    FeatureSelectionCrossValidationTask(
        estimator=lr_estimator,
        train_data_set_file_path=path.join('data',
                                           'money-laundering-data-train.csv'),
        random_seed=random_seed).custom_folds(
            folds_file_path=path.join('data', 'money-laundering-folds.csv')))

# Print in-memory results
print(features_columns)
示例#3
0
random_seed = 42

lr_estimator = LogisticRegression(solver='liblinear', random_state=random_seed)

search_params = {"C": [1.e-01, 1.e+00, 1.e+01], "penalty": ["l1", "l2"]}

######### skrobot Code

# Build an Experiment
experiment = Experiment('experiments-output').set_source_code_file_path(
    __file__).set_experimenter('echatzikyriakidis').build()

# Run Feature Selection Task
features_columns = experiment.run(
    FeatureSelectionCrossValidationTask(
        estimator=lr_estimator,
        train_data_set=train_data_set,
        random_seed=random_seed).custom_folds(folds_data=folds_data))

# Run Hyperparameters Search Task
hyperparameters_search_results = experiment.run(
    HyperParametersSearchCrossValidationTask(
        estimator=lr_estimator,
        search_params=search_params,
        train_data_set=train_data_set,
        feature_columns=features_columns,
        random_seed=random_seed).random_search().custom_folds(
            folds_data=folds_data))

# Run Evaluation Task
evaluation_results = experiment.run(
    EvaluationCrossValidationTask(
    ["mean", "median"]
}

######### skrobot Code

# Create a Task Runner
task_runner = TaskRunner(
    f'task-runner-output-{datetime.datetime.now().strftime("%Y-%m-%dT%H-%M-%S")}'
)

# Run Feature Selection Task
features_columns = task_runner.run(
    FeatureSelectionCrossValidationTask(
        estimator=classifier,
        train_data_set=train_data_set,
        preprocessor=preprocessor,
        min_features_to_select=4,
        id_column=id_column,
        label_column=label_column,
        random_seed=random_seed).stratified_folds(total_folds=5, shuffle=True))

pipe = Pipeline(
    steps=[('preprocessor',
            preprocessor), ('selector', ColumnSelector(
                cols=features_columns)), ('classifier', classifier)])

# Run Hyperparameters Search Task
hyperparameters_search_results = task_runner.run(
    HyperParametersSearchCrossValidationTask(
        estimator=pipe,
        search_params=search_params,
        train_data_set=train_data_set,
示例#5
0
from os import path

from sklearn.linear_model import LogisticRegression

from skrobot.core import Experiment
from skrobot.tasks import FeatureSelectionCrossValidationTask

######### Initialization Code

random_seed = 42

lr_estimator = LogisticRegression(solver='liblinear', random_state=random_seed)

######### skrobot Code

# Build an Experiment
experiment = Experiment('experiments-output').set_source_code_file_path(__file__).set_experimenter('echatzikyriakidis').build()

# Run Feature Selection Task
features_columns = experiment.run(FeatureSelectionCrossValidationTask (estimator=lr_estimator,
                                                                       train_data_set=path.join('data','money-laundering-data-train.csv'),
                                                                       random_seed=random_seed).custom_folds(folds_data=path.join('data','money-laundering-folds.csv')))

# Print in-memory results
print(features_columns)