Beispiel #1
0
def local_predict(models, test_reader, output, method, prediction_info=None):
    """Get local predictions and combine them to get a final prediction

    """
    local_model = MultiModel(models)
    test_set_header = test_reader.has_headers()
    for input_data in test_reader:
        prediction = local_model.predict(input_data,
                                         by_name=test_set_header,
                                         method=method,
                                         with_confidence=True)
        u.write_prediction(prediction, output, prediction_info)
Beispiel #2
0
def local_predict(models, test_reader, output, method):
    """Get local predictions and combine them to get a final prediction

    """
    local_model = MultiModel(models)
    test_set_header = test_reader.has_headers()
    for input_data in test_reader:
        prediction = local_model.predict(input_data,
                                         by_name=test_set_header,
                                         method=method,
                                         with_confidence=True)
        u.write_prediction(prediction, output)
Beispiel #3
0
def local_predict(models, headers, test_reader, exclude, fields, method,
                  objective_field, output, test_set_header):
    """Get local predictions, combine them and save predictions to file

    """
    local_model = MultiModel(models)
    for row in test_reader:
        for index in exclude:
            del row[index]
        input_data = fields.pair(row, headers, objective_field)
        prediction = local_model.predict(input_data,
                                         by_name=test_set_header,
                                         method=method)
        u.write_prediction(prediction, output)
Beispiel #4
0
def local_predict(models, test_reader, output, args, options=None,
                  exclude=None):
    """Get local predictions and combine them to get a final prediction

    """
    local_model = MultiModel(models)
    test_set_header = test_reader.has_headers()
    for input_data in test_reader:
        input_data_dict = test_reader.dict(input_data)
        prediction = local_model.predict(
            input_data_dict, by_name=test_set_header, method=args.method,
            with_confidence=True, options=options,
            missing_strategy=args.missing_strategy)
        write_prediction(prediction, output,
                         args.prediction_info, input_data, exclude)
Beispiel #5
0
def local_predict(models,
                  test_reader,
                  output,
                  args,
                  options=None,
                  exclude=None):
    """Get local predictions and combine them to get a final prediction

    """
    local_model = MultiModel(models)
    test_set_header = test_reader.has_headers()
    for input_data in test_reader:
        input_data_dict = test_reader.dict(input_data)
        prediction = local_model.predict(
            input_data_dict,
            by_name=test_set_header,
            method=args.method,
            with_confidence=True,
            options=options,
            missing_strategy=args.missing_strategy)
        write_prediction(prediction, output, args.prediction_info, input_data,
                         exclude)