# Path: xcessiv/functions.py
# def hash_file(path, block_size=65536):
# def hash_string(string):
# def import_object_from_path(path, object):
# def import_object_from_string_code(code, object):
# def import_string_code_as_module(code):
# def verify_dataset(X, y):
# def is_valid_json(x):
# def make_serializable(json):
# def get_sample_dataset(dataset_properties):
# def verify_estimator_class(est, meta_feature_generator, metric_generators, dataset_properties):
# def get_path_from_query_string(req):
#     def __init__(self, path):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# class DBContextManager():
# 
# Path: xcessiv/models.py
# class JsonEncodedDict(TypeDecorator):
# class JsonEncodedList(TypeDecorator):
# class Extraction(Base):
# class BaseLearnerOrigin(Base):
# class AutomatedRun(Base):
# class BaseLearner(Base):
# class StackedEnsemble(Base):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def __init__(self):
#     def return_main_dataset(self):
#     def return_train_dataset(self):
#     def return_test_dataset(self):
#     def __init__(self, source='', name='Base Learner Setup',
#                  meta_feature_generator='predict_proba', metric_generators=None):
#     def serialize(self):
#     def return_estimator(self):
#     def cleanup(self, path):
#     def export_as_file(self, filepath, hyperparameters):
#     def __init__(self, source, job_status, category, base_learner_origin=None):
#     def serialize(self):
#     def __init__(self, hyperparameters, job_status, base_learner_origin):
#     def return_estimator(self):
#     def meta_features_path(self, path):
#     def serialize(self):
#     def delete_meta_features(self, path):
#     def cleanup(self, path):
#     def export_as_file(self, filepath):
#     def __init__(self, secondary_learner_hyperparameters, base_learners,
#                  base_learner_origin, job_status):
#     def return_secondary_learner(self):
#     def export_as_code(self, cv_source):
#     def export_as_file(self, file_path, cv_source):
#     def export_as_package(self, package_path, cv_source):
#     def serialize(self):
# 
# Path: xcessiv/constants.py
# DEFAULT_EXTRACTION_MAIN_DATASET = {
#     "source": extraction_default_source.format('main', 'main', 'main', 'main')
# }
# DEFAULT_EXTRACTION_TEST_DATASET = {
#     "method": None,
#     "source": extraction_default_source.format('test', 'test', 'test', 'test')
# }
# DEFAULT_EXTRACTION_META_FEATURE_GENERATION = {
#     "source": meta_feature_generation_default_source
# }


from rq import get_current_job
from xcessiv import functions
from xcessiv import models
from xcessiv import constants
from six import iteritems
from bayes_opt import BayesianOptimization
import numpy as np
import os
import sys
import traceback
import numbers
            'return_splits_iterable'
        )
        X, y = extraction.return_train_dataset()

        #  We need to retrieve original order of meta-features
        indices_list = [test_index for train_index, test_index in return_splits_iterable(X, y)]
        indices = np.concatenate(indices_list)
        X, y = X[indices], y[indices]

        est = stacked_ensemble.return_secondary_learner()

        return_splits_iterable_stacked_ensemble = functions.import_object_from_string_code(
            extraction.stacked_ensemble_cv['source'],
            'return_splits_iterable'
        )
        preds = []
        trues_list = []
        for train_index, test_index in return_splits_iterable_stacked_ensemble(secondary_features, y):
            X_train, X_test = secondary_features[train_index], secondary_features[test_index]
            y_train, y_test = y[train_index], y[test_index]
            est = est.fit(X_train, y_train)
            preds.append(
                getattr(est, stacked_ensemble.base_learner_origin.
                        meta_feature_generator)(X_test)
            )
            trues_list.append(y_test)
        preds = np.concatenate(preds, axis=0)
        y_true = np.concatenate(trues_list)

        for key in stacked_ensemble.base_learner_origin.metric_generators:

