To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 3c25aa75 authored by Ard Kastrati's avatar Ard Kastrati
Browse files

Ran the simple classifiers: SVC, Random Forest and Gaussian Naive Bayes

parent f090705f
......@@ -43,7 +43,7 @@ def cross_validate_RFC(X, y):
cross_validate(classifier=classifier, parameters=parameters_RFC, X=X, y=y)
def cross_validate(classifier, parameters, X, y):
X = X.reshape((100, 500 * 129))
X = X.reshape((36223, 500 * 129))
clf = GridSearchCV(classifier, parameters, scoring='accuracy', n_jobs=-1, verbose=3)
clf.fit(X, y.ravel())
......@@ -58,20 +58,22 @@ def cross_validate(classifier, parameters, X, y):
def try_sklearn_classifiers(X, y):
logging.info("Training the simple classifiers: kNN, Linear SVM, Random Forest and Naive Bayes.")
names = ["Nearest Neighbors",
"Linear SVM",
names = [# "Nearest Neighbors",
# "Linear SVM",
"Random Forest",
"Naive Bayes",
"Linear SVM"
]
classifiers = [
KNeighborsClassifier(n_neighbors=5, weights='uniform', algorithm='auto', leaf_size=30, n_jobs=-1),
LinearSVC(tol=1e-5, C=1, random_state=42, max_iter=10000),
RandomForestClassifier(n_estimators=100, max_depth=5, max_features='auto', random_state=42, n_jobs=-1),
GaussianNB()
# KNeighborsClassifier(n_neighbors=5, weights='uniform', algorithm='auto', leaf_size=30, n_jobs=-1),
# LinearSVC(tol=1e-5, C=1, random_state=42, max_iter=1000),
RandomForestClassifier(n_estimators=30, max_depth=20, max_features='auto', random_state=42, n_jobs=-1),
GaussianNB(),
LinearSVC(tol=1e-3, C=5, random_state=42, max_iter=500)
]
X = X.reshape((100, 500 * 129))
X = X.reshape((36223, 500 * 129))
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.2, random_state=42)
scores = []
......@@ -98,4 +100,4 @@ def export_dict(*columns, first_row, file_name):
writer = csv.writer(f)
writer.writerow(first_row)
for row in rows:
writer.writerow(row)
\ No newline at end of file
writer.writerow(row)
......@@ -48,8 +48,8 @@ def main():
print(trainY.shape)
if config['model'] == 'simple_classifier':
# try_sklearn_classifiers(trainX, trainY)
cross_validate_kNN(trainX, trainY)
try_sklearn_classifiers(trainX, trainY)
# cross_validate_kNN(trainX, trainY)
# cross_validate_SVC(trainX, trainY)
# cross_validate_RFC(trainX, trainY)
else:
......@@ -62,4 +62,4 @@ def main():
logging.info('Finished Logging')
if __name__=='__main__':
main()
\ No newline at end of file
main()
Model,Score,Runtime
Random Forest,0.6449965493443754,18.374440908432007
Naive Bayes,0.5421670117322291,54.8563334941864
Linear SVM,0.7054520358868185,2287.276668548584
RandomForestClassifier(n_estimators=30, max_depth=20, max_features='auto', random_state=42, n_jobs=-1),
GaussianNB(),
LinearSVC(tol=1e-3, C=5, random_state=42, max_iter=500)
INFO:root:Started the Logging
INFO:root:X training loaded.
INFO:root:(129, 500, 36223)
INFO:root:y training loaded.
INFO:root:(1, 36223)
INFO:root:Setting the shapes
INFO:root:(36223, 500, 129)
INFO:root:(36223, 1)
INFO:root:Training the simple classifiers: kNN, Linear SVM, Random Forest and Naive Bayes.
INFO:root:Random Forest
INFO:root:--- Score: 0.6449965493443754
INFO:root:--- Runtime: 18.374440908432007 for seconds ---
INFO:root:Naive Bayes
INFO:root:--- Score: 0.5421670117322291
INFO:root:--- Runtime: 54.8563334941864 for seconds ---
INFO:root:Linear SVM
INFO:root:--- Score: 0.7054520358868185
INFO:root:--- Runtime: 2287.276668548584 for seconds ---
INFO:root:--- Runtime: 2564.1652948856354 seconds ---
INFO:root:Finished Logging
Sender: LSF System <lsfadmin@eu-a6-008-18>
Subject: Job 166812903: <python /cluster/home/kard/dl-project/main.py> in cluster <euler> Done
Job <python /cluster/home/kard/dl-project/main.py> was submitted from host <eu-login-28> by user <kard> in cluster <euler> at Tue Mar 23 21:37:20 2021
Job was executed on host(s) <15*eu-a6-008-18>, in queue <bigmem.24h>, as user <kard> in cluster <euler> at Tue Mar 23 21:40:02 2021
</cluster/home/kard> was used as the home directory.
</cluster/home/kard/dl-project> was used as the working directory.
Started at Tue Mar 23 21:40:02 2021
Terminated at Tue Mar 23 22:22:58 2021
Results reported at Tue Mar 23 22:22:58 2021
Your job looked like:
------------------------------------------------------------
# LSBATCH: User input
python /cluster/home/kard/dl-project/main.py
------------------------------------------------------------
Successfully completed.
Resource usage summary:
CPU time : 2859.81 sec.
Max Memory : 95877 MB
Average Memory : 89903.56 MB
Total Requested Memory : 120000.00 MB
Delta Memory : 24123.00 MB
Max Swap : -
Max Processes : 3
Max Threads : 37
Run time : 2576 sec.
Turnaround time : 2738 sec.
The output (if any) follows:
2021-03-23 21:40:04.922001: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
(36223, 500, 129)
(36223, 1)
/cluster/apps/nss/gcc-6.3.0/python/3.8.5/x86_64/lib64/python3.8/site-packages/sklearn/svm/_base.py:976: ConvergenceWarning: Liblinear failed to converge, increase the number of iterations.
warnings.warn("Liblinear failed to converge, increase "
......@@ -3,7 +3,6 @@ matplotlib.use('Agg')
import pandas as pd
from config import config
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import torch
import pandas as pd
......@@ -13,7 +12,6 @@ from subprocess import call
import operator
import shutil
sns.set_style('darkgrid')
import logging
def plot_acc(hist, output_directory, model, val=False):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment