コード例 #1
0
def main(met_train, met_test, aqi_train, aqi_test, test):
    while True:
        ch = int(
            input("\n\nchose among the following classifier\n"
                  "1.Rnadom Forrest\n"
                  "2.K-NN\n"
                  "3.SVM\n"
                  "4.Decision Tree\n"
                  "5.exit\n"))
        if ch == 1:
            model, accuracy = Classifiers.Random_Forest_Classifier(
                met_train, met_test, aqi_train, aqi_test)
            print(model.predict(test))
            print(accuracy)

        elif ch == 2:
            model, accuracy = Classifiers.KNN(met_train, met_test, aqi_train,
                                              aqi_test)
            print(model.predict(test))
            print(accuracy)

        elif ch == 3:
            model, accuracy = Classifiers.SVM(met_train, met_test, aqi_train,
                                              aqi_test)
            print(model.predict(test))
            print(accuracy)
        elif ch == 4:
            model, accuracy = Classifiers.Decision_tree(
                met_train, met_test, aqi_train, aqi_test)
            print(model.predict(test))
            print(accuracy)

        elif ch == 5:
            break
コード例 #2
0
ファイル: init.py プロジェクト: pinkeshbadjatiya/weird-news
 if sys.argv[1] == "gbc":
     Traindata, TrainLabels, testdata, testlabels = convert_to_tfidf(
         Traindata, TrainLabels, testdata, testlabels)
     clf.XGBoost(Traindata, TrainLabels, testdata, testlabels)
 if sys.argv[1] == "abc":
     Traindata, TrainLabels, testdata, testlabels = convert_to_tfidf(
         Traindata, TrainLabels, testdata, testlabels)
     clf.ADABoost(Traindata, TrainLabels, testdata, testlabels)
 if sys.argv[1] == "nn":
     Traindata, TrainLabels, testdata, testlabels = convert_to_tfidf(
         Traindata, TrainLabels, testdata, testlabels)
     clf.NN(Traindata, TrainLabels, testdata, testlabels)
 if sys.argv[1] == "dt":
     Traindata, TrainLabels, testdata, testlabels = convert_to_tfidf(
         Traindata, TrainLabels, testdata, testlabels)
     clf.Decision_tree(Traindata, TrainLabels, testdata, testlabels)
 if sys.argv[1] == "automl":
     Traindata, TrainLabels, testdata, testlabels = convert_to_tfidf(
         Traindata, TrainLabels, testdata, testlabels)
     clf.autoML(Traindata, TrainLabels, testdata, testlabels)
 if sys.argv[1] == "lstm":
     Traindata, TrainLabels, testdata, testlabels, word2id_map, id2word_map = convert_to_word_embeddings(
         Traindata, TrainLabels, testdata, testlabels)
     W = get_embedding_weights("word2vec", word2id_map)
     dl_models.LSTM_train(Traindata, TrainLabels, testdata, testlabels,
                          word2id_map, W)
 if sys.argv[1] == "cnn":
     Traindata, TrainLabels, testdata, testlabels, word2id_map, id2word_map = convert_to_word_embeddings(
         Traindata, TrainLabels, testdata, testlabels)
     W = get_embedding_weights("word2vec", word2id_map)
     dl_models.CNN_train(Traindata, TrainLabels, testdata, testlabels,