def sklearn_main(config, ClassifierClass, clf_name, train_mode, normalize=False): model_params = getattr(config, clf_name) random_search_config = getattr(config.random_search, clf_name) full_config = (config, model_params, random_search_config) if train_mode: features, features_valid = feature_extraction( config, train_mode, persist_output=True, cache_output=True, load_persisted_output=True) sklearn_preproc = preprocessing_fillna((features, features_valid), config, train_mode) else: features = feature_extraction(config, train_mode, cache_output=True) sklearn_preproc = preprocessing_fillna(features, config, train_mode) sklearn_clf = classifier_sklearn(sklearn_preproc, ClassifierClass, full_config, clf_name, train_mode, normalize) clipper = Step(name='clipper', transformer=Clipper(**config.clipper), input_steps=[sklearn_clf], adapter=Adapter( {'prediction': E(sklearn_clf.name, 'predicted')}), experiment_directory=config.pipeline.experiment_directory) return clipper
def solution_1(config, train_mode): if train_mode: features, features_valid = feature_extraction(config, train_mode, save_output=True, cache_output=True, load_saved_output=True) light_gbm = classifier_lgbm((features, features_valid), config, train_mode) else: features = feature_extraction(config, train_mode, cache_output=True) light_gbm = classifier_lgbm(features, config, train_mode) clipper = Step(name='clipper', transformer=Clipper(**config.clipper), input_steps=[light_gbm], adapter={ 'prediction': ([(light_gbm.name, 'prediction')]), }, cache_dirpath=config.env.cache_dirpath) output = Step(name='output', transformer=Dummy(), input_steps=[clipper], adapter={ 'y_pred': ([(clipper.name, 'clipped_prediction')]), }, cache_dirpath=config.env.cache_dirpath) return output
def main(config, train_mode): if train_mode: features, features_valid = feature_extraction(config, train_mode, save_output=True, cache_output=True, load_saved_output=True) light_gbm = classifier_lgbm((features, features_valid), config, train_mode) else: features = feature_extraction(config, train_mode, cache_output=True) light_gbm = classifier_lgbm(features, config, train_mode) clipper = Step(name='clipper', transformer=Clipper(**config.clipper), input_steps=[light_gbm], adapter=Adapter({'prediction': E(light_gbm.name, 'prediction')}), cache_dirpath=config.env.cache_dirpath) return clipper
def xgboost(config, train_mode): if train_mode: features, features_valid = feature_extraction( config, train_mode, persist_output=True, cache_output=True, load_persisted_output=True) xgb = classifier_xgb((features, features_valid), config, train_mode) else: features = feature_extraction(config, train_mode, cache_output=True) xgb = classifier_xgb(features, config, train_mode) clipper = Step(name='clipper', transformer=Clipper(**config.clipper), input_steps=[xgb], adapter=Adapter({'prediction': E(xgb.name, 'prediction')}), experiment_directory=config.pipeline.experiment_directory) return clipper