npnn


Namenpnn JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryNumPy Neural Network
upload_time2024-04-26 12:16:38
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Yang Zhang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords numpy neural network machine learning autograd
VCS
bugtrack_url
requirements npnn pandas
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # [npnn](https://pypi.org/project/npnn/)
> NumPy Neural Network

[![PyPI - Version](https://img.shields.io/pypi/v/npnn)](https://pypi.org/project/npnn/)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/npnn)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/npnn)
<!-- ![PyPI - Downloads](https://img.shields.io/pypi/dm/npnn) -->


## What's npnn?
> `npnn` is a a **torch-like** Python module for **gradient descent based machine learning** implemented with `numpy`. 

### Dependency
Basically `npnn` only depends on `numpy`(the latest version 1.26.4 is verified).

If you have CUDA devices available, then you can easily get a acceleration by installing suitable version of `cupy`.  In this case `npnn` will use `cupy` api rather than `numpy` api.

For example, my PC have CUDA v12.x (x86_64), so I use command:
```bash
pip install cupy-cuda12x
pip install npnn
```
or in short:
```bash
pip install npnn[cuda12x]
```
check [cupy documentation](https://docs.cupy.dev/en/stable/install.html#installing-cupy) for more information.


### API references

See [npnn WIKI](https://github.com/AIboy996/npnn/wiki).

### Known issues

See [npnn known-issues](https://github.com/AIboy996/npnn/wiki#known-issues).

## Work with npnn!
> Here we will construct a image classification neural network with npnn.

BTW, this is a course assignment of *DATA620004, School of Data Science, Fudan University*.

### Task
Construct and Train a neural network on [Fashion-MNIST](https://github.com/zalandoresearch/fashion-mnist) to do image classification.

- Implement gradient backpropagation algorithm by hand,you can use `numpy` but **DO NOT** use `pytorch` or `tensorflow` to do autograd.

- Submit source code including at least four parts: `model definition`, `training`, `parameters searching` and `testing`.

### Implementation

- `dataset.py`: provide Fashion MNIST dataset
- `model.py`: model definition
- `train.py`: model training
- `search.py`: parameters searching
- `test.py`: model testing
- `viz.py`: visualization
- `utils.py`: some misc function, such as `save_model`

run `search.py`, you can get a table like:

no|train_id|accuracy|hidden_size|batch_size|learning_rate|regularization|regular_strength
--|--|--|--|--|--|--|--
0|2024_0423(1713841292)|0.8306|[384]|3|0.002|None|0.0
1|2024_0423(1713845802)|0.8145|[384]|3|0.002|l2|0.1
2|2024_0423(1713849349)|0.8269|[384]|3|0.002|l2|0.01
3|2024_0423(1713853939)|0.8255|[384]|3|0.002|l2|0.005
4|2024_0423(1713857657)|0.8373|[384]|3|0.002|l2|0.001

train log file and saved model weights can be found in `./logs` and `./checkpoints` folder.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "npnn",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "numpy, neural network, machine learning, autograd",
    "author": null,
    "author_email": "Yang Zhang <mail@yangzhang.site>",
    "download_url": "https://files.pythonhosted.org/packages/75/7b/0b23417bc02775dd17b93f6562bf1bcc02a32e8d4f7d213f14eee21d4166/npnn-0.1.1.tar.gz",
    "platform": null,
    "description": "# [npnn](https://pypi.org/project/npnn/)\n> NumPy Neural Network\n\n[![PyPI - Version](https://img.shields.io/pypi/v/npnn)](https://pypi.org/project/npnn/)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/npnn)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/npnn)\n<!-- ![PyPI - Downloads](https://img.shields.io/pypi/dm/npnn) -->\n\n\n## What's npnn?\n> `npnn` is a a **torch-like** Python module for **gradient descent based machine learning** implemented with `numpy`. \n\n### Dependency\nBasically `npnn` only depends on `numpy`(the latest version 1.26.4 is verified).\n\nIf you have CUDA devices available, then you can easily get a acceleration by installing suitable version of `cupy`.  In this case `npnn` will use `cupy` api rather than `numpy` api.\n\nFor example, my PC have CUDA v12.x (x86_64), so I use command:\n```bash\npip install cupy-cuda12x\npip install npnn\n```\nor in short:\n```bash\npip install npnn[cuda12x]\n```\ncheck [cupy documentation](https://docs.cupy.dev/en/stable/install.html#installing-cupy) for more information.\n\n\n### API references\n\nSee [npnn WIKI](https://github.com/AIboy996/npnn/wiki).\n\n### Known issues\n\nSee [npnn known-issues](https://github.com/AIboy996/npnn/wiki#known-issues).\n\n## Work with npnn!\n> Here we will construct a image classification neural network with npnn.\n\nBTW, this is a course assignment of *DATA620004, School of Data Science, Fudan University*.\n\n### Task\nConstruct and Train a neural network on [Fashion-MNIST](https://github.com/zalandoresearch/fashion-mnist) to do image classification.\n\n- Implement gradient backpropagation algorithm by hand,you can use `numpy` but **DO NOT** use `pytorch` or `tensorflow` to do autograd.\n\n- Submit source code including at least four parts: `model definition`, `training`, `parameters searching` and `testing`.\n\n### Implementation\n\n- `dataset.py`: provide Fashion MNIST dataset\n- `model.py`: model definition\n- `train.py`: model training\n- `search.py`: parameters searching\n- `test.py`: model testing\n- `viz.py`: visualization\n- `utils.py`: some misc function, such as `save_model`\n\nrun `search.py`, you can get a table like:\n\nno|train_id|accuracy|hidden_size|batch_size|learning_rate|regularization|regular_strength\n--|--|--|--|--|--|--|--\n0|2024_0423(1713841292)|0.8306|[384]|3|0.002|None|0.0\n1|2024_0423(1713845802)|0.8145|[384]|3|0.002|l2|0.1\n2|2024_0423(1713849349)|0.8269|[384]|3|0.002|l2|0.01\n3|2024_0423(1713853939)|0.8255|[384]|3|0.002|l2|0.005\n4|2024_0423(1713857657)|0.8373|[384]|3|0.002|l2|0.001\n\ntrain log file and saved model weights can be found in `./logs` and `./checkpoints` folder.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Yang Zhang  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "NumPy Neural Network",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/AIboy996/npnn"
    },
    "split_keywords": [
        "numpy",
        " neural network",
        " machine learning",
        " autograd"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b72229d69a55b09caf09a789d5c2f17e40f456588bec0be543f8e010222bd2b3",
                "md5": "05b58c97a31a74d42bd28d5d48787635",
                "sha256": "c79becc4cf0305ec665459f548975a15e4fe660e7933850e5ddc6efa1cee3b93"
            },
            "downloads": -1,
            "filename": "npnn-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "05b58c97a31a74d42bd28d5d48787635",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 11097,
            "upload_time": "2024-04-26T12:16:36",
            "upload_time_iso_8601": "2024-04-26T12:16:36.926441Z",
            "url": "https://files.pythonhosted.org/packages/b7/22/29d69a55b09caf09a789d5c2f17e40f456588bec0be543f8e010222bd2b3/npnn-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "757b0b23417bc02775dd17b93f6562bf1bcc02a32e8d4f7d213f14eee21d4166",
                "md5": "fd5e999a5363793a1884400430dfdb2e",
                "sha256": "cd839ac815b4ec0b054ba0e934336822cf3ca283e4b41546bb5174a640f6dac1"
            },
            "downloads": -1,
            "filename": "npnn-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "fd5e999a5363793a1884400430dfdb2e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 12732,
            "upload_time": "2024-04-26T12:16:38",
            "upload_time_iso_8601": "2024-04-26T12:16:38.448083Z",
            "url": "https://files.pythonhosted.org/packages/75/7b/0b23417bc02775dd17b93f6562bf1bcc02a32e8d4f7d213f14eee21d4166/npnn-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-26 12:16:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AIboy996",
    "github_project": "npnn",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "npnn",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        }
    ],
    "lcname": "npnn"
}
        
Elapsed time: 0.24600s