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

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:

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

mlgos-0.1.2-cp39-cp39-win_amd64.whl (63.6 kB view details)

Uploaded CPython 3.9Windows x86-64

File details

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

File metadata

  • Download URL: mlgos-0.1.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 63.6 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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d90225d3b79437c5173dbf8605a8eff8613fd61ead3c4112b1ced50ca9fd36ba
MD5 0ab8825386fbe9b2eb0063fcb23ce15f
BLAKE2b-256 276096eb71ead951d6b13e8164df7fc78d200a23621d08a7c07f0d3dd8eb2255

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