{"id":24300561,"url":"https://github.com/ravesandstorm/id3-python-stepwise","last_synced_at":"2026-04-16T23:39:06.873Z","repository":{"id":272332326,"uuid":"916177581","full_name":"ravesandstorm/ID3-Python-Stepwise","owner":"ravesandstorm","description":"Detailed Entropy and Information Gain Calculation for ID3 Algorithm","archived":false,"fork":false,"pushed_at":"2025-01-13T18:20:22.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T19:21:57.706Z","etag":null,"topics":["entropy","id3","id3-algorithm","information-gain","jupyter","jupyter-notebook","pandas","pandas-dataframe","pandas-library","script"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ravesandstorm.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":"2025-01-13T15:49:22.000Z","updated_at":"2025-01-13T18:25:52.000Z","dependencies_parsed_at":"2025-01-13T19:22:00.320Z","dependency_job_id":"931dfba0-dcaf-4d5e-9931-a72e02ae4e4d","html_url":"https://github.com/ravesandstorm/ID3-Python-Stepwise","commit_stats":null,"previous_names":["ravesandstorm/id3-python-stepwise"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ravesandstorm%2FID3-Python-Stepwise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ravesandstorm%2FID3-Python-Stepwise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ravesandstorm%2FID3-Python-Stepwise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ravesandstorm%2FID3-Python-Stepwise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ravesandstorm","download_url":"https://codeload.github.com/ravesandstorm/ID3-Python-Stepwise/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242213757,"owners_count":20090700,"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":["entropy","id3","id3-algorithm","information-gain","jupyter","jupyter-notebook","pandas","pandas-dataframe","pandas-library","script"],"created_at":"2025-01-16T23:14:39.982Z","updated_at":"2025-12-06T23:01:12.921Z","avatar_url":"https://github.com/ravesandstorm.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ID3-Python-Stepwise\n\n### Project Description: ID3 Algorithm Implementation in Python\n\nThis project implements the **ID3 (Iterative Dichotomiser 3)** algorithm in Python for decision tree learning. The algorithm uses entropy and information gain as metrics to build a decision tree from a dataset. This implementation provides step-by-step calculation of the entropy and information gain for better verification and understanding.\n\n---\n\n#### Major Steps:\n1. **Input Data:** The script takes a string input for column names and data rows.\n2. **Preprocessing:** The data is parsed into a DataFrame for easy manipulation and processing.\n3. **Entropy Calculation:** \n   - Calculates the overall entropy of the target variable.\n   - Calculates conditional entropy for each unique value of the input attributes.\n4. **Information Gain:** \n   - Uses the entropy values to calculate the information gain for each attribute.\n   - Outputs the formulas and intermediate steps for transparency.\n5. **Decision Tree Logic:** The attribute with the highest information gain is selected for the split.\n\n---\n\n#### How to Use:\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/ravesandstorm/ID3-Python-Stepwise.git\n   ```\n2. Open the script in your Python environment.\n3. Modify the `columns` and `data` variables to input your dataset.\n4. Run the script to view entropy and information gain calculations for all the data.\n\n---\n\n#### Example:\nGiven the following dataset:\n\n| Weather | Parents  | Cash | Exam | Decision  |\n|---------|----------|------|------|-----------|\n| sunny   | visit    | rich | yes  | cinema    |\n| windy   | no-visit | rich | no   | shopping  |\n\nThe script calculates:\n- Entropy of the dataset\n- Conditional entropy for each attribute\n- Information gain for each attribute\n\nSample output:\n```\nEntropy of Data = 0.9852 =   -(6/11)*log(6/11) - (5/11)*log(5/11)\nEntropy for 'sunny' = 0.9183 =   -(4/6)*log(4/6) - (2/6)*log(2/6)\n...\nInfo. Gain for 'Weather' = 0.1934 =  0.985 - [(6/11)*0.9183 + (5/11)*0.7222]\n```\n\n---\n\n#### Dependencies:\n- Python 3.8+\n- Pandas\n- NumPy\n- Python Math library\n\n---\n\nFeel free to contribute, report issues, or suggest improvements! 😊\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fravesandstorm%2Fid3-python-stepwise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fravesandstorm%2Fid3-python-stepwise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fravesandstorm%2Fid3-python-stepwise/lists"}