Skip to main content

NeuroMatrix: A Lightweight Supervised Matrix model for adaptive prediction

Project description

NeuroMatirx-LSM

NeuroMatirx-LSM is a lightweight Python package that provides a simple interface for training and using the NeuroMatrix model for supervised prediction tasks. The package is designed as a research-oriented implementation that turns the mathematical workflow from the project into a reusable Python library.

Overview

This project packages the NeuroMatrix method into an installable Python module so it can be imported and used in scripts, notebooks, and experiments. The package is intended to make the workflow easier to test, document, and publish.

The core goals of the project are:

  • Provide a clean Python API for model training and prediction.
  • Convert the NeuroMatrix research idea into reusable code.
  • Support experimentation with simple numerical datasets.
  • Make the project easier to distribute through GitHub and PyPI.

Project Structure

A typical project structure for this package is shown below:

NeuroMatirx-LSM/
├── pyproject.toml
├── README.md
├── LICENSE
├── src/
│   └── neuromatrix/
│       ├── __init__.py
│       ├── core.py
│       ├── utils.py
│       └── exceptions.py
├── tests/
│   └── test_core.py
└── examples/
    └── main.py

Folder Description

  • pyproject.toml — package metadata, dependencies, and build configuration.
  • README.md — project documentation and usage guide.
  • LICENSE — license information for the package.
  • src/neuromatrix/ — main package source code.
  • tests/ — unit tests for checking correctness.
  • examples/ — example scripts showing how to use the package.

Installation

Install locally for development

Clone the repository and install it in editable mode:

git clone https://github.com/bennyk09/NeuroMatirx-LSM.git
cd NeuroMatirx-LSM
pip install -e .

Install dependencies manually

If needed, install the required packages first:

pip install numpy

Usage

Below is a simple example of how to train and use the model.

from neuromatrix import NeuroMatrixRegressor
import numpy as np

X = np.array([
    [1.0],
    [2.0],
    [3.0],
    [4.0],
    [5.0]
], dtype=float)

y = np.array([2.0, 4.0, 6.0, 8.0, 10.0], dtype=float)

model = NeuroMatrixRegressor()
model.fit(X, y)
pred = model.predict(X)

print("Predictions:", pred)

How It Works

The package is built around the idea of turning the NeuroMatrix mathematical procedure into code that can be executed through a class-based interface. At a high level, the workflow is:

  1. Accept input data X and target data y.
  2. Normalize the values using the package's internal preprocessing logic.
  3. Apply the NeuroMatrix transformation process.
  4. Update internal parameters during fitting.
  5. Generate predictions for new or existing inputs.
  6. Return model outputs and evaluation-related values.

This makes the project easier to test and reuse than keeping the method only in standalone scripts.

Main Features

  • Clean object-oriented API.
  • Fit and predict workflow.
  • Reusable package structure.
  • Easy integration with NumPy-based datasets.
  • Suitable for research prototypes and academic experimentation.

API Design

The main object exposed by the package is expected to be:

NeuroMatrixRegressor

Typical methods:

  • fit(X, y) — train the model using input and target data.
  • predict(X) — generate predictions for input data.
  • fit_predict(X, y) — optional helper method for quick usage.

Possible attributes after training:

  • k_ — learned or updated internal parameter.
  • rms_ — root mean square error value.
  • is_fitted_ — indicates whether the model has been trained.

Example Script

A simple main.py example:

from neuromatrix import NeuroMatrixRegressor
import numpy as np

X = np.array([
    [1.0],
    [2.0],
    [3.0],
    [4.0],
    [5.0]
], dtype=float)

y = np.array([2.0, 4.0, 6.0, 8.0, 10.0], dtype=float)

model = NeuroMatrixRegressor()
model.fit(X, y)
predictions = model.predict(X)

print(predictions)

To run the script on Windows PowerShell:

python main.py

Do not type only main.py, because PowerShell does not execute files from the current folder by default.

Development Workflow

A typical development workflow for this project is:

  1. Implement package code in src/neuromatrix/.
  2. Write or update tests in tests/.
  3. Run example scripts from examples/ or the project root.
  4. Build the package:
python -m build
  1. Install locally for testing:
pip install -e .

Publishing

To publish the package using GitHub Actions and PyPI trusted publishing:

  1. Make sure pyproject.toml contains the correct project name and version.
  2. Commit and push the project to GitHub.
  3. Ensure .github/workflows/python-publish.yml exists.
  4. Create a GitHub release such as v0.1.0.
  5. Let GitHub Actions build and upload the package to PyPI.

Common Errors

PowerShell says main.py is not recognized

Use:

python main.py

instead of:

main.py

Import error for neuromatrix

Make sure the package is installed first:

pip install -e .

Invalid NumPy array syntax

This is wrong:

X = np.array(, dtype=float)

This is correct:

X = np.array([[1.0], [2.0], [3.0]], dtype=float)

Future Improvements

Potential future improvements for the project include:

  • Better validation and error handling.
  • Support for more dataset shapes.
  • Additional evaluation metrics.
  • Better examples and notebooks.
  • PyPI-ready release polishing.
  • Expanded documentation for the underlying mathematical model.

Contributing

Contributions can include code improvements, bug fixes, documentation updates, tests, and packaging enhancements.

Suggested contribution flow:

  1. Fork the repository.
  2. Create a new branch.
  3. Make changes.
  4. Test the package.
  5. Submit a pull request.

License

Add your preferred license in the LICENSE file.

Author

Project repository:

https://github.com/bennyk09/NeuroMatirx-LSM

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuromatrix_lsm-0.1.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuromatrix_lsm-0.1.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file neuromatrix_lsm-0.1.1.tar.gz.

File metadata

  • Download URL: neuromatrix_lsm-0.1.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for neuromatrix_lsm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d8abe362d05f1ab2f3c7b7af7e717d5d356d9a567277a198f4e3e80c0d9a7712
MD5 37ba02765c92dca04995239030be916b
BLAKE2b-256 68b87cd6600511b2edcbea6c27f9b1d4f1516adc56ad962566c6ac6296533fc2

See more details on using hashes here.

File details

Details for the file neuromatrix_lsm-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for neuromatrix_lsm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48fcd16d0b7876bfb28f347120f04390949b9f3b89e7ca75fece5a29ca46bc72
MD5 5df26d7f2e2e0b26593c6a29ab278b28
BLAKE2b-256 f3106c74e4c59ca05e4da59f12f535097bd8199f1b4b8f4b0cf8e8e15aafedc0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page