Skip to main content

A C++ linear regression extension using pybind11

Project description

mlgos

A C++ Linear Regression library with Python bindings using pybind11.

Overview

mlgos is a lightweight, high-performance linear regression implementation in C++.
It exposes a Python interface via pybind11, enabling seamless integration with Python workflows.
This library serves as a foundation to build and add more machine learning models in C++ with Python bindings.

Features

  • Fit linear regression models to data
  • Get slope and intercept coefficients
  • Predict values for new inputs
  • Easily extendable for additional models

Installation

Build from source using CMake and Visual Studio (Windows):

git clone https://github.com/yourusername/mlgos.git
cd mlgos
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release

The compiled Python extension will be available as a .pyd file inside the build/Release directory.

## Usage

```python
import mlgos

model = mlgos.LinearRegression()
X = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]

model.fit(X, y)
print("Slope:", model.get_slope())
print("Intercept:", model.get_intercept())

predictions = model.predict([6, 7])
print("Predictions:", predictions)

## Testing

To test the Linear Regression model, run the test script:

```bash
python test_linear_regression.py


If you want, I can help you add sample test script content or anything else!

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

mlgos-0.1.1.tar.gz (3.3 MB view details)

Uploaded Source

Built Distribution

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

mlgos-0.1.1-cp39-cp39-win_amd64.whl (2.4 kB view details)

Uploaded CPython 3.9Windows x86-64

File details

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

File metadata

  • Download URL: mlgos-0.1.1.tar.gz
  • Upload date:
  • Size: 3.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for mlgos-0.1.1.tar.gz
Algorithm Hash digest
SHA256 918ee92233fb0c45e1bd690d611e1c2d4376b716412d4efc08160142af753817
MD5 89857d94c834b09f266b5be6875f9030
BLAKE2b-256 f9c017c4ef250dc2a3957c3df26ba89312758e07267e0bc46fcc9af64ac7ff78

See more details on using hashes here.

File details

Details for the file mlgos-0.1.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: mlgos-0.1.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for mlgos-0.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d4675a386bb8b1ed3dde0d23afee2f029ec24679f20bd2e06c37fee0caa78783
MD5 39f8ee57efcb874dda4cd53cebd9dabc
BLAKE2b-256 40153a4bb5145ea7f9b4e898743bad529aad9422dbe4784d1f69140ec4566b9e

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