{"id":16420169,"url":"https://github.com/geekquad/random-forest-from-scratch","last_synced_at":"2026-05-17T04:43:39.365Z","repository":{"id":110635505,"uuid":"275434534","full_name":"geekquad/Random-Forest-from-Scratch","owner":"geekquad","description":"A basic implementation of the Random Forest Classifier from Scratch and using Seaborn to find important features.","archived":false,"fork":false,"pushed_at":"2020-06-28T20:39:50.000Z","size":51,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T05:16:29.349Z","etag":null,"topics":["iris-dataset","random-forest","random-forest-classifier","seaborn","sklearn"],"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/geekquad.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":"2020-06-27T18:51:02.000Z","updated_at":"2024-10-29T14:15:54.000Z","dependencies_parsed_at":"2023-05-18T09:45:59.843Z","dependency_job_id":null,"html_url":"https://github.com/geekquad/Random-Forest-from-Scratch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekquad%2FRandom-Forest-from-Scratch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekquad%2FRandom-Forest-from-Scratch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekquad%2FRandom-Forest-from-Scratch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geekquad%2FRandom-Forest-from-Scratch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geekquad","download_url":"https://codeload.github.com/geekquad/Random-Forest-from-Scratch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240511297,"owners_count":19813236,"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":["iris-dataset","random-forest","random-forest-classifier","seaborn","sklearn"],"created_at":"2024-10-11T07:27:07.857Z","updated_at":"2025-10-26T16:05:01.975Z","avatar_url":"https://github.com/geekquad.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Random-Forest-from-Scratch\nRandom forests is a supervised learning algorithm. It can be used both for classification and regression. It is also the most flexible and easy to use algorithm. A forest is comprised of trees. It is said that the more trees it has, the more robust a forest is. Random forests creates decision trees on randomly selected data samples, gets prediction from each tree and selects the best solution by means of voting. It also provides a pretty good indicator of the feature importance.\n\n## Working of the Algorithm\nIt works in four steps:\n- Select random samples from a given dataset.\n- Construct a decision tree for each sample and get a prediction result from each decision tree.\n- Perform a vote for each predicted result.\n- Select the prediction result with the most votes as the final prediction.\n\u003cimg src=\"https://res.cloudinary.com/dyd911kmh/image/upload/f_auto,q_auto:best/v1526467744/voting_dnjweq.jpg\"\u003e\n\u003chr\u003e \u003c/hr\u003e\n\n## Documentation of Random Forest:\n\u003ca href=\"https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html\"\u003e https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html \u003c/a\u003e\n\u003chr\u003e \u003c/hr\u003e\n\n## Parameters of the Algorithm:\n\u003cul\u003e\n  \u003cli\u003e\u003cb\u003emin_samples_split (default value = 2)\u003c/b\u003e\u003c/li\u003e\n  nodes cannot be further seperated below this value. \n  \u003cli\u003e\u003cb\u003e criterion : optional (default=”gini”)  \u003c/b\u003e\u003c/li\u003e\n  It controls how a Decision Tree decides where to split the data. \n  It is the measure of \u003cb\u003eimpurity\u003c/b\u003e in a bunch of examples. \n   This parameter allows us to use the different-different attribute selection measure. Supported criteria are “gini” for the Gini index and “entropy” for the information gain.\n  \u003cli\u003e \u003cb\u003e n_estimators(default value = 100 \u003c/b\u003e\u003c/li\u003e\n  This parameter tells is the number of trees in the forest.\n  \u003c/ul\u003e\n \u003chr\u003e   \n\n## Evaluation of the Algorithm:\n### a) Without Parameter Tuning:\n\n             precision    recall  f1-score   support\n\n          0       1.00      1.00      1.00        14\n          1       0.94      0.94      0.94        17\n          2       0.93      0.93      0.93        14\n    avg / total   0.96      0.96      0.96        45\n\n#### Accuracy: 0.9555555555555556\n### b) After Parameter Tuning:\n            precision    recall  f1-score   support\n\n          0       1.00      1.00      1.00        14\n          1       1.00      0.94      0.97        17\n          2       0.93      1.00      0.97        14\n    avg / total   0.98      0.98      0.98        45\n\n#### Accuracy: 0.9777777777777777\n\u003chr\u003e \u003c/hr\u003e\n\n## Finding Imoprtant Features using Seaborn Library:\nFinding important features or selecting features in the IRIS dataset.\n\n\u003cimg src=\"https://github.com/geekquad/Random-Forest-from-Scratch/blob/master/feature%20visualization.png\"\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeekquad%2Frandom-forest-from-scratch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeekquad%2Frandom-forest-from-scratch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeekquad%2Frandom-forest-from-scratch/lists"}