Example #1
0
def get_user_selected_model():
    user_selected_model = MultiChoice(
        "Select one of the following models:",
        options=(dispatcher.MODELS.keys()),
    )().lower()
    print("[INFO]: Selected Model: {}".format(user_selected_model))
    return user_selected_model
Example #2
0
    return accuracy


def test_pipeline(model_name, test_query):

    tester = test_model.TestModel(model_name)

    prediction = tester.predict(test_query=test_query)

    return prediction


if __name__ == "__main__":

    x_train, y_train, x_test, y_test = build_features(
        dataset_path=os.path.join(config.DATA_PATH, "raw",
                                  config.DATASET_NAME),
        split_ratio=config.TEST_SIZE,
    )

    # User's Model Choice
    user_selected_model = MultiChoice(
        "Select one of the following models:",
        options=("knn", "svm", "logisticregression", "decisiontree"),
    )().lower()

    print(train_pipeline(user_selected_model, x_train, y_train, x_test,
                         y_test))

    print(test_pipeline(user_selected_model, [[4.7, 3.2, 1.3, 0.2]]))