{"id":15664258,"url":"https://github.com/deep-diver/logistic-regression","last_synced_at":"2026-04-29T02:41:31.663Z","repository":{"id":82125132,"uuid":"127718106","full_name":"deep-diver/Logistic-Regression","owner":"deep-diver","description":"simple neural network without hidden layer","archived":false,"fork":false,"pushed_at":"2018-04-03T03:39:19.000Z","size":5447,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-05T06:25:30.282Z","etag":null,"topics":["logistic-regression","neural-network","numpy"],"latest_commit_sha":null,"homepage":null,"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/deep-diver.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-04-02T07:03:09.000Z","updated_at":"2019-07-15T08:05:41.000Z","dependencies_parsed_at":"2023-03-12T14:51:55.756Z","dependency_job_id":null,"html_url":"https://github.com/deep-diver/Logistic-Regression","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/deep-diver%2FLogistic-Regression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deep-diver%2FLogistic-Regression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deep-diver%2FLogistic-Regression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deep-diver%2FLogistic-Regression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deep-diver","download_url":"https://codeload.github.com/deep-diver/Logistic-Regression/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246273554,"owners_count":20750906,"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":["logistic-regression","neural-network","numpy"],"created_at":"2024-10-03T13:41:50.947Z","updated_at":"2026-04-29T02:41:26.616Z","avatar_url":"https://github.com/deep-diver.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Neural Network without hidden layer\n\nThis repository is to demonstrate a simple neural networks without hidden layers. All the functions to build the neural networks are written in numpy. The simple model takes a batch of images of cat in shape shown below figure, and then it performs prediction.\n\n![alt text](/images/capture1.png)\n\n## The flow\n### 1. **main** function\n - get the image datasets, then flatten and normalize them.\n - build and train the model\n - print out relative informations\n### 2. **model** function\n - initialize parameters by calling **initialize_with_zeros** function\n - optimize the parameters by training on the training dataset. This is done by calling **optimize** function\n - run prediction on training and testing datasets by calling **predict** function\n - return cost, predictions, updated w and b, and etc.\n### 3. **initialize_with_zeros** function\n - simply initialize the parameters, w and b\n - this is done by **numpy.zeros** function\n### 4. **optimize** function\n - iterating for the number of iterations given as a hyper-parameter\n - while iterating it calculates gradient decent and costs by calling **propagate** function. also, update the parameters, w and b with the calculated gradient decent\n - return the final values of parameters and gradient decent\n### 5. **propagate** function\n - performs calculation in the following order\n  - **sigmoid** function as the activation function on w, X, and b ![alt text](/images/activatoin.PNG)\n  - calculate the cost function J \u003cbr/\u003e![alt text](./images/cost.PNG)\n  - calculate the gradient decent on w and b\n    - ![alt text](/images/dw.PNG)\n    - ![alt text](/images/db.PNG)\n    - ![alt text](/images/capture2.png)\nreturn them\n### 6. **predict** function\n - simply running **sigmoid** function on w, X, and b. with the result of the **sigomid** function (a), it returns 0 if a \u003c= 0.5, and it returns 1 otherwise.\n### 7. **sigmoid** function\n - simply calculate and return \u003cbr/\u003e![alt text](./images/sigmoid.PNG)\n\n## Dependencies\n- **numpy**\n  - for handy matrix operations\n  - http://www.numpy.org/\n- **h5py**\n  - Pythonic interface to the HDF5 binary data format.\n  - Image dataset is stored in h5 file format.\n  - https://www.h5py.org/\n\n## Reference\n- Coursera Deeplearning.ai (by Andrew Ng.)\n  - https://www.coursera.org/learn/neural-networks-deep-learning/notebook/Zh0CU/python-basics-with-numpy-optional\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeep-diver%2Flogistic-regression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeep-diver%2Flogistic-regression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeep-diver%2Flogistic-regression/lists"}