added main method

This commit is contained in:
Anne Lorenz 2018-09-20 10:37:18 +02:00
parent 68ba9e83cb
commit 6a8386e897
5 changed files with 45 additions and 36 deletions

View File

@ -105,18 +105,19 @@ class DecisionTree:
# sum(f1_scores_train)/float(len(f1_scores_train))))
# print()
#################################
print('# starting decision tree')
print('# ...')
if __name__ == '__main__':
file = 'classification_labelled_corrected.csv'
print('# starting decision tree')
print('# ...')
# read csv file
print('# reading dataset')
print('# ...')
file = 'classification_labelled_corrected.csv'
dataset = CsvHandler.read_csv(file)
# read csv file
print('# reading dataset')
print('# ...')
make_tree(dataset)
dataset = CsvHandler.read_csv(file)
print('# ending decision tree')
make_tree(dataset)
print('# ending decision tree')

View File

@ -159,19 +159,20 @@ class NaiveBayes:
#print metrics
print('F1 score: ', format(f1_score(y_train_test, predictions)))
#################################
print('# starting naive bayes')
print('# ...')
if __name__ == '__main__':
file = 'classification_labelled_corrected.csv'
print('# starting naive bayes')
print('# ...')
# read csv file
print('# reading dataset')
print('# ...')
file = 'classification_labelled_corrected.csv'
dataset = CsvHandler.read_csv(file)
# read csv file
print('# reading dataset')
print('# ...')
make_naive_bayes(dataset)
dataset = CsvHandler.read_csv(file)
print('#')
print('# ending naive bayes')
make_naive_bayes(dataset)
print('#')
print('# ending naive bayes')

View File

@ -16,6 +16,10 @@ graphviz==0.9
scikit_learn==0.19.2
## Installation under (UBUNTU?)
## Installation under Windows
pip install XY
## Installation under UBUNTU
apt-get install XX

View File

@ -93,8 +93,10 @@ class Requester:
columns=['Timestamp', 'Title', 'Text', 'SiteSection'])
# save csv
CsvHandler.write_csv(df, filestring)
if __name__ == '__main__':
print('# starting requester')
print('# ...')
save_articles_from_webhoseio()
print('# ending requester')
print('# starting requester')
print('# ...')
save_articles_from_webhoseio()
print('# ending requester')

21
SVM.py
View File

@ -84,18 +84,19 @@ class SVM:
print(grid.best_params_)
print()
########################
print('# starting svm')
print('# ...')
if __name__ == '__main__':
file = 'classification_labelled_corrected.csv'
print('# starting svm')
print('# ...')
# read csv file
print('# reading dataset')
print('# ...')
file = 'classification_labelled_corrected.csv'
dataset = CsvHandler.read_csv(file)
# read csv file
print('# reading dataset')
print('# ...')
make_svm(dataset)
dataset = CsvHandler.read_csv(file)
print('# ending svm')
make_svm(dataset)
print('# ending svm')