NBCS


NameNBCS JSON
Version 1.4 PyPI version JSON
download
home_pageNone
SummaryPython package that implements an adaptive classification and regression system using simplicial complexes. The package provides a novel approach to handling both binary and multi-class classification problems, as well as regression tasks, by adaptively creating a simplicial decomposition of the feature space.
upload_time2024-12-11 08:04:42
maintainerNone
docs_urlNone
authorAmit Ronen
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NBCS (Nested barycentric coordinate system)

**Version:** 1.2  
**License:** MIT License  
**Author:** Amit Ronen
**Email:** erankfmn@gmail.com  

## Overview

NBCS (Non-Binary Classification System) is a Python package that implements an adaptive classification and regression system using simplicial complexes. The package provides a novel approach to handling both binary and multi-class classification problems, as well as regression tasks, by adaptively creating a simplicial decomposition of the feature space.

The package extends scikit-learn's base estimator and transformer interfaces, making it compatible with scikit-learn's ecosystem while providing unique capabilities for handling complex classification boundaries and non-linear regression problems.

## Features

- **Adaptive Classification:** Automatically adjusts the complexity of the decision boundary based on the data
- **Simplicial Complex Construction:** Creates an optimal decomposition of the feature space
- **Multiple Learning Modes:**
  - Barry fitting mode for general purpose learning
  - Adaptive fitting mode for classification tasks
- **Regression Support:** Handles complex regression problems with piece-wise linear approximations
- **Visualization Tools:** Built-in functions for plotting decision boundaries and regression results
- **Scikit-learn Compatible:** Implements scikit-learn's BaseEstimator and TransformerMixin interfaces

## Installation

You can install the package directly from PyPI using pip:

```bash
pip install nbcs
```

## Usage

### Classification Example

```python
import numpy as np
from nbcs import NBCS
from sklearn.svm import SVC

# Create and fit the NBCS model
model = NBCS(C=1000, k=4)
embedder = model.fit(X, y)

# Transform the data
points = embedder.transform(X)

# Use with any sklearn classifier
clf = SVC(kernel='linear')
clf.fit(points, y)
```

### Regression Example

```python
from nbcs import NBCS
from sklearn.linear_model import LinearRegression

# Create and fit the NBCS model
model = NBCS(k=3)
embedder = model.fit_barry(X)

# Transform the data
points = embedder.transform(X)

# Use with any sklearn regressor
reg = LinearRegression()
reg.fit(points, y)
```

## Parameters

- **C:** Regularization parameter (default=1)
- **k:** Number of refinement steps (default=1)

## Available Methods

- `fit(X, y)`: Fits the model using adaptive mode
- `fit_barry(X, y)`: Fits the model using barry mode
- `add_point(point)`: Adds a new point to the simplicial complex


## Visualization

The package includes several visualization tools:

```python
from nbcs.utils import make_meshgrid, plot_contours

# Create mesh grid for visualization
xx, yy = make_meshgrid(X[:, 0], X[:, 1])

# Plot decision boundaries
plot_contours(ax, clf, xx, yy, xy)
```

## Dependencies

- numpy
- scipy
- scikit-learn
- matplotlib

## Examples

### Classification with Regular Polytope

```python
import numpy as np
from nbcs import NBCS
from sklearn.svm import SVC

# Generate synthetic data
N = 1000
D = 2  # dimension
X = np.random.normal(0, 1, (N, D))
y = np.ones(N)

# Create and fit model
model = NBCS(C=1000, k=4)
embedder = model.fit(X, y)
```

### Regression with Multiple Lines

```python
import numpy as np
from nbcs import NBCS
from sklearn.linear_model import LinearRegression

# Generate synthetic data
x = np.linspace(0, 30, 60).reshape(-1, 1)
y = np.sin(x/10) + np.random.normal(0, 0.1, x.shape)

# Create and fit model
model = NBCS(k=3)
embedder = model.fit_barry(x)
```

## License

This project is licensed under the MIT License - see the LICENSE file for details.

## Acknowledgements

- scikit-learn for providing the foundational tools for machine learning in Python
- numpy and scipy for numerical computations
- matplotlib for data visualization

## Contact

