Skip to content

Aum-Patel1234/mlcore-cpp-python

Repository files navigation

mlcore

A core Machine Learning library implemented in C++ with Python bindings via pybind11.

Overview

This repository is designed as a learning resource to understand how to implement basic ML algorithms and utilities in C++, and expose them to Python for easy experimentation. It demonstrates:

  • Writing efficient C++ code for ML tasks
  • Creating Python bindings with pybind11
  • Using CMake to build C++ extension modules for Python

Prerequisites

  • C++17 compatible compiler
  • CMake >= 4.0
  • Python 3.x
  • pybind11 (can be installed via pip: pip install pybind11)

Getting Started

  1. Clone the repository:
git clone https://github.com/yourusername/mlcore.git
cd mlcore
  1. Create a build directory:
mkdir -p cpp/build
cd cpp/build
  1. Build the project using CMake:
cmake ..
make

This will generate the Python bindings (mlcore_cpp) in the build directory.

  1. Install Python dependencies:
pip install -r requirements.txt
  1. Use in Python:
import sys
sys.path.append("cpp/build")  # path to the compiled module

import mlcore_cpp

# Example usage
log_reg = mlcore_cpp.LogisticRegression(alpha=0.01)

Notes

  • You can use the provided alias to simplify building:
alias cmk='cd cpp/build && cmake .. && make'
cmk
  • Environment variables (like build paths) are stored in .env to avoid hardcoding them in scripts.

  • For development, you can regenerate Python stubs for IDE auto-completion:

bash generate_stubs.sh

Contributing

Contributions are welcome! Please submit pull requests or open issues for bugs, suggestions, or improvements.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published