print('Size raw_values %i' % (size_raw_values))

    print('------- Train -------')
    # No Prediction
    y_hat_predicted = y_test
    rmse = compare(y_test, y_hat_predicted)
    print('RMSE NoPredic  %.3f' % (rmse))

    # Dummy
    y_predicted_dummy = x_train[:, 0]
    rmse = compare(y_train, y_predicted_dummy)
    print('RMSE Dummy   %.3f' % (rmse))

    # ElasticNet
    y_predicted_en = algorithm.elastic_net2(x_train, y_train, x_train)
    rmse = compare(y_train, y_predicted_en)
    print('RMSE Elastic %.3f' % (rmse))

    print('------- Test --------')
    # No Prediction
    y_hat_predicted = y_test
    rmse = compare(y_test, y_hat_predicted)
    print('RMSE NoPredic  %.3f' % (rmse))

    # Dummy
    y_predicted_dummy = x_test[:, 0]
    rmse = compare(y_test, y_predicted_dummy)
    print('RMSE Dummy   %.3f' % (rmse))

    # ElasticNet
Exemplo n.º 2
0
x_test, y_test = test_scaled[:, 0:-1], test_scaled[:, -1]
x_test = [x_test[i] for i in range(len(x_test))]

print('------- Train -------')
# No Prediction
y_hat_predicted = y_train
rmse = compare_train(train_scaled, y_hat_predicted)
print('RMSE NoPredic  %.3f' % (rmse))

# Dummy
y_hat_predicted = x_train
rmse = compare_train(train_scaled, y_hat_predicted)
print('RMSE Dummy   %.3f' % (rmse))

# ElasticNet
y_hat_predicted = algorithm.elastic_net2(x_train, y_train, x_train)
rmse = compare_train(train_scaled, y_hat_predicted)
print('RMSE Elastic %.3f' % (rmse))

# KNN5
y_hat_predicted = algorithm.knn_regressor(x_train, y_train, x_train, 5)
rmse = compare_train(train_scaled, y_hat_predicted)
print('RMSE KNN(5)  %.3f' % (rmse))

# KNN10
y_hat_predicted = algorithm.knn_regressor(x_train, y_train, x_train, 10)
rmse = compare_train(train_scaled, y_hat_predicted)
print('RMSE KNN(10)  %.3f' % (rmse))

# SGD
y_hat_predicted = algorithm.sgd_regressor(x_train, y_train, x_train)
print('Size supervised %i' % (size_supervised))

print('------- Train -------')
# No Prediction
y_hat_predicted = y_train
rmse, y_predicted = compare_train(x_test, y_hat_predicted)
print('RMSE NoPredic  %.3f' % (rmse))

# Dummy
y_hat_predicted = x_train[:, 0]
rmse, y_predicted = compare_train(x_test, y_hat_predicted)
print('RMSE Dummy   %.3f' % (rmse))

# ElasticNet
y_hat_predicted = algorithm.elastic_net2(x_train, y_train, x_train, normalize=False)
rmse, y_predicted = compare_train(x_test, y_hat_predicted)
print('RMSE Elastic %.3f' % (rmse))

# KNN5
y_hat_predicted = algorithm.knn_regressor(x_train, y_train, x_train, 5)
rmse, y_predicted = compare_train(x_test, y_hat_predicted)
print('RMSE KNN(5)  %.3f' % (rmse))

# KNN10
y_hat_predicted = algorithm.knn_regressor(x_train, y_train, x_train, 10)
rmse, y_predicted = compare_train(x_test, y_hat_predicted)
print('RMSE KNN(10)  %.3f' % (rmse))

# SGD
y_hat_predicted = algorithm.sgd_regressor(x_train, y_train, x_train)
print('Size supervised %i' % (size_supervised))

print('------- Test --------')
# No Prediction
y_hat_predicted_sc = y_test
rmse, y_hat_predicted = compare_test(y_test, y_hat_predicted_sc)
#y_test = y_hat_predicted
#print('RMSE NoPredic  %.3f' % (rmse))

# Dummy
y_predicted_dummy_sc = x_test[:, 0]
#rmse, y_predicted_dummy = compare_test(y_test, y_predicted_dummy_sc)
#print('RMSE Dummy   %.3f' % (rmse))

# ElasticNet
y_predicted_en_sc = algorithm.elastic_net2(x_train, y_train, x_test, normalize=False)
rmse, y_predicted_en = compare_test(y_test, y_predicted_en_sc)
print('RMSE Elastic %.3f' % (rmse))

# rmse, y_future_en = compare_test(y_test, y_future_en_sc)
# print('RMSE Fut Els %.3f' % (rmse))

# KNN5
#y_predicted_knn5_sc = algorithm.knn_regressor(x_train, y_train, x_test, 5)
#rmse, y_predicted_knn5 = compare_test(y_test, y_predicted_knn5_sc)
#print('RMSE KNN(5)  %.3f' % (rmse))

# KNN10
#y_predicted_knn10_sc = algorithm.knn_regressor(x_train, y_train, x_test, 10)
#rmse, y_predicted_knn10 = compare_test(y_test, y_predicted_knn10_sc)
#print('RMSE KNN(10) %.3f' % (rmse))