If you have any questions or suggestions, feel free to reach out at erankfmn@gmail.com

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "NBCS",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Amit Ronen",
    "author_email": "erankfmn@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e2/85/4b75059597b9ad55bbed1d21238a06b69fca8c0713d4e0305e7a1ffe8bfe/NBCS-1.4.tar.gz",
    "platform": null,
    "description": "# NBCS (Nested barycentric coordinate system)\n\n**Version:** 1.2  \n**License:** MIT License  \n**Author:** Amit Ronen\n**Email:** erankfmn@gmail.com  \n\n## Overview\n\nNBCS (Non-Binary Classification System) is a Python package that implements an adaptive classification and regression system using simplicial complexes. The package provides a novel approach to handling both binary and multi-class classification problems, as well as regression tasks, by adaptively creating a simplicial decomposition of the feature space.\n\nThe package extends scikit-learn's base estimator and transformer interfaces, making it compatible with scikit-learn's ecosystem while providing unique capabilities for handling complex classification boundaries and non-linear regression problems.\n\n## Features\n\n- **Adaptive Classification:** Automatically adjusts the complexity of the decision boundary based on the data\n- **Simplicial Complex Construction:** Creates an optimal decomposition of the feature space\n- **Multiple Learning Modes:**\n  - Barry fitting mode for general purpose learning\n  - Adaptive fitting mode for classification tasks\n- **Regression Support:** Handles complex regression problems with piece-wise linear approximations\n- **Visualization Tools:** Built-in functions for plotting decision boundaries and regression results\n- **Scikit-learn Compatible:** Implements scikit-learn's BaseEstimator and TransformerMixin interfaces\n\n## Installation\n\nYou can install the package directly from PyPI using pip:\n\n```bash\npip install nbcs\n```\n\n## Usage\n\n### Classification Example\n\n```python\nimport numpy as np\nfrom nbcs import NBCS\nfrom sklearn.svm import SVC\n\n# Create and fit the NBCS model\nmodel = NBCS(C=1000, k=4)\nembedder = model.fit(X, y)\n\n# Transform the data\npoints = embedder.transform(X)\n\n# Use with any sklearn classifier\nclf = SVC(kernel='linear')\nclf.fit(points, y)\n```\n\n### Regression Example\n\n```python\nfrom nbcs import NBCS\nfrom sklearn.linear_model import LinearRegression\n\n# Create and fit the NBCS model\nmodel = NBCS(k=3)\nembedder = model.fit_barry(X)\n\n# Transform the data\npoints = embedder.transform(X)\n\n# Use with any sklearn regressor\nreg = LinearRegression()\nreg.fit(points, y)\n```\n\n## Parameters\n\n- **C:** Regularization parameter (default=1)\n- **k:** Number of refinement steps (default=1)\n\n## Available Methods\n\n- `fit(X, y)`: Fits the model using adaptive mode\n- `fit_barry(X, y)`: Fits the model using barry mode\n- `add_point(point)`: Adds a new point to the simplicial complex\n\n\n## Visualization\n\nThe package includes several visualization tools:\n\n```python\nfrom nbcs.utils import make_meshgrid, plot_contours\n\n# Create mesh grid for visualization\nxx, yy = make_meshgrid(X[:, 0], X[:, 1])\n\n# Plot decision boundaries\nplot_contours(ax, clf, xx, yy, xy)\n```\n\n## Dependencies\n\n- numpy\n- scipy\n- scikit-learn\n- matplotlib\n\n## Examples\n\n### Classification with Regular Polytope\n\n```python\nimport numpy as np\nfrom nbcs import NBCS\nfrom sklearn.svm import SVC\n\n# Generate synthetic data\nN = 1000\nD = 2  # dimension\nX = np.random.normal(0, 1, (N, D))\ny = np.ones(N)\n\n# Create and fit model\nmodel = NBCS(C=1000, k=4)\nembedder = model.fit(X, y)\n```\n\n### Regression with Multiple Lines\n\n```python\nimport numpy as np\nfrom nbcs import NBCS\nfrom sklearn.linear_model import LinearRegression\n\n# Generate synthetic data\nx = np.linspace(0, 30, 60).reshape(-1, 1)\ny = np.sin(x/10) + np.random.normal(0, 0.1, x.shape)\n\n# Create and fit model\nmodel = NBCS(k=3)\nembedder = model.fit_barry(x)\n```\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Acknowledgements\n\n- scikit-learn for providing the foundational tools for machine learning in Python\n- numpy and scipy for numerical computations\n- matplotlib for data visualization\n\n## Contact\n\nIf you have any questions or suggestions, feel free to reach out at erankfmn@gmail.com\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python package that implements an adaptive classification and regression system using simplicial complexes. The package provides a novel approach to handling both binary and multi-class classification problems, as well as regression tasks, by adaptively creating a simplicial decomposition of the feature space.",
    "version": "1.4",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4126e75d397c3ac60f2420e31a98aed811b129bec118b7a67230eab760db900a",
                "md5": "3bb94ab38e19caeae32978650916df86",
                "sha256": "7e8a69c4a310ea766152ba22a554edcf02300c31af73831c58590dbc504c7ffe"
            },
            "downloads": -1,
            "filename": "NBCS-1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3bb94ab38e19caeae32978650916df86",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4897,
            "upload_time": "2024-12-11T08:04:39",
            "upload_time_iso_8601": "2024-12-11T08:04:39.801314Z",
            "url": "https://files.pythonhosted.org/packages/41/26/e75d397c3ac60f2420e31a98aed811b129bec118b7a67230eab760db900a/NBCS-1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e2854b75059597b9ad55bbed1d21238a06b69fca8c0713d4e0305e7a1ffe8bfe",
                "md5": "b691df58e65457efd6c4bb74af32e6d1",
                "sha256": "2312d6fa8ec03a2c20e5d9ad4a040254a066e35be263dd5e3cf406a0cc2da7c7"
            },
            "downloads": -1,
            "filename": "NBCS-1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "b691df58e65457efd6c4bb74af32e6d1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4768,
            "upload_time": "2024-12-11T08:04:42",
            "upload_time_iso_8601": "2024-12-11T08:04:42.474827Z",
            "url": "https://files.pythonhosted.org/packages/e2/85/4b75059597b9ad55bbed1d21238a06b69fca8c0713d4e0305e7a1ffe8bfe/NBCS-1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-11 08:04:42",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "nbcs"
}
        
Elapsed time: 0.85051s