# Path: xcessiv/functions.py
# def hash_file(path, block_size=65536):
# def hash_string(string):
# def import_object_from_path(path, object):
# def import_object_from_string_code(code, object):
# def import_string_code_as_module(code):
# def verify_dataset(X, y):
# def is_valid_json(x):
# def make_serializable(json):
# def get_sample_dataset(dataset_properties):
# def verify_estimator_class(est, meta_feature_generator, metric_generators, dataset_properties):
# def get_path_from_query_string(req):
#     def __init__(self, path):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# class DBContextManager():
# 
# Path: xcessiv/models.py
# class JsonEncodedDict(TypeDecorator):
# class JsonEncodedList(TypeDecorator):
# class Extraction(Base):
# class BaseLearnerOrigin(Base):
# class AutomatedRun(Base):
# class BaseLearner(Base):
# class StackedEnsemble(Base):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def __init__(self):
#     def return_main_dataset(self):
#     def return_train_dataset(self):
#     def return_test_dataset(self):
#     def __init__(self, source='', name='Base Learner Setup',
#                  meta_feature_generator='predict_proba', metric_generators=None):
#     def serialize(self):
#     def return_estimator(self):
#     def cleanup(self, path):
#     def export_as_file(self, filepath, hyperparameters):
#     def __init__(self, source, job_status, category, base_learner_origin=None):
#     def serialize(self):
#     def __init__(self, hyperparameters, job_status, base_learner_origin):
#     def return_estimator(self):
#     def meta_features_path(self, path):
#     def serialize(self):
#     def delete_meta_features(self, path):
#     def cleanup(self, path):
#     def export_as_file(self, filepath):
#     def __init__(self, secondary_learner_hyperparameters, base_learners,
#                  base_learner_origin, job_status):
#     def return_secondary_learner(self):
#     def export_as_code(self, cv_source):
#     def export_as_file(self, file_path, cv_source):
#     def export_as_package(self, package_path, cv_source):
#     def serialize(self):
# 
# Path: xcessiv/constants.py
# DEFAULT_EXTRACTION_MAIN_DATASET = {
#     "source": extraction_default_source.format('main', 'main', 'main', 'main')
# }
# DEFAULT_EXTRACTION_TEST_DATASET = {
#     "method": None,
#     "source": extraction_default_source.format('test', 'test', 'test', 'test')
# }
# DEFAULT_EXTRACTION_META_FEATURE_GENERATION = {
#     "source": meta_feature_generation_default_source
# }


# Path: xcessiv/automatedruns.py
from rq import get_current_job
from xcessiv import functions
from xcessiv import models
from xcessiv import constants
from six import iteritems
from bayes_opt import BayesianOptimization
import numpy as np
import os
import sys
import traceback
import numbers

            'return_splits_iterable'
        )
        X, y = extraction.return_train_dataset()

        #  We need to retrieve original order of meta-features
        indices_list = [test_index for train_index, test_index in return_splits_iterable(X, y)]
        indices = np.concatenate(indices_list)
        X, y = X[indices], y[indices]

        est = stacked_ensemble.return_secondary_learner()

        return_splits_iterable_stacked_ensemble = functions.import_object_from_string_code(
            extraction.stacked_ensemble_cv['source'],
            'return_splits_iterable'
        )
        preds = []
        trues_list = []
        for train_index, test_index in return_splits_iterable_stacked_ensemble(secondary_features, y):
            X_train, X_test = secondary_features[train_index], secondary_features[test_index]
            y_train, y_test = y[train_index], y[test_index]
            est = est.fit(X_train, y_train)
            preds.append(
                getattr(est, stacked_ensemble.base_learner_origin.
                        meta_feature_generator)(X_test)
            )
            trues_list.append(y_test)
        preds = np.concatenate(preds, axis=0)
        y_true = np.concatenate(trues_list)

        for key in stacked_ensemble.base_learner_origin.metric_generators:

            metric_generator = functions.import_object_from_string_code(