From 3a3e4ea379470c46428d2c87cef439d70abc31b8 Mon Sep 17 00:00:00 2001 From: Ipsit Date: Sun, 11 Oct 2020 21:01:37 +0530 Subject: [PATCH 1/3] added a grader --- .idea/.gitignore | 8 ++++++++ .idea/Hello-FOSS-ML.iml | 11 +++++++++++ .idea/inspectionProfiles/Project_Default.xml | 17 +++++++++++++++++ .idea/inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ titanic/grader.py | 15 +++++++++++++++ 8 files changed, 75 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/Hello-FOSS-ML.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 titanic/grader.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..c68de52 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/../../../../../../../:\Users\mmkip\Desktop\open-source\Hello-FOSS-ML\.idea/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/Hello-FOSS-ML.iml b/.idea/Hello-FOSS-ML.iml new file mode 100644 index 0000000..8dc09e5 --- /dev/null +++ b/.idea/Hello-FOSS-ML.iml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..e6bc2bc --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..6a2d65b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..6a2f052 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/titanic/grader.py b/titanic/grader.py new file mode 100644 index 0000000..1001e13 --- /dev/null +++ b/titanic/grader.py @@ -0,0 +1,15 @@ +import pandas as pd +import argparse +import os + +def grade(): + parser = argparse.ArgumentParser() + parser.add_argument("--path", help="Give the path of the file to be graded") + args = parser.parse_args() + data_to_be_graded = pd.read_csv(os.path.join(os.getcwd(), args.path)) + expected = pd.read_csv('./ouput.csv') + accuracy = sum(expected['Survived'].values == data_to_be_graded['Survived'].values) / len(expected) + print("Your accuracy is {}%".format(round(accuracy * 100, 2))) + +if __name__ == '__main__': + grade() \ No newline at end of file From f29ac69021f2287f0ba11f1ca2272a4765936239 Mon Sep 17 00:00:00 2001 From: Ipsit Date: Sun, 11 Oct 2020 21:11:45 +0530 Subject: [PATCH 2/3] updated README to use grader --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 40efa0b..cf66e22 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,17 @@ You can choose to do one or more of the following tasks - * [Random Forests](./Titanic%20Random%20Forest%20Tensorflow.ipynb) * [K-Nearest Neighbours](./Titanic%20KNN%20Tensorflow.ipynb) * [Gaussian Naive Bayes model](./Titanic%20GaussianNB%20Tensorflow.ipynb) - +### Validating Your Predictions +You can check your predictions by saving them as a `csv` file in the same directory +as that of `output.csv` and running the following in the terminal +```bash +~$ python grader.py --path +``` +For example, +```bash +~$ python grader.py --path gender_submission.csv +Your accuracy is 76.56% +``` # 2) MNIST and Fashion MNIST **MNIST** ("Modified National Institute of Standards and Technology") is the de facto “hello world” dataset of computer vision. Since its release in 1999, this classic dataset of handwritten images has served as the basis for benchmarking classification algorithms. As new machine learning techniques emerge, MNIST remains a reliable resource for researchers and learners alike. In fact, MNIST is often the first dataset researchers try. "If it doesn't work on MNIST, it won't work at all", they said. "Well, if it does work on MNIST, it may still fail on others." From c3981abd74026077cf158aaa3cef5f88c8e6beef Mon Sep 17 00:00:00 2001 From: Ipsit Date: Sun, 11 Oct 2020 21:12:58 +0530 Subject: [PATCH 3/3] fixed typo in the file output.csv --- titanic/grader.py | 2 +- titanic/{ouput.csv => output.csv} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename titanic/{ouput.csv => output.csv} (100%) diff --git a/titanic/grader.py b/titanic/grader.py index 1001e13..eccb936 100644 --- a/titanic/grader.py +++ b/titanic/grader.py @@ -7,7 +7,7 @@ def grade(): parser.add_argument("--path", help="Give the path of the file to be graded") args = parser.parse_args() data_to_be_graded = pd.read_csv(os.path.join(os.getcwd(), args.path)) - expected = pd.read_csv('./ouput.csv') + expected = pd.read_csv('./output.csv') accuracy = sum(expected['Survived'].values == data_to_be_graded['Survived'].values) / len(expected) print("Your accuracy is {}%".format(round(accuracy * 100, 2))) diff --git a/titanic/ouput.csv b/titanic/output.csv similarity index 100% rename from titanic/ouput.csv rename to titanic/output.csv