diff --git a/Jenkinsfile_4 b/Jenkinsfile_4 index dfd2423..7cb2e22 100644 --- a/Jenkinsfile_4 +++ b/Jenkinsfile_4 @@ -23,21 +23,9 @@ pipeline { } } } - //stage('Run Script') { - //steps { - //script { - //sh "chmod +x -R ${env.WORKSPACE}" - //sh './make_statistic.sh | tee output_statistic.txt' - // sh 'docker build . -t jhenyk/ium:latest' - // sh 'docker run jhenyk/ium:latest' - //sh 'node --version' - //} - //} - - //} stage('Archive Output') { steps { - archiveArtifacts 'testresults.txt' + archiveArtifacts 'metrics.txt' } } } diff --git a/__pycache__/train.cpython-38.pyc b/__pycache__/train.cpython-38.pyc index e6316ba..ad75a99 100644 Binary files a/__pycache__/train.cpython-38.pyc and b/__pycache__/train.cpython-38.pyc differ diff --git a/metrics.txt b/metrics.txt new file mode 100644 index 0000000..cfe1361 --- /dev/null +++ b/metrics.txt @@ -0,0 +1,4 @@ +Accuracy: 0.5466666666666666 +Precision: 0.5466666666666666 +Recall: 1.0 +F-score: 0.7068965517241379 diff --git a/test.py b/test.py index 4aa4ddb..dcedbd2 100644 --- a/test.py +++ b/test.py @@ -81,4 +81,27 @@ if __name__ == '__main__': the_file.write(f'data: {item[0][i]} \n true value: {item[1][i]} \n prediction: {item[2][i]}\n') print(f'data: {item[0][i]} \n true value: {item[1][i]} \n prediction: {item[2][i]}\n') + tp = 0 + tn = 0 + fp = 0 + fn = 0 + + for item in testdata: + for i in range(len(item)): + if int(item[1][i]) and int(item[2][i]): + tp += 1 + elif not int(item[1][i]) and not int(item[2][i]): + tn += 1 + elif not int(item[1][i]) and int(item[2][i]): + fp += 1 + elif int(item[1][i]) and not int(item[2][i]): + fn += 1 + + accuracy = (tp + tn) / (tp + tn + fp + fn) + precision = tp / (tp + fp) + recall = tp / (tp + fn) + fscore = (2 * precision * recall) / (precision + recall) + + with open('metrics.txt', 'w') as the_file: + the_file.write(f'Accuracy: {accuracy} \nPrecision: {precision} \nRecall: {recall} \nF-score: {fscore} \n') \ No newline at end of file