{"id":18436187,"url":"https://github.com/alecruces/optirice","last_synced_at":"2025-07-23T15:32:32.699Z","repository":{"id":232221548,"uuid":"783779668","full_name":"alecruces/OptiRice","owner":"alecruces","description":"Exploring optimization methods like Gradient Descent and BCGD in semi-supervised learning for rice seeds classification","archived":false,"fork":false,"pushed_at":"2024-11-13T16:05:34.000Z","size":744,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T10:57:57.666Z","etag":null,"topics":["classification","optimization-methods","semisupervised-learning"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/alecruces.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":"2024-04-08T14:55:50.000Z","updated_at":"2024-11-13T16:05:38.000Z","dependencies_parsed_at":"2024-04-10T15:33:34.624Z","dependency_job_id":"057bf56b-9062-408c-a611-77664c38261d","html_url":"https://github.com/alecruces/OptiRice","commit_stats":null,"previous_names":["alecruces/optirice"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecruces%2FOptiRice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecruces%2FOptiRice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecruces%2FOptiRice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecruces%2FOptiRice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alecruces","download_url":"https://codeload.github.com/alecruces/OptiRice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248868803,"owners_count":21174757,"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":["classification","optimization-methods","semisupervised-learning"],"created_at":"2024-11-06T06:10:42.209Z","updated_at":"2025-04-14T10:58:01.652Z","avatar_url":"https://github.com/alecruces.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gradient Descent and BCGD Methods with an Application on Rice Seeds Classification\n\n\u003e Semi-supervised learning applied to rice seeds classification, using Gradient Descent and Block Coordinate Gradient Descent (BCGD) methods for optimization.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/alecruces/OptiRice/assets/67338986/506491de-f0b0-4d6d-b6b1-a67f17ae32c9\" alt=\"opt2\" style=\"width:400px;height:auto;\"/\u003e\n\u003c/p\u003e\n\n\n##  Keywords\nOptimization Methods, Semi-Supervised Learning, Rice Seeds Classification\n\n---\n\n## Table of Contents\n\n1. [About the Project](#about-the-project)\n2. [Key Features](#key-features)\n3. [Key Results](#key-results)\n4. [Data Overview](#data-overview)\n5. [Methodology](#methodology)\n6. [Screenshots and Graphs](#screenshots-and-graphs)\n7. [Technologies Used](#technologies-used)\n8. [Setup \u0026 Installation](#setup--installation)\n9. [Usage](#usage)\n10. [Contributing](#contributing)\n11. [License](#license)\n12. [Contact](#contact)\n\n---\n\n### About the Project\n\nThis project explores semi-supervised learning using optimization methods for classifying rice seed types. We apply three optimization methods—Gradient Descent, Randomized Block Coordinate Gradient Descent (BCGD), and Gauss-Southwell BCGD—to both a synthetic dataset and a real-world rice seeds dataset. By minimizing an objective function, the study demonstrates how labeled data can guide label predictions for unlabeled instances, with performance measured in accuracy and computation time.\n\n### Key Features\n\n- **Semi-Supervised Learning**: Efficient label prediction for unlabeled data using a small set of labeled data.\n- **Optimization Techniques**: Implementation of three optimization methods with convergence analysis and performance comparison.\n- **Real-World Application**: Classification of rice seeds based on morphological attributes.\n\n### Key Results\n\n- **Convergence Behavior**: Gradient Descent converges in fewer iterations, while Gauss-Southwell BCGD is the fastest in terms of computational time.\n- **Accuracy**: Achieved approximately 70% accuracy on true labels for the real rice seeds dataset, indicating effective label assignment.\n- **Similarity Measure**: Exponential similarity (RBF kernel) yielded better performance compared to Euclidean distance for clustering.\n\n### Data Overview\n\nThis project utilizes a synthetic dataset and a real-world rice seed dataset:\n\n- **Rice Type Data Set**: [Rice Type Classification Dataset on Kaggle](https://www.kaggle.com/datasets/mssmartypants/rice-type-classification)  \n  Contains attributes of rice grains, including area, perimeter, axis lengths, eccentricity, and convex area, used for classification between Jasmine and Gonen rice types.\n\n### Methodology\n\nThe following optimization techniques were applied:\n\n- **Gradient Descent**: Basic optimization technique with convergence based on gradient computation.\n- **BCGD with Randomized Rule**: Coordinates updated based on random selection of blocks.\n- **BCGD with Gauss-Southwell Rule**: Blocks are selected based on the direction of maximum gradient magnitude.\n\nAdditional methodology aspects include:\n\n- **Similarity Measures**: RBF kernel used for calculating similarity weights between data points.\n- **Stopping Criteria**: Convergence is determined by either a set iteration limit or the magnitude of the gradient.\n\n### Screenshots and Graphs\n\n1. **Distribution of Synthetic Data (Scatter Plot)**  \n   Visualization of labeled and unlabeled points before applying the optimization methods.\n\n   \u003cp align=\"center\"\u003e\n   \u003cimg width=\"416\" alt=\"optirice_1\" src=\"https://github.com/user-attachments/assets/cb886d74-bc3e-4b38-9331-c680778b6978\"\u003e\n\n  \u003c/p\u003e\n  \nDistribution of examples for the synthetic data set before appliying optimization algorithms. Symbol + denotes unlabeled data, dotes denotes labeled data (two classes: yellow and purple.)\n\n2. **Accuracy vs. Iterations for Synthetic Data (Line Chart)**  \n   Comparison of accuracy across iterations for each optimization method on the synthetic dataset.\n\n   \u003cp align=\"center\"\u003e\n    \u003cimg width=\"633\" alt=\"optirice_acc\" src=\"https://github.com/user-attachments/assets/6a66f6f5-87cd-40fa-9544-0c45c8a9ba7f\"\u003e\n   \u003c/p\u003e\n\n Accuracy as a function of iteration number based on continuous values (left) and on loss function (right).\n\n\n3. **Distribution of Rice Seeds Data (Scatter Plot)**  \n   Shows the labeled and unlabeled distribution of rice seeds, with attributes such as eccentricity and perimeter.\n\n   \u003cp align=\"center\"\u003e\n    \u003cimg width=\"425\" alt=\"optirice_real_after\" src=\"https://github.com/user-attachments/assets/7db177d3-443a-4f99-8961-3e1500def193\"\u003e\n\n   \u003c/p\u003e\nDistribution of examples for the real data set after applying Gradient Descent algorithm. Symbol + denotes the predicted unlabeled data (now labeled with a class), dotes denotes the true unlabeled data.\n\n4. **Accuracy and Loss over Time (Line Charts)**  \n   Shows accuracy as a function of CPU time for rice seed datasets, and loss\n\n   \u003cp align=\"center\"\u003e\n    \u003cimg width=\"642\" alt=\"optirice_acc_cpu_real\" src=\"https://github.com/user-attachments/assets/1659e5f8-1130-4166-a8ed-f8be3e68c755\"\u003e\n   \u003c/p\u003e\n\n Accuracy as a function of CPU time based on continuous values (left) and on loss function (right) with a time window of 10,000 ms.\n \n   \u003cp align=\"center\"\u003e\n    \u003cimg width=\"638\" alt=\"loss_real\" src=\"https://github.com/user-attachments/assets/e4313173-fca7-48ef-b5e4-5d7c873d5d5c\"\u003e\n   \u003c/p\u003e\n\n   Loss as a function of iteration number (left) and as a function of CPU time (right) with time window of 10,000 ms.\n\n### Technologies Used\n\n\u003e 🛠️ Highlighting essential tools and libraries.\n\n- ![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge\u0026logo=python\u0026logoColor=white): Main programming language.\n- **NumPy** and **Pandas**: Data manipulation and processing.\n- **Matplotlib**: Visualization of data distribution, accuracy, and loss trends.\n\n### Setup \u0026 Installation\n\nClone the repository and install dependencies to replicate the study:\n\n```bash\n# Clone the repository\ngit clone https://github.com/username/OptiRice.git\n```\n\n\n# Navigate to the project directory\ncd OptiRice\n\n# Install dependencies\npip install -r requirements.txt\n\n### Usage\n\nThe repository includes the following files:\n\n- **`code.ipynb`**: Jupyter notebook with the complete workflow, from data loading to optimization and performance evaluation.\n- **`Report.pdf`**: Detailed report covering the methodology, convergence analysis, and findings.\n\nTo run the project, open `code.ipynb` in Jupyter Notebook or view it on [nbviewer](https://nbviewer.org/github/alecruces/OptiRice/blob/main/code.ipynb).\n\n### Contributing\n\nContributions are welcome! Please refer to the contributing guidelines for more details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecruces%2Foptirice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falecruces%2Foptirice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecruces%2Foptirice/lists"}