Example #1
0
def _process_wine_quality_prediction(args):
    params = parse_wine_quality_params(args)
    preparer = WhiteWinesPreparer()
    features = preparer.prepare(params)
    predictions = RegressionPredictor(wine_cls).predict(features)
    return str(predictions[0])
Example #2
0
def _process_forest_fire_prediction(args):
    params = parse_forest_fire_params(args)
    preparer = ForestFiresPreparer()
    arry = preparer.prepare(params)
    predictions = RegressionPredictor(fires_reg).predict(arry)
    return str(predictions[0])
Example #3
0
def _process_abalone_prediction(args):
    params = parse_abalone_params(args)
    preparer = AbalonePreparer()
    features = preparer.prepare(params)
    predictions = RegressionPredictor(abalone_reg).predict(features)
    return str(predictions[0])
Example #4
0
 def test_returns_zero_as_lower_bound(self):
     model.predict.return_value = [-23.4324]
     engine = RegressionPredictor(model)
     inference = engine.predict([vals])[0]
     assert inference == 0, 'Inference lower bound should be zero'
Example #5
0
 def test_return_specified_decimal_points(self):
     engine = RegressionPredictor(model)
     inference = engine.predict([vals], decimals=4)[0]
     assert number_of_decimals(inference) == 4, 'number of decimal points \
Example #6
0
 def test_return_two_decimal_points(self):
     engine = RegressionPredictor(model)
     inference = engine.predict([vals])[0]
     assert number_of_decimals(inference) == 2, 'default number of decimal \
Example #7
0
 def test_returns_prediction(self):
     engine = RegressionPredictor(model)
     inference = engine.predict([vals])[0]
     assert inference == 23.43, 'Prediction value is incorrect'
Example #8
0
 def test_return_float(self):
     engine = RegressionPredictor(model)
     inference = engine.predict([vals])[0]
     assert type(inference) == float, 'Inferences should be real numbers'