Skip to content

Commit

Permalink
update project
Browse files Browse the repository at this point in the history
  • Loading branch information
Tian-Qiu-988121 committed Jun 25, 2020
0 parents commit 28a78ec
Show file tree
Hide file tree
Showing 237 changed files with 321,747 additions and 0 deletions.
435 changes: 435 additions & 0 deletions .ipynb_checkpoints/Dataset Modelling-checkpoint.ipynb

Large diffs are not rendered by default.

833 changes: 833 additions & 0 deletions .ipynb_checkpoints/Evaluation-checkpoint.ipynb

Large diffs are not rendered by default.

267 changes: 267 additions & 0 deletions .ipynb_checkpoints/Evaluation_new-checkpoint.ipynb

Large diffs are not rendered by default.

785 changes: 785 additions & 0 deletions .ipynb_checkpoints/Final Question2-checkpoint.ipynb

Large diffs are not rendered by default.

821 changes: 821 additions & 0 deletions .ipynb_checkpoints/Formal Version-checkpoint.ipynb

Large diffs are not rendered by default.

742 changes: 742 additions & 0 deletions .ipynb_checkpoints/Formal Version_test again-checkpoint.ipynb

Large diffs are not rendered by default.

726 changes: 726 additions & 0 deletions .ipynb_checkpoints/Formal Version_test-checkpoint.ipynb

Large diffs are not rendered by default.

239 changes: 239 additions & 0 deletions .ipynb_checkpoints/assignment1_2020_template-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"### The University of Melbourne, School of Computing and Information Systems\n",
"# COMP30027 Machine Learning, 2020 Semester 1\n",
"\n",
"## Assignment 1: Naive Bayes Classifiers\n",
"\n",
"###### Submission deadline: 7 pm, Monday 20 Apr 2020"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Student Name(s):** `PLEASE ENTER YOUR NAME(S) HERE`\n",
"\n",
"**Student ID(s):** `PLEASE ENTER YOUR ID(S) HERE`\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This iPython notebook is a template which you will use for your Assignment 1 submission.\n",
"\n",
"Marking will be applied on the four functions that are defined in this notebook, and to your responses to the questions at the end of this notebook (Submitted in a separate PDF file).\n",
"\n",
"**NOTE: YOU SHOULD ADD YOUR RESULTS, DIAGRAMS AND IMAGES FROM YOUR OBSERVATIONS IN THIS FILE TO YOUR REPORT (the PDF file).**\n",
"\n",
"You may change the prototypes of these functions, and you may write other functions, according to your requirements. We would appreciate it if the required functions were prominent/easy to find.\n",
"\n",
"**Adding proper comments to your code is MANDATORY. **"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# This function should prepare the data by reading it from a file and converting it into a useful format for training and testing\n",
"\n",
"def preprocess():\n",
" return"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# This function should calculat prior probabilities and likelihoods from the training data and using\n",
"# them to build a naive Bayes model\n",
"\n",
"def train():\n",
" return"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# This function should predict classes for new items in a test dataset (for the purposes of this assignment, you\n",
"# can re-use the training data as a test set)\n",
"\n",
"def predict():\n",
" return"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# This function should evaliate the prediction performance by comparing your model’s class outputs to ground\n",
"# truth labels\n",
"\n",
"def evaluate():\n",
" return"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Questions \n",
"\n",
"\n",
"If you are in a group of 1, you will respond to question (1), and **one** other of your choosing (two responses in total).\n",
"\n",
"If you are in a group of 2, you will respond to question (1) and question (2), and **two** others of your choosing (four responses in total). \n",
"\n",
"A response to a question should take about 100–250 words, and make reference to the data wherever possible.\n",
"\n",
"#### NOTE: you may develope codes or functions in respond to the question, but your formal answer should be added to a separate file."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Q1\n",
"Try discretising the numeric attributes in these datasets and treating them as discrete variables in the na¨ıve Bayes classifier. You can use a discretisation method of your choice and group the numeric values into any number of levels (but around 3 to 5 levels would probably be a good starting point). Does discretizing the variables improve classification performance, compared to the Gaussian na¨ıve Bayes approach? Why or why not?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Q2\n",
"Implement a baseline model (e.g., random or 0R) and compare the performance of the na¨ıve Bayes classifier to this baseline on multiple datasets. Discuss why the baseline performance varies across datasets, and to what extent the na¨ıve Bayes classifier improves on the baseline performance."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Q3\n",
"Since it’s difficult to model the probabilities of ordinal data, ordinal attributes are often treated as either nominal variables or numeric variables. Compare these strategies on the ordinal datasets provided. Deterimine which approach gives higher classification accuracy and discuss why."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Q4\n",
"Evaluating the model on the same data that we use to train the model is considered to be a major mistake in Machine Learning. Implement a hold–out or cross–validation evaluation strategy (you should implement this yourself and do not simply call existing implementations from `scikit-learn`). How does your estimate of effectiveness change, compared to testing on the training data? Explain why. (The result might surprise you!)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Q5\n",
"Implement one of the advanced smoothing regimes (add-k, Good-Turing). Does changing the smoothing regime (or indeed, not smoothing at all) affect the effectiveness of the na¨ıve Bayes classifier? Explain why, or why not."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Q6\n",
"The Gaussian na¨ıve Bayes classifier assumes that numeric attributes come from a Gaussian distribution. Is this assumption always true for the numeric attributes in these datasets? Identify some cases where the Gaussian assumption is violated and describe any evidence (or lack thereof) that this has some effect on the NB classifier’s predictions."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
6 changes: 6 additions & 0 deletions .ipynb_checkpoints/pao.py-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit 28a78ec

Please sign in to comment.