{"id":19889608,"url":"https://github.com/shimazadeh/ft_logistic_regression","last_synced_at":"2026-05-30T23:31:27.048Z","repository":{"id":182874104,"uuid":"666039881","full_name":"shimazadeh/Ft_logistic_regression","owner":"shimazadeh","description":"Recreated Poudlard's Sorting Hat by implementing logistic regression from scratch. ","archived":false,"fork":false,"pushed_at":"2023-11-16T18:53:27.000Z","size":1871,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-01T04:44:19.017Z","etag":null,"topics":["batch-gradient-descent","data-science","gradient-descent","logistic-regression","one-vs-all","predictive-modeling","stochastic-gradient-descent"],"latest_commit_sha":null,"homepage":"","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/shimazadeh.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":"2023-07-13T15:08:15.000Z","updated_at":"2023-12-04T19:13:23.000Z","dependencies_parsed_at":"2023-11-16T00:36:24.611Z","dependency_job_id":"484d5053-5112-44a1-b367-f7b9a8a2526e","html_url":"https://github.com/shimazadeh/Ft_logistic_regression","commit_stats":null,"previous_names":["shimazadeh/ft_logistic_regression"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shimazadeh/Ft_logistic_regression","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimazadeh%2FFt_logistic_regression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimazadeh%2FFt_logistic_regression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimazadeh%2FFt_logistic_regression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimazadeh%2FFt_logistic_regression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shimazadeh","download_url":"https://codeload.github.com/shimazadeh/Ft_logistic_regression/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimazadeh%2FFt_logistic_regression/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33714033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"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":["batch-gradient-descent","data-science","gradient-descent","logistic-regression","one-vs-all","predictive-modeling","stochastic-gradient-descent"],"created_at":"2024-11-12T18:10:54.635Z","updated_at":"2026-05-30T23:31:27.026Z","avatar_url":"https://github.com/shimazadeh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DataScience | Logistic Regression | 42Paris\nImplement one-vs-all logistic regression that will solve classification problem: \n- Implementation of pandas.DataFrame.describe from scratch\n- Implementation of data visulazionation tools from scratch to make insights and develop an intuition of what the data looks like\n- Recreated Poudlard's Sorting Hat by implementing logistic regression from scratch.\n\n## Requirements:\n- Python 3\n- NumPy\n- Pandas\n- Matplotlib\n- Sklearn\n- Tabulate\n- Scipy\n\n## How to Run:\n\u003cpre\u003e\u003ccode\u003e\n  git clone https://github.com/shimazadeh/Ft_logistic_regression.git DSLR\n  cd DSLR\n  pip3 install -r requirements.txt\n  python main.py config.yaml: config.yaml file must include necessary information for training and testing purposes\u003c/code\u003e\u003c/pre\u003e\n\n## Implementation\nThe following sections indicates the method and results for each part of the program, note all the methods are developed from scratch:\n\n### Data Analysis\ndescribe.py is implementation of pandas.DataFrame.describe. This program takes a dataset as a parameter and it displays all the statistical \nparameters of all numerical features. See the data analysis folder for the code implementation. Here is the output of the dataset used in this project:\n\n|          | Arithmancy | Astronomy | Herbology | Defense Against the Dark Arts | Divination | Muggle Studies | Ancient Runes | History of Magi | Transfiguration | Potions | Care of Magical Creatures | Charms | Flying |\n| -------- | ----------- | -------- | -------- | -------- | ------- | -------- | ------- | ------- | ------- | ------- | ------- | -------- | ------- |\n| count | 1251 | 1251 | 1251 | 1251 | 1251 | 1251 | 1251 | 1251 | 1251 | 1251 | 1251 | 1251 | 1251 |\n| mean     | 49453.1     | 46.4764  | 1.1895   | -0.4648  | 3.2138  | -222.904 | 496.252 | 2.9786  | 1029.86 | 5.9613  | -0.0643 | -243.326 | 23.109  |\n| std      | 16701.6     | 520.946  | 5.2231   | 5.2095   | 4.111   | 484.986  | 106.711 | 4.457   | 43.9829 | 3.1029  | 0.9726  | 8.7904   | 97.755  |\n| skew     | 2.78942e+08 | 271385   | 27.2812  | 27.1385  | 16.9003 | 235211   | 11387.2 | 19.8645 | 1934.49 | 9.6281  | 0.946   | 77.2712  | 9556.04 |\n| kurtosis | -0.0525     | -0.1174  | -0.4316  | 0.1174   | -1.4067 | 0.8039   | 0.0318  | -1.0414 | -1.2183 | 0.0033  | -0.0202 | 0.3781   | 0.859   |\n| variance | 0.2119      | -1.693   | -1.3692  | -1.693   | 0.6879  | -0.7592  | -1.5902 | -0.1    | 0.1994  | -0.5513 | 0.0342  | -1.088   | -0.1605 |\n| min      | -24370      | -966.74  | -10.2957 | -10.1621 | -8.727  | -1043.96 | 283.87  | -8.4311 | 906.627 | -3.6208 | -3.3137 | -261.049 | -181.47 |\n| 25%      | 38180       | -485.323 | -4.2523  | -5.2835  | 3.1205  | -573.969 | 396.41  | 2.2309  | 1025.64 | 3.6842  | -0.6944 | -250.586 | -40.085 |\n| 50%      | 48793       | 272.072  | 3.5264   | -2.7207  | 4.621   | -419.164 | 464.328 | 4.4026  | 1045.48 | 5.8685  | -0.0651 | -244.789 | -1.92   |\n| 75%      | 60794.5     | 528.346  | 5.4637   | 4.8532   | 5.727   | 264.144  | 597.517 | 5.8939  | 1058.33 | 8.2067  | 0.5756  | -232.528 | 52.625  |\n| max      | 104956      | 1016.21  | 10.2968  | 9.6674   | 10.032  | 1092.39  | 745.396 | 11.8897 | 1094.46 | 13.5368 | 3.0565  | -225.428 | 279.07  |\n\n## Data Visualization\nThree programs that implementation of histogram, scatter plot and pair-plot library in python:\n\n| Histogram.py                                  | scatter_plot.py                               |\n|-----------------------------------------------|-----------------------------------------------|\n| Generates the histogram of the features to see the homogeneous score distribution between all four houses. | Displays a scatter plot of similar features to identify those that can be eliminated. |\n| ![Histogram Screenshot](\u003cScreen Shot 2023-11-15 at 6.40.41 PM.png\u003e) | ![Scatter Plot Screenshot](\u003cSection2-DataVisualization/_Astronomy_vs_Defense Against the Dark Arts.png\u003e) |\n\n| pair_plot.py                                                                                       |\n|----------------------------------------------------------------------------------------------------|\n| Displays a pair plot matrix of the data to identify features for the logistic regression model.  |\n| ![Pair Plot Screenshot](https://github.com/shimazadeh/Ft_logistic_regression/assets/67879533/216e4d59-4d86-4aa2-87a3-cdbe3c3e80a7) |\n\n\n\n## Training and Evaluation\nThe program is modular and can be run with different settings. Adjust the config.yml file with your speicfic parameters and feeatures. The program can be run in two different mode: training and testing:\n- Training: you must provide models parameters, the dataset and features to do the trainings in the yml file\n- Testing: this mode of the program uses the model.joblib file generated from the training phase and outputs the result in a json file. \n\nDuring training the loss of each category is printed in the terminal for each iteration. At the end of the training a confusion matrix with performance of each category is also generated in the terminal.\n\n![Alt text](\u003cScreen Shot 2023-11-15 at 6.56.11 PM.png\u003e)\n\n\n\n| Stochastic GD                                                     | Mini-Batch GD                                                     | GD                                                                |\n|-------------------------------------------------------------------|-------------------------------------------------------------------|-------------------------------------------------------------------|\n|![Alt text](\u003cSection3-Model and Training/Loss_training_SGD.png\u003e)|![Alt text](\u003cSection3-Model and Training/Loss_training_MiniGD.png\u003e)|![Alt text](\u003cSection3-Model and Training/Loss_training_GD.png\u003e)|\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshimazadeh%2Fft_logistic_regression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshimazadeh%2Fft_logistic_regression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshimazadeh%2Fft_logistic_regression/lists"}