{"id":15603314,"url":"https://github.com/victormotogna/irislogisticregression","last_synced_at":"2026-04-30T01:40:11.332Z","repository":{"id":113161004,"uuid":"161033608","full_name":"VictorMotogna/IrisLogisticRegression","owner":"VictorMotogna","description":"Iris Dataset Logistic Regression - scikit learn version \u0026 from scratch","archived":false,"fork":false,"pushed_at":"2019-01-06T13:12:51.000Z","size":8034,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-04T14:21:58.252Z","etag":null,"topics":["data-science","iris-dataset","logistic-regression","python","scikit-learn"],"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/VictorMotogna.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":"2018-12-09T11:47:43.000Z","updated_at":"2024-08-02T14:52:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"0ad2c2c5-1511-4b3b-860a-4066de8867ab","html_url":"https://github.com/VictorMotogna/IrisLogisticRegression","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"2006b7bb023e72e79176be3f5dd294bd5fb55394"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorMotogna%2FIrisLogisticRegression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorMotogna%2FIrisLogisticRegression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorMotogna%2FIrisLogisticRegression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorMotogna%2FIrisLogisticRegression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VictorMotogna","download_url":"https://codeload.github.com/VictorMotogna/IrisLogisticRegression/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246188802,"owners_count":20737754,"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":["data-science","iris-dataset","logistic-regression","python","scikit-learn"],"created_at":"2024-10-03T03:02:36.440Z","updated_at":"2026-04-30T01:40:06.307Z","avatar_url":"https://github.com/VictorMotogna.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Iris Dataset Logistic Regression\n\n## Dataset\n\n  - Iris Dataset - https://archive.ics.uci.edu/ml/datasets/iris\n  - 3 classes x 50 instances each\n  - labeled by: sepal length, sepal width, petal length, petal width\n  \n  ![alt text](https://i.imgur.com/oRACM5G.png \"Iris Dataset - sepal length/width\")\n  \n### Data set usages in this implementation\n\n  - using all 4 characteristics: \n    - sepal length, sepal width, petal length, petal width\n    - `X = iris.data[:, :4]`\n  - using only the first characteristics\n    - sepal length, sepal width\n    - `X = iris.data[:, :2]`\n  - using only `setosa` \u0026 `virginica`\n    - for __Logistic Regression__ we need to consider binary results\n    - `setosa = 0`, `virginica = 1`\n\n![alt text](https://i.imgur.com/4kqr17x.png \"Logistic Regression Dataset - sepal length/width\")\n\n## Implementations\n\n  1. Logistic Regression from scratch\n      - use a `sigmoid` function to output a result between 0 \u0026 1\n        - `return 1 / (1 + np.exp(-z))`\n      - use a loss function with parameters (weights - theta) to compute the best value for them\n        - initially pick random values\n        - `return (-y * np.log(h) - (1 - y) * np.log(1 - h)).mean()`\n      - gradient descent\n        - `gradient = np.dot(X.T, (h - y)) / y.shape[0]`\n      - predictions\n        - `def predict_probs(X, theta): return sigmoid(np.dot(X, theta))`\n  2. Logistic Regression from scikit-learn\n      - docs: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html\n      - __much faster__ than the scratch implementation\n\n## Necessary tools\n\n  - `python 3.x`\n  - `pip3`\n  - `matplotlib (pyplot)`\n  - `sklearn`\n\n## References\n  - https://medium.com/@martinpella/logistic-regression-from-scratch-in-python-124c5636b8ac\n  - https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictormotogna%2Firislogisticregression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictormotogna%2Firislogisticregression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictormotogna%2Firislogisticregression/lists"}