예제 #1
0
from sklearn.naive_bayes import GaussianNB
import personal_settings
import SDK as sdk
import os

path = personal_settings.PATH
algorithm = os.path.basename(__file__).split(".py")[0]

# execute for all datasets:
for extraction_type in os.listdir(path):

    print("Starting new classification. Extraction method : " + extraction_type)
    folder = path + extraction_type + "/"

    try:
        clf = GaussianNB()
        sdk.evaluate_classifier(clf, folder, extraction_type, algorithm)
    except Exception as e:
        print(str(e))
        pass

    print("Ended extraction : " + extraction_type)
예제 #2
0
#execute for all datasets:
for extraction_type in datasets:
    print("Starting new classification. Extraction method : " +
          extraction_type)
    folder = path + extraction_type + "/"

    for weights in ['distance']:

        for n_neighbors in [3, 5, 6, 7]:

            print("Starting new classification. Extraction method : " +
                  extraction_type)
            print("weights = " + weights)

            try:
                clf = neighbors.KNeighborsClassifier(n_neighbors=n_neighbors,
                                                     n_jobs=-1,
                                                     weights=weights)
                sdk.evaluate_classifier(clf,
                                        folder,
                                        extraction_type,
                                        algorithm,
                                        suffixe="_" + str(n_neighbors) +
                                        "NN_" + weights)

            except Exception as e:
                print(str(e))
                pass

            print("Ended extraction : " + extraction_type)
예제 #3
0
algorithm = os.path.basename(__file__).split(".py")[0]
datasets = os.listdir(path)
datasets = personal_settings.LARGE_DATASETS

# execute for all datasets:
for extraction_type in datasets:
    print("Starting new classification. Extraction method : " +
          extraction_type)
    folder = path + extraction_type + "/"
    n_trees = 100

    try:
        in_clf_mlp = MLPClassifier(verbose=True,
                                   hidden_layer_sizes=300,
                                   early_stopping=True)
        in_clf_rd = ensemble.RandomForestClassifier(n_jobs=-1,
                                                    verbose=20,
                                                    n_estimators=n_trees)
        clf = OneVsRestClassifier(in_clf_mlp, n_jobs=-1)
        sdk.evaluate_classifier(clf,
                                folder,
                                extraction_type,
                                algorithm,
                                suffixe="_mlp")

    except Exception as e:
        print(str(e))
        pass

    print("Ended extraction : " + extraction_type)
예제 #4
0
import personal_settings
from sklearn import ensemble
import os
import SDK as sdk

path = personal_settings.PATH
algorithm = os.path.basename(__file__).split(".py")[0]
datasets = ["MSD-MARSYAS"]
# datasets = os.listdir(path)

for extraction_type in datasets:
    print("Starting new classification. Extraction method : " +
          extraction_type)
    folder = path + extraction_type + "/"

    try:
        for n_trees in [100]:
            clf = ensemble.RandomForestClassifier(n_jobs=-1,
                                                  verbose=20,
                                                  n_estimators=n_trees)
            sdk.evaluate_classifier(clf,
                                    folder,
                                    extraction_type,
                                    algorithm,
                                    suffixe="_" + str(n_trees) + "_trees")

    except Exception as e:
        print(str(e))
        pass
print("Ended extraction : " + extraction_type)