{"id":15913033,"url":"https://github.com/x-tabdeveloping/visual-analytics-assignmen2","last_synced_at":"2025-10-06T12:35:37.228Z","repository":{"id":227827495,"uuid":"772459325","full_name":"x-tabdeveloping/visual-analytics-assignmen2","owner":"x-tabdeveloping","description":"Second Assignment for Visual Analytics in Cultural Data Science","archived":false,"fork":false,"pushed_at":"2024-05-12T14:31:05.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T21:32:25.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/x-tabdeveloping.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-03-15T08:31:01.000Z","updated_at":"2024-05-12T14:31:08.000Z","dependencies_parsed_at":"2024-10-28T14:42:13.441Z","dependency_job_id":null,"html_url":"https://github.com/x-tabdeveloping/visual-analytics-assignmen2","commit_stats":null,"previous_names":["x-tabdeveloping/visual-analytics-assignmen2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/x-tabdeveloping/visual-analytics-assignmen2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-tabdeveloping%2Fvisual-analytics-assignmen2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-tabdeveloping%2Fvisual-analytics-assignmen2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-tabdeveloping%2Fvisual-analytics-assignmen2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-tabdeveloping%2Fvisual-analytics-assignmen2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x-tabdeveloping","download_url":"https://codeload.github.com/x-tabdeveloping/visual-analytics-assignmen2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-tabdeveloping%2Fvisual-analytics-assignmen2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278613107,"owners_count":26015953,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-06T16:22:33.053Z","updated_at":"2025-10-06T12:35:37.197Z","avatar_url":"https://github.com/x-tabdeveloping.png","language":"Python","readme":"# visual-analytics-assignmen2\nSecond Assignment for Visual Analytics in Cultural Data Science.\nThis assignment is oriented at using logistic regression and multi-layer perceptrons for image classification.\n\nClassifiers were trained on the CIFAR10 dataset with all images greyscaled.\n\n## Usage\n\nInstall dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\nRun logistic regression classifier:\n\n```bash\npython3 src/logistic_regression.py\n```\n\nRun Neural Network:\n\n```bash\npython3 src/neural_network.py\n```\n\nBoth scripts will save classification reports to the `out/` folder, along with a loss curve for the neural network classifier.\n\n```\n - out/\n    - logistic_regression_report.txt\n    - neural_network_report.txt\n    - neural_network_loss_curve.txt\n```\n\n## Results\n\nBoth classifiers performed well above chance level (10% accuracy) on the unseen data.\nThe neural network performed notably better on all classes.\nThis is likely due to the fact that the feature space (pixel brightness values) is very rich and also very collinear.\nA neural network with at least one hidden layer is better able to capture interactions between individual pixels than a shallow logistic regression model.\n\nNeither models yielded satisfactory performance for production usage, and more iterations would be needed to arrive at a reliable solution.\n\nHyperparameter tuning with grid search or Bayesian optimization might provide marginally better results, but would significantly increase computational load.\nResults could likely be significantly improved by finetuning pretrained vision models or simply by using a convolutional network instead of a fully connected one,\nas CNNs are more parameter-efficient and are better able to represent spatial characteristics of images.\n \n### Logistic Regression\n\n| Class                         | Precision | Recall | F1-score | Support |\n|-------------------------------|-----------|--------|----------|---------|\n| aquatic                       | 0.31      | 0.31   | 0.31     | 1000    |\n| fish                          | 0.33      | 0.36   | 0.34     | 1000    |\n| flowers                       | 0.22      | 0.19   | 0.20     | 1000    |\n| food_containers_bottle        | 0.19      | 0.15   | 0.17     | 1000    |\n| fruit_and_vegetables          | 0.22      | 0.18   | 0.20     | 1000    |\n| household_electrical_devices  | 0.28      | 0.29   | 0.28     | 1000    |\n| household_furniture           | 0.25      | 0.26   | 0.25     | 1000    |\n| insects                       | 0.26      | 0.27   | 0.26     | 1000    |\n| large_carnivores              | 0.32      | 0.39   | 0.35     | 1000    |\n| large_man_made_outdoor_things | 0.36      | 0.42   | 0.38     | 1000    |\n| **Accuracy**                  |           |        | **0.28**| **10000**|\n| **Macro avg**                 | 0.27      | 0.28   | 0.28     | 10000   |\n| **Weighted avg**              | 0.27      | 0.28   | 0.28     | 10000   |\n\n### Multilayer Perceptron\n\n| Class                         | Precision | Recall | F1-score | Support |\n|-------------------------------|-----------|--------|----------|---------|\n| aquatic                       | 0.40      | 0.45   | 0.42     | 1000    |\n| fish                          | 0.44      | 0.45   | 0.45     | 1000    |\n| flowers                       | 0.30      | 0.30   | 0.30     | 1000    |\n| food_containers_bottle        | 0.21      | 0.22   | 0.22     | 1000    |\n| fruit_and_vegetables          | 0.28      | 0.27   | 0.28     | 1000    |\n| household_electrical_devices  | 0.35      | 0.33   | 0.34     | 1000    |\n| household_furniture           | 0.38      | 0.36   | 0.37     | 1000    |\n| insects                       | 0.42      | 0.44   | 0.43     | 1000    |\n| large_carnivores              | 0.53      | 0.47   | 0.50     | 1000    |\n| large_man_made_outdoor_things | 0.41      | 0.40   | 0.41     | 1000    |\n| **Accuracy**                  |           |        | **0.37**| **10000**|\n| **Macro avg**                 | 0.37      | 0.37   | 0.37     | 10000   |\n| **Weighted avg**              | 0.37      | 0.37   | 0.37     | 10000   |\n\n![Loss curve](out/neural_network_loss_curve.png)\n\nAs we can see from the loss curve, loss was still decreasing on the training set when training was terminated.\nThis indicates that the optimizer might not have converged at an optimal solution yet, and increasing the maximum number of iterations could result in better performance.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-tabdeveloping%2Fvisual-analytics-assignmen2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx-tabdeveloping%2Fvisual-analytics-assignmen2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-tabdeveloping%2Fvisual-analytics-assignmen2/lists"}