Beispiel #1
0
def ensemble_processing(dataset,
                        name,
                        description,
                        objective_field,
                        fields,
                        api,
                        args,
                        resume,
                        session_file=None,
                        path=None,
                        log=None):
    """Creates an ensemble of models from the input data

    """
    ensemble = None
    if resume:
        message = u.dated("Ensemble not found. Resuming.\n")
        resume, ensemble = c.checkpoint(c.is_ensemble_created,
                                        path,
                                        debug=args.debug,
                                        message=message,
                                        log_file=session_file,
                                        console=args.verbosity)
    if ensemble is None:
        ensemble_args = r.set_ensemble_args(name, description, args,
                                            objective_field, fields)
        ensemble = r.create_ensemble(dataset, ensemble_args, args, api, path,
                                     session_file, log)
    return ensemble, resume
Beispiel #2
0
def ensemble_processing(dataset, objective_field, fields, api, args, resume,
                        name=None, description=None, model_fields=None,
                        session_file=None,
                        path=None, log=None):
    """Creates an ensemble of models from the input data

    """
    ensembles = []
    number_of_ensembles = 1
    if resume:
        message = u.dated("Ensemble not found. Resuming.\n")
        resume, ensembles = c.checkpoint(
            c.are_ensembles_created, path, number_of_ensembles,
            debug=args.debug,
            message=message, log_file=session_file, console=args.verbosity)
    try:
        ensemble = ensembles[0]
    except IndexError:
        ensemble = None

    if ensemble is None:
        ensemble_args = r.set_ensemble_args(name, description, args,
                                            model_fields, objective_field,
                                            fields)
        ensembles, ensemble_ids, models, model_ids = r.create_ensembles(
            dataset, ensembles, ensemble_args, args, api=api, path=path,
            session_file=session_file, log=log)
    return ensembles, ensemble_ids, models, model_ids, resume
Beispiel #3
0
def ensemble_processing(datasets, objective_field, fields, api, args, resume,
                        name=None, description=None, model_fields=None,
                        session_file=None,
                        path=None, log=None):
    """Creates an ensemble of models from the input data

    """
    ensembles = []
    number_of_ensembles = 1
    if resume:
        message = u.dated("Ensemble not found. Resuming.\n")
        resume, ensembles = c.checkpoint(
            c.are_ensembles_created, path, number_of_ensembles,
            debug=args.debug,
            message=message, log_file=session_file, console=args.verbosity)
    try:
        ensemble = ensembles[0]
    except IndexError:
        ensemble = None

    if ensemble is None:
        ensemble_args = r.set_ensemble_args(name, description, args,
                                            model_fields, objective_field,
                                            fields)
        ensembles, ensemble_ids, models, model_ids = r.create_ensembles(
            datasets, ensembles, ensemble_args, args, api=api, path=path,
            session_file=session_file, log=log)
    return ensembles, ensemble_ids, models, model_ids, resume
Beispiel #4
0
def ensemble_processing(datasets, api, args, resume,
                        fields=None,
                        session_file=None,
                        path=None, log=None):
    """Creates an ensemble of models from the input data

    """
    ensembles = []
    ensemble_ids = []
    number_of_ensembles = len(datasets)

    if resume:
        resume, ensemble_ids = c.checkpoint(
            c.are_ensembles_created, path, number_of_ensembles,
            debug=args.debug)
        if not resume:
            message = u.dated("Found %s ensembles out of %s. Resuming.\n"
                              % (len(ensemble_ids),
                                 number_of_ensembles))
            u.log_message(message, log_file=session_file,
                          console=args.verbosity)
        ensembles = ensemble_ids
        number_of_ensembles -= len(ensemble_ids)

    if number_of_ensembles > 0:
        ensemble_args = r.set_ensemble_args(args, fields=fields)
        ensembles, ensemble_ids, models, model_ids = r.create_ensembles(
            datasets, ensembles, ensemble_args, args, api=api, path=path,
            number_of_ensembles=number_of_ensembles,
            session_file=session_file, log=log)
    return ensembles, ensemble_ids, models, model_ids, resume
Beispiel #5
0
def ensemble_processing(datasets,
                        api,
                        args,
                        resume,
                        fields=None,
                        session_file=None,
                        path=None,
                        log=None):
    """Creates an ensemble of models from the input data

    """
    ensembles = []
    ensemble_ids = []
    models = []
    model_ids = []
    number_of_ensembles = len(datasets)

    if resume:
        resume, ensemble_ids = c.checkpoint(c.are_ensembles_created,
                                            path,
                                            number_of_ensembles,
                                            debug=args.debug)
        if args.number_of_models > 1:
            _, model_ids = c.checkpoint(c.are_models_created, path, \
                number_of_ensembles * args.number_of_models)
            models = model_ids
        if not resume:
            message = u.dated("Found %s ensembles out of %s. Resuming.\n" %
                              (len(ensemble_ids), number_of_ensembles))
            u.log_message(message,
                          log_file=session_file,
                          console=args.verbosity)
        ensembles = ensemble_ids
        number_of_ensembles -= len(ensemble_ids)

    if number_of_ensembles > 0:
        ensemble_args = r.set_ensemble_args(args, fields=fields)
        ensembles, ensemble_ids, models, model_ids = r.create_ensembles(
            datasets,
            ensembles,
            ensemble_args,
            args,
            api=api,
            path=path,
            number_of_ensembles=number_of_ensembles,
            session_file=session_file,
            log=log)
    return ensembles, ensemble_ids, models, model_ids, resume
Beispiel #6
0
def ensemble_processing(dataset, name, description, objective_field, fields,
                        api, args, resume, session_file=None,
                        path=None, log=None):
    """Creates an ensemble of models from the input data

    """
    ensemble = None
    if resume:
        message = u.dated("Ensemble not found. Resuming.\n")
        resume, ensemble = c.checkpoint(
            c.is_ensemble_created, path, debug=args.debug,
            message=message, log_file=session_file, console=args.verbosity)
    if ensemble is None:
        ensemble_args = r.set_ensemble_args(name, description, args,
                                            objective_field, fields)
        ensemble = r.create_ensemble(dataset, ensemble_args, args, api,
                                     path, session_file, log)
    return ensemble, resume