{"id":17854804,"url":"https://github.com/yoyolicoris/ml_hw3","last_synced_at":"2025-04-02T17:25:21.266Z","repository":{"id":140051788,"uuid":"114634052","full_name":"yoyolicoris/ML_HW3","owner":"yoyolicoris","description":"My implementation of homework 3 for the Machine Learning class in NCTU (course number 5088).","archived":false,"fork":false,"pushed_at":"2017-12-30T01:34:20.000Z","size":2746,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T13:14:27.685Z","etag":null,"topics":["automatic-relevance-determination","gaussian-mixture-models","gaussian-processes","k-means-clustering","kernel-methods","linear-discriminant-analysis","svm-classifier"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yoyolicoris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-18T11:38:42.000Z","updated_at":"2023-07-17T06:40:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"af4c2fd5-6bd0-4646-8077-8fdde10b4bf1","html_url":"https://github.com/yoyolicoris/ML_HW3","commit_stats":null,"previous_names":["yoyolicoris/ml_hw3"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyolicoris%2FML_HW3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyolicoris%2FML_HW3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyolicoris%2FML_HW3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyolicoris%2FML_HW3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yoyolicoris","download_url":"https://codeload.github.com/yoyolicoris/ML_HW3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246858212,"owners_count":20845255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automatic-relevance-determination","gaussian-mixture-models","gaussian-processes","k-means-clustering","kernel-methods","linear-discriminant-analysis","svm-classifier"],"created_at":"2024-10-28T01:40:42.565Z","updated_at":"2025-04-02T17:25:21.245Z","avatar_url":"https://github.com/yoyolicoris.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Homework 3 for Machine Learning\n\n## Environment\n\n* ubuntu 16.04 LTS\n* python2.7.12 (using Pycharm 2017.3)\n* extra modules: numpy, scipy, pandas, sklearn, matplotlib, prettytable\n\n## Usage of each file\n\n### Gussian Process for Regression (task 1-1)\n\nThe file [gaussian_process](gaussian_process.py) will display four gaussian process regression curve \nusing different parameters combination with exponential-quadratic kernel, and their RMS error.\n\n![](images/GP.png)\n\n```\n+----------------+---------------+---------------+\n|   parameters   |  train error  |   test error  |\n+----------------+---------------+---------------+\n|  {1, 4, 0, 0}  | 1.05224307499 | 1.29879575822 |\n|  {0, 0, 0, 1}  | 6.65758954447 | 6.74853909467 |\n|  {1, 4, 0, 5}  | 1.02884040382 |  1.2860902333 |\n| {1, 64, 10, 0} | 1.03287726411 | 1.37490152336 |\n+----------------+---------------+---------------+\n```\n\n### Automatic relevance deetermination (task 1-2)\n\nThe file [ARD_gaussian_process](ARD_gaussian_process.py) will display the parameters updating curve using ARD \nand the regression result using the optimal value compare to bayesian in the previous homework.\n\n![](images/parameters.png)\n![](images/compare.png)\n\n```\nFor ARD gaussian process\n+-------------------------------------+----------------+---------------+\n|          optimal parameters         |  train error   |   test error  |\n+-------------------------------------+----------------+---------------+\n| {3.387085, 6.0, 4.005092, 5.000385} | 0.841025010819 | 1.12727668046 |\n+-------------------------------------+----------------+---------------+\nFor bayesian linear regression\n+----------------+---------------+\n|  train error   |   test error  |\n+----------------+---------------+\n| 0.838483185841 | 1.15444532053 |\n+----------------+---------------+\n```\n\n### Support Vector Machine (task 2)\n\nThe file [svm](svm.py) will plot four differnet svm decision boundary using iris data set, which are\n\n* linear kernel with first two attribute\n* polynomial kernel (degree 2) with first two attribute\n* linear kernel with two-dimensional LDA\n* polynomial kernel (degree 2) with two-dimensional LDA\n\n![](images/svm.png)\n\n### Gaussian Mixture Model (task 3)\n\nThe file [kmeans_gmm](k-means_GMM.py) will first compute k (user defined) mean values of the input image \nand output the same image except the pixel values are scale to the nearest mean. \nThen, using these means as initial value for GMM, after perform EM algorithm, output the image \nscale to the most probable mean value.\n\noriginal image\n\n![](Dataset/Problem3/hw3_img.jpg)\n\nk-means(k = 3)\n\n![](images/k-means_3.png)\n\nGMM(k = 3)\n\n![](images/GMM_3.png)\n\nlog likelihood curve when performing EM algorithm.\n\n![](images/gmm_3_log.png)\n\nIt will also output the RGB value of the mean, like the following:\n\n```\n26 iterations for k = 3\nTime cost : 0:00:03\n+--------------------+-----+-----+-----+\n| k-means mean value |  r  |  g  |  b  |\n+--------------------+-----+-----+-----+\n|         0          | 191 | 136 |  48 |\n|         1          |  51 |  34 |  9  |\n|         2          | 208 | 201 | 176 |\n+--------------------+-----+-----+-----+\nEM finished, time cost : 0:00:39\n+----------------+-----+-----+-----+\n| GMM mean value |  r  |  g  |  b  |\n+----------------+-----+-----+-----+\n|       0        | 149 |  98 |  24 |\n|       1        |  27 |  18 |  1  |\n|       2        | 190 | 180 | 148 |\n+----------------+-----+-----+-----+\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoyolicoris%2Fml_hw3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoyolicoris%2Fml_hw3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoyolicoris%2Fml_hw3/lists"}