예제 #1
0
def accuracies():
    data = dataProcessing()
    accuracies = []
    X_train, X_test, y_train, y_test = train_test_split(data[0],
                                                        data[1],
                                                        test_size=0.2,
                                                        random_state=1234)
    # all model accuracies except neural network
    for i in range(1, 5):
        model = models.classifierModel(X_train, y_train, i)
        accuracies.append(
            round(models.modelAccuracies(y_test, model, X_test), 2))

    # neural network accuracy
    model = models.classifierModel(X_train, y_train, 5)

    accuracies.append(round(model[0].history['accuracy'][0] * 100, 2))
    return {'accuracies': accuracies}
예제 #2
0
def randomForest():
    data = dataProcessing()
    X_train, X_test, y_train, y_test = train_test_split(data[0],
                                                        data[1],
                                                        test_size=0.2,
                                                        random_state=1234)
    model = models.classifierModel(X_train, y_train, 3)
    res = request.get_json()
    results = dataPrediction(res, model)
    return {'result': str(results)}
예제 #3
0
def neuralNetwork():
    data = dataProcessing()
    X_train, X_test, y_train, y_test = train_test_split(data[0],
                                                        data[1],
                                                        test_size=0.2,
                                                        random_state=1234)
    model = models.classifierModel(X_train, y_train, 5)
    res = request.get_json()
    input_pred = model[1].predict([res])
    print(input_pred)
    return {'result': str(input_pred)}