recsys_lite


Namerecsys_lite JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
Summary๐Ÿ”ฅ Lightweight recommender for teaching and small-scale production
upload_time2025-07-17 06:49:25
maintainerNone
docs_urlNone
authorSimbarashe Timire
requires_python<3.14,>=3.9
licenseMIT
keywords recommender-system svd numpy machine-learning collaborative-filtering education
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![CI](https://github.com/Lunexa-AI/recsys-lite/actions/workflows/ci.yml/badge.svg)](https://github.com/Lunexa-AI/recsys-lite/actions)
[![Python](https://img.shields.io/badge/python->=3.9-blue.svg)](https://python.org)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI version](https://img.shields.io/pypi/v/recsys-lite.svg)](https://pypi.org/project/recsys-lite/)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://pre-commit.com/)

**Lightweight recommender for teaching and small-scale production.**

## Why recsys-lite?

**recsys-lite** is a small, teach-first recommender toolkit that runs in constrained environments and scales to real data. Use it from the CLI or Python to load interaction data, train classic recommenders, evaluate, and export results reproducibly.

### Highlights

- **Teachโ€‘first UX** โ€“ Interactive CLI, instructor notes, and Jupyter demos so classes and workshops can get handsโ€‘on quickly.
- **Solid data handling** โ€“ Validates schema, tolerates missing / malformed rows, supports dense or sparse input, and streams large CSV/Parquet files in chunks.
- **Runs small** โ€“ Minimal deps; installs under ~50โ€ฏMB* and trains sample models in <2โ€ฏGB RAM; works offline once wheels are cached.
- **Multiple algorithms** โ€“ SVD, implicit ALS, cosine KNN, global & perโ€‘user bias, plus pluggable metrics and topโ€‘N recommenders.
- **CLI โ‡„ API parity** โ€“ Same operations available programmatically and via `recsys-lite` commands; good for CI and teaching.
- **Reproducible deploy** โ€“ Docker image and `serve` command expose a REST endpoint for scoring & topโ€‘N; versioned model artifacts.
- **Docs & examples** โ€“ Notebooks, educator guides, and generated API reference for fast onboarding.

---

## ๐Ÿš€ Getting Started

### Installation

```bash
pip install recsys_lite
```

Offline: See guide below.

### Quick Example

```python
import numpy as np
from recsys_lite import svd_reconstruct, top_n

ratings = np.array([[5, 3, 0, 1], [0, 0, 4, 5]], dtype=np.float32)
reconstructed = svd_reconstruct(ratings, k=2)
recommendations = top_n(reconstructed, ratings, n=2)
print(recommendations)
```

CLI: `recsys --help`

## ๐ŸŽ“ For Educators & Students

Teach recommendation systems without fancy hardware.

- **Interactive Mode**: `recsys teach --concept svd` (prompts, examples)
- **Notebooks**: `examples/svd_math_demo.ipynb` (math breakdowns, plots)
- **Low-Resource Demos**: Generate data and run in <1s

Full guide: [docs/educator_guide.md](docs/educator_guide.md)

## ๐Ÿš€ For Small App Deployers

Build production recommenders for <10k users/items.

- **Deploy API**: `recsys deploy model.pkl`
- **Offline Install**: Download wheel, install via USB
- **Resource Efficient**: Sparse matrices for low memory

Examples: Library book recommender, local e-commerce.

Full guide: [docs/deployment_guide.md](docs/deployment_guide.md)

## ๐Ÿ› ๏ธ For Developers

Extend or contribute easily.

- **API**: Clean, typed functions (svd_reconstruct, RecommenderSystem)
- **Contributing**: `make dev` setup, tests, linting
- **Benchmarks**: `recsys benchmark`

See [CONTRIBUTING.md](CONTRIBUTING.md) and [API Reference](#๐Ÿ”ง-api-reference).

### ML Tooling Examples

**ALS (Implicit Feedback)**:
```python
from recsys_lite import RecommenderSystem
ratings = np.array([[1, 0, 1], [0, 1, 0]], dtype=np.float32)  # binary implicit
model = RecommenderSystem(algorithm="als")
model.fit(ratings, k=2)
preds = model.predict(ratings)
```

**KNN (Cosine Similarity)**:
```python
from recsys_lite import RecommenderSystem
ratings = np.array([[5, 3, 0], [0, 0, 4]], dtype=np.float32)
model = RecommenderSystem(algorithm="knn")
model.fit(ratings, k=2)
preds = model.predict(ratings)
```

**Bias Handling (SVD)**:
```python
from recsys_lite import RecommenderSystem
ratings = np.array([[5, 3, 0], [0, 0, 4]], dtype=np.float32)
model = RecommenderSystem(algorithm="svd")
model.fit(ratings, k=2)
preds = model.predict(ratings)  # Includes global/user/item bias
```

**Chunked SVD**:
```python
from recsys_lite import svd_reconstruct
large_mat = np.random.rand(10000, 500)
reconstructed = svd_reconstruct(large_mat, k=10, use_sparse=True)
```

**Metrics**:
```python
recs = [[1,2,3], [4,5]]
actual = [{1,3}, {4,6}]
print(precision_at_k(recs, actual, 3))
print(recall_at_k(recs, actual, 3))
print(ndcg_at_k(recs, actual, 3))
```

**CV Split**:
```python
train, test = train_test_split_ratings(mat, test_size=0.2)
```

**Pipeline**:
```python
from recsys_lite import RecsysPipeline, RecommenderSystem
pipe = RecsysPipeline([('model', RecommenderSystem())])
pipe.fit(mat, k=2)
recs = pipe.recommend(mat, n=3)
```

**Grid Search**:
```python
result = grid_search_k(mat, [2,4], 'rmse')
print(result['best_k'])
```

Full details in API Reference.

## ๐Ÿ“š Use Cases

### Education
- **University courses**: Teach recommendation systems without expensive infrastructure
- **Self-learning**: Students can run everything on personal laptops
- **Workshops**: Quick demos that work offline
- **Research**: Simple baseline implementation for papers

### Small-Scale Production
- **School library**: Recommend books to students (500 books, 200 students)
- **Local business**: Product recommendations for small e-commerce
- **Community app**: Match local services to residents
- **Personal projects**: Add recommendations to your blog or app

### Development
- **Prototyping**: Test recommendation ideas quickly
- **Learning**: Understand SVD by reading clean, documented code
- **Benchmarking**: Compare against simple, fast baseline
- **Integration**: Easy to embed in larger systems

---

## ๐Ÿ“ˆ Performance

### Resource Usage

Designed for resource-constrained environments:

| Dataset Size | RAM Usage | Time (old laptop) | Time (modern PC) |
|--------------|-----------|-------------------|------------------|
| 100 ร— 50     | < 10 MB   | < 0.1s           | < 0.01s         |
| 1K ร— 1K      | < 50 MB   | < 1s             | < 0.1s          |
| 10K ร— 5K     | < 500 MB  | < 10s            | < 2s            |

### Tested On
- 10-year-old laptops (Core i3, 2GB RAM)
- Raspberry Pi 4
- Modern workstations
- Cloud containers (minimal resources)

### Memory Efficiency
- **Sparse matrix support**: Handles 90% sparse data efficiently
- **Chunked processing**: Works with limited RAM
- **Minimal dependencies**: ~50MB total install size

## ๐Ÿ”ง API Reference

### Core Functions

```python
def svd_reconstruct(
    mat: FloatMatrix,
    *,
    k: Optional[int] = None,
    random_state: Optional[int] = None,
    use_sparse: bool = True,
) -> FloatMatrix:
    """Truncated SVD reconstruction for collaborative filtering. Supports chunked processing for large matrices."""

def top_n(
    est: FloatMatrix,
    known: FloatMatrix,
    *,
    n: int = 10
) -> np.ndarray:
    """Get top-N items for each user, excluding known items."""

def compute_rmse(predictions: FloatMatrix, actual: FloatMatrix) -> float:
    """Compute Root Mean Square Error between predictions and actual ratings."""

def compute_mae(predictions: FloatMatrix, actual: FloatMatrix) -> float:
    """Compute Mean Absolute Error between predictions and actual ratings."""
```

### I/O Functions

```python
def load_ratings(
    path: Union[str, Path],
    *,
    format: Optional[str] = None,
    sparse_format: bool = False,
    **kwargs: Any,
) -> FloatMatrix:
    """Load matrix from file with format detection."""

def save_ratings(
    matrix: Union[FloatMatrix, sparse.csr_matrix],
    path: Union[str, Path],
    *,
    format: Optional[str] = None,
    show_progress: bool = True,
    **kwargs: Any,
) -> None:
    """Save rating matrix with automatic format detection."""

def create_sample_ratings(
    n_users: int = 100,
    n_items: int = 50,
    sparsity: float = 0.8,
    rating_range: tuple[float, float] = (1.0, 5.0),
    random_state: Optional[int] = None,
    sparse_format: bool = False,
) -> Union[FloatMatrix, sparse.csr_matrix]:
    """Create a sample rating matrix for testing."""
```

### RecommenderSystem Class

```python
class RecommenderSystem:
    """Production-ready recommender system with model persistence. Supports SVD, ALS (implicit), and KNN algorithms, with bias handling."""

    def __init__(self, algorithm: str = "svd", ...):
        """algorithm: 'svd', 'als', or 'knn'"""
    def fit(self, ratings: FloatMatrix, k: Optional[int] = None) -> "RecommenderSystem":
        """Fit the model to training data."""
    def predict(self, ratings: FloatMatrix) -> FloatMatrix:
        """Generate predictions for the input matrix."""
    def recommend(self, ratings: FloatMatrix, n: int = 10, exclude_rated: bool = True) -> np.ndarray:
        """Generate top-N recommendations for each user."""
    def save(self, path: str) -> None:
        """Save model to file using secure joblib serialization."""
    @classmethod
    def load(cls, path: str) -> "RecommenderSystem":
        """Load model from file."""
```

## ๐Ÿงฉ Real-World Usage Examples

### Using with Pandas

```python
import pandas as pd
from recsys_lite import svd_reconstruct, top_n

# Load ratings from a DataFrame
ratings_df = pd.read_csv('ratings.csv', index_col=0)
ratings = ratings_df.values.astype(float)

# SVD recommendations
reconstructed = svd_reconstruct(ratings, k=20)
recommendations = top_n(reconstructed, ratings, n=5)
print(recommendations)
```

### Integrating in a Web App (FastAPI Example)

```python
from fastapi import FastAPI
from recsys_lite import svd_reconstruct, top_n
import numpy as np

app = FastAPI()
ratings = np.load('ratings.npy')
reconstructed = svd_reconstruct(ratings, k=10)

@app.get('/recommend/{user_id}')
def recommend(user_id: int, n: int = 5):
    recs = top_n(reconstructed, ratings, n=n)
    return {"user_id": user_id, "recommendations": recs[user_id].tolist()}
```

## ๐Ÿ“š Use Cases

### Education
- **University courses**: Teach recommendation systems without expensive infrastructure
- **Self-learning**: Students can run everything on personal laptops
- **Workshops**: Quick demos that work offline
- **Research**: Simple baseline implementation for papers

### Small-Scale Production
- **School library**: Recommend books to students (500 books, 200 students)
- **Local business**: Product recommendations for small e-commerce
- **Community app**: Match local services to residents
- **Personal projects**: Add recommendations to your blog or app

### Development
- **Prototyping**: Test recommendation ideas quickly
- **Learning**: Understand SVD by reading clean, documented code
- **Benchmarking**: Compare against simple, fast baseline
- **Integration**: Easy to embed in larger systems

---

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](../LICENSE) file for details.

## ๐Ÿ™ Acknowledgments

- **NumPy/SciPy**: Core numerical computing
- **Numba**: JIT compilation for performance
- **Rich**: Beautiful terminal interface
- **Typer**: Modern CLI framework

---

> **"Fast, secure, and production-ready recommender systems for everyone."**

## ๐Ÿ—“๏ธ Deprecation Policy

We strive to maintain backward compatibility and provide clear deprecation warnings. Deprecated features will:
- Be marked in the documentation and code with a warning.
- Remain available for at least one minor release cycle.
- Be removed only after clear notice in the changelog and release notes.

If you rely on a feature that is marked for deprecation, please open an issue to discuss migration strategies.

## ๐Ÿ‘ฉโ€๐Ÿ’ป Developer Quickstart

To get started as a contributor or to simulate CI locally:

```sh
# 1. Set up your full dev environment (Poetry, pre-commit, all dev deps)
make dev

# 2. Run all linters
make lint

# 3. Run all tests with coverage
make test

# 4. Run all pre-commit hooks
make precommit

# 5. Build the Docker image
make docker-build

# 6. Run tests inside Docker (as CI does)
make docker-test

# 7. Simulate the full CI pipeline (lint, test, coverage, Docker)
make ci
```

<!-- Trigger CI: workflow file updated -->

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "recsys_lite",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>=3.9",
    "maintainer_email": null,
    "keywords": "recommender-system, svd, numpy, machine-learning, collaborative-filtering, education",
    "author": "Simbarashe Timire",
    "author_email": "stimire92@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/15/a7/3255907bb0d002d23014ff3be938282de0ce32959f2f148b05cf1302927b/recsys_lite-1.0.0.tar.gz",
    "platform": null,
    "description": "\n[![CI](https://github.com/Lunexa-AI/recsys-lite/actions/workflows/ci.yml/badge.svg)](https://github.com/Lunexa-AI/recsys-lite/actions)\n[![Python](https://img.shields.io/badge/python->=3.9-blue.svg)](https://python.org)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI version](https://img.shields.io/pypi/v/recsys-lite.svg)](https://pypi.org/project/recsys-lite/)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://pre-commit.com/)\n\n**Lightweight recommender for teaching and small-scale production.**\n\n## Why recsys-lite?\n\n**recsys-lite** is a small, teach-first recommender toolkit that runs in constrained environments and scales to real data. Use it from the CLI or Python to load interaction data, train classic recommenders, evaluate, and export results reproducibly.\n\n### Highlights\n\n- **Teach\u2011first UX** \u2013 Interactive CLI, instructor notes, and Jupyter demos so classes and workshops can get hands\u2011on quickly.\n- **Solid data handling** \u2013 Validates schema, tolerates missing / malformed rows, supports dense or sparse input, and streams large CSV/Parquet files in chunks.\n- **Runs small** \u2013 Minimal deps; installs under ~50\u202fMB* and trains sample models in <2\u202fGB RAM; works offline once wheels are cached.\n- **Multiple algorithms** \u2013 SVD, implicit ALS, cosine KNN, global & per\u2011user bias, plus pluggable metrics and top\u2011N recommenders.\n- **CLI \u21c4 API parity** \u2013 Same operations available programmatically and via `recsys-lite` commands; good for CI and teaching.\n- **Reproducible deploy** \u2013 Docker image and `serve` command expose a REST endpoint for scoring & top\u2011N; versioned model artifacts.\n- **Docs & examples** \u2013 Notebooks, educator guides, and generated API reference for fast onboarding.\n\n---\n\n## \ud83d\ude80 Getting Started\n\n### Installation\n\n```bash\npip install recsys_lite\n```\n\nOffline: See guide below.\n\n### Quick Example\n\n```python\nimport numpy as np\nfrom recsys_lite import svd_reconstruct, top_n\n\nratings = np.array([[5, 3, 0, 1], [0, 0, 4, 5]], dtype=np.float32)\nreconstructed = svd_reconstruct(ratings, k=2)\nrecommendations = top_n(reconstructed, ratings, n=2)\nprint(recommendations)\n```\n\nCLI: `recsys --help`\n\n## \ud83c\udf93 For Educators & Students\n\nTeach recommendation systems without fancy hardware.\n\n- **Interactive Mode**: `recsys teach --concept svd` (prompts, examples)\n- **Notebooks**: `examples/svd_math_demo.ipynb` (math breakdowns, plots)\n- **Low-Resource Demos**: Generate data and run in <1s\n\nFull guide: [docs/educator_guide.md](docs/educator_guide.md)\n\n## \ud83d\ude80 For Small App Deployers\n\nBuild production recommenders for <10k users/items.\n\n- **Deploy API**: `recsys deploy model.pkl`\n- **Offline Install**: Download wheel, install via USB\n- **Resource Efficient**: Sparse matrices for low memory\n\nExamples: Library book recommender, local e-commerce.\n\nFull guide: [docs/deployment_guide.md](docs/deployment_guide.md)\n\n## \ud83d\udee0\ufe0f For Developers\n\nExtend or contribute easily.\n\n- **API**: Clean, typed functions (svd_reconstruct, RecommenderSystem)\n- **Contributing**: `make dev` setup, tests, linting\n- **Benchmarks**: `recsys benchmark`\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) and [API Reference](#\ud83d\udd27-api-reference).\n\n### ML Tooling Examples\n\n**ALS (Implicit Feedback)**:\n```python\nfrom recsys_lite import RecommenderSystem\nratings = np.array([[1, 0, 1], [0, 1, 0]], dtype=np.float32)  # binary implicit\nmodel = RecommenderSystem(algorithm=\"als\")\nmodel.fit(ratings, k=2)\npreds = model.predict(ratings)\n```\n\n**KNN (Cosine Similarity)**:\n```python\nfrom recsys_lite import RecommenderSystem\nratings = np.array([[5, 3, 0], [0, 0, 4]], dtype=np.float32)\nmodel = RecommenderSystem(algorithm=\"knn\")\nmodel.fit(ratings, k=2)\npreds = model.predict(ratings)\n```\n\n**Bias Handling (SVD)**:\n```python\nfrom recsys_lite import RecommenderSystem\nratings = np.array([[5, 3, 0], [0, 0, 4]], dtype=np.float32)\nmodel = RecommenderSystem(algorithm=\"svd\")\nmodel.fit(ratings, k=2)\npreds = model.predict(ratings)  # Includes global/user/item bias\n```\n\n**Chunked SVD**:\n```python\nfrom recsys_lite import svd_reconstruct\nlarge_mat = np.random.rand(10000, 500)\nreconstructed = svd_reconstruct(large_mat, k=10, use_sparse=True)\n```\n\n**Metrics**:\n```python\nrecs = [[1,2,3], [4,5]]\nactual = [{1,3}, {4,6}]\nprint(precision_at_k(recs, actual, 3))\nprint(recall_at_k(recs, actual, 3))\nprint(ndcg_at_k(recs, actual, 3))\n```\n\n**CV Split**:\n```python\ntrain, test = train_test_split_ratings(mat, test_size=0.2)\n```\n\n**Pipeline**:\n```python\nfrom recsys_lite import RecsysPipeline, RecommenderSystem\npipe = RecsysPipeline([('model', RecommenderSystem())])\npipe.fit(mat, k=2)\nrecs = pipe.recommend(mat, n=3)\n```\n\n**Grid Search**:\n```python\nresult = grid_search_k(mat, [2,4], 'rmse')\nprint(result['best_k'])\n```\n\nFull details in API Reference.\n\n## \ud83d\udcda Use Cases\n\n### Education\n- **University courses**: Teach recommendation systems without expensive infrastructure\n- **Self-learning**: Students can run everything on personal laptops\n- **Workshops**: Quick demos that work offline\n- **Research**: Simple baseline implementation for papers\n\n### Small-Scale Production\n- **School library**: Recommend books to students (500 books, 200 students)\n- **Local business**: Product recommendations for small e-commerce\n- **Community app**: Match local services to residents\n- **Personal projects**: Add recommendations to your blog or app\n\n### Development\n- **Prototyping**: Test recommendation ideas quickly\n- **Learning**: Understand SVD by reading clean, documented code\n- **Benchmarking**: Compare against simple, fast baseline\n- **Integration**: Easy to embed in larger systems\n\n---\n\n## \ud83d\udcc8 Performance\n\n### Resource Usage\n\nDesigned for resource-constrained environments:\n\n| Dataset Size | RAM Usage | Time (old laptop) | Time (modern PC) |\n|--------------|-----------|-------------------|------------------|\n| 100 \u00d7 50     | < 10 MB   | < 0.1s           | < 0.01s         |\n| 1K \u00d7 1K      | < 50 MB   | < 1s             | < 0.1s          |\n| 10K \u00d7 5K     | < 500 MB  | < 10s            | < 2s            |\n\n### Tested On\n- 10-year-old laptops (Core i3, 2GB RAM)\n- Raspberry Pi 4\n- Modern workstations\n- Cloud containers (minimal resources)\n\n### Memory Efficiency\n- **Sparse matrix support**: Handles 90% sparse data efficiently\n- **Chunked processing**: Works with limited RAM\n- **Minimal dependencies**: ~50MB total install size\n\n## \ud83d\udd27 API Reference\n\n### Core Functions\n\n```python\ndef svd_reconstruct(\n    mat: FloatMatrix,\n    *,\n    k: Optional[int] = None,\n    random_state: Optional[int] = None,\n    use_sparse: bool = True,\n) -> FloatMatrix:\n    \"\"\"Truncated SVD reconstruction for collaborative filtering. Supports chunked processing for large matrices.\"\"\"\n\ndef top_n(\n    est: FloatMatrix,\n    known: FloatMatrix,\n    *,\n    n: int = 10\n) -> np.ndarray:\n    \"\"\"Get top-N items for each user, excluding known items.\"\"\"\n\ndef compute_rmse(predictions: FloatMatrix, actual: FloatMatrix) -> float:\n    \"\"\"Compute Root Mean Square Error between predictions and actual ratings.\"\"\"\n\ndef compute_mae(predictions: FloatMatrix, actual: FloatMatrix) -> float:\n    \"\"\"Compute Mean Absolute Error between predictions and actual ratings.\"\"\"\n```\n\n### I/O Functions\n\n```python\ndef load_ratings(\n    path: Union[str, Path],\n    *,\n    format: Optional[str] = None,\n    sparse_format: bool = False,\n    **kwargs: Any,\n) -> FloatMatrix:\n    \"\"\"Load matrix from file with format detection.\"\"\"\n\ndef save_ratings(\n    matrix: Union[FloatMatrix, sparse.csr_matrix],\n    path: Union[str, Path],\n    *,\n    format: Optional[str] = None,\n    show_progress: bool = True,\n    **kwargs: Any,\n) -> None:\n    \"\"\"Save rating matrix with automatic format detection.\"\"\"\n\ndef create_sample_ratings(\n    n_users: int = 100,\n    n_items: int = 50,\n    sparsity: float = 0.8,\n    rating_range: tuple[float, float] = (1.0, 5.0),\n    random_state: Optional[int] = None,\n    sparse_format: bool = False,\n) -> Union[FloatMatrix, sparse.csr_matrix]:\n    \"\"\"Create a sample rating matrix for testing.\"\"\"\n```\n\n### RecommenderSystem Class\n\n```python\nclass RecommenderSystem:\n    \"\"\"Production-ready recommender system with model persistence. Supports SVD, ALS (implicit), and KNN algorithms, with bias handling.\"\"\"\n\n    def __init__(self, algorithm: str = \"svd\", ...):\n        \"\"\"algorithm: 'svd', 'als', or 'knn'\"\"\"\n    def fit(self, ratings: FloatMatrix, k: Optional[int] = None) -> \"RecommenderSystem\":\n        \"\"\"Fit the model to training data.\"\"\"\n    def predict(self, ratings: FloatMatrix) -> FloatMatrix:\n        \"\"\"Generate predictions for the input matrix.\"\"\"\n    def recommend(self, ratings: FloatMatrix, n: int = 10, exclude_rated: bool = True) -> np.ndarray:\n        \"\"\"Generate top-N recommendations for each user.\"\"\"\n    def save(self, path: str) -> None:\n        \"\"\"Save model to file using secure joblib serialization.\"\"\"\n    @classmethod\n    def load(cls, path: str) -> \"RecommenderSystem\":\n        \"\"\"Load model from file.\"\"\"\n```\n\n## \ud83e\udde9 Real-World Usage Examples\n\n### Using with Pandas\n\n```python\nimport pandas as pd\nfrom recsys_lite import svd_reconstruct, top_n\n\n# Load ratings from a DataFrame\nratings_df = pd.read_csv('ratings.csv', index_col=0)\nratings = ratings_df.values.astype(float)\n\n# SVD recommendations\nreconstructed = svd_reconstruct(ratings, k=20)\nrecommendations = top_n(reconstructed, ratings, n=5)\nprint(recommendations)\n```\n\n### Integrating in a Web App (FastAPI Example)\n\n```python\nfrom fastapi import FastAPI\nfrom recsys_lite import svd_reconstruct, top_n\nimport numpy as np\n\napp = FastAPI()\nratings = np.load('ratings.npy')\nreconstructed = svd_reconstruct(ratings, k=10)\n\n@app.get('/recommend/{user_id}')\ndef recommend(user_id: int, n: int = 5):\n    recs = top_n(reconstructed, ratings, n=n)\n    return {\"user_id\": user_id, \"recommendations\": recs[user_id].tolist()}\n```\n\n## \ud83d\udcda Use Cases\n\n### Education\n- **University courses**: Teach recommendation systems without expensive infrastructure\n- **Self-learning**: Students can run everything on personal laptops\n- **Workshops**: Quick demos that work offline\n- **Research**: Simple baseline implementation for papers\n\n### Small-Scale Production\n- **School library**: Recommend books to students (500 books, 200 students)\n- **Local business**: Product recommendations for small e-commerce\n- **Community app**: Match local services to residents\n- **Personal projects**: Add recommendations to your blog or app\n\n### Development\n- **Prototyping**: Test recommendation ideas quickly\n- **Learning**: Understand SVD by reading clean, documented code\n- **Benchmarking**: Compare against simple, fast baseline\n- **Integration**: Easy to embed in larger systems\n\n---\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](../LICENSE) file for details.\n\n## \ud83d\ude4f Acknowledgments\n\n- **NumPy/SciPy**: Core numerical computing\n- **Numba**: JIT compilation for performance\n- **Rich**: Beautiful terminal interface\n- **Typer**: Modern CLI framework\n\n---\n\n> **\"Fast, secure, and production-ready recommender systems for everyone.\"**\n\n## \ud83d\uddd3\ufe0f Deprecation Policy\n\nWe strive to maintain backward compatibility and provide clear deprecation warnings. Deprecated features will:\n- Be marked in the documentation and code with a warning.\n- Remain available for at least one minor release cycle.\n- Be removed only after clear notice in the changelog and release notes.\n\nIf you rely on a feature that is marked for deprecation, please open an issue to discuss migration strategies.\n\n## \ud83d\udc69\u200d\ud83d\udcbb Developer Quickstart\n\nTo get started as a contributor or to simulate CI locally:\n\n```sh\n# 1. Set up your full dev environment (Poetry, pre-commit, all dev deps)\nmake dev\n\n# 2. Run all linters\nmake lint\n\n# 3. Run all tests with coverage\nmake test\n\n# 4. Run all pre-commit hooks\nmake precommit\n\n# 5. Build the Docker image\nmake docker-build\n\n# 6. Run tests inside Docker (as CI does)\nmake docker-test\n\n# 7. Simulate the full CI pipeline (lint, test, coverage, Docker)\nmake ci\n```\n\n<!-- Trigger CI: workflow file updated -->\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\ud83d\udd25 Lightweight recommender for teaching and small-scale production",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [
        "recommender-system",
        " svd",
        " numpy",
        " machine-learning",
        " collaborative-filtering",
        " education"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a09c8481dc654f552ac686fb8d3083b78c7ca9f8f55a0853fcc4870e466a1ce",
                "md5": "3fc574d6a88468012c03236279295021",
                "sha256": "08afa2dc954cb60ffc41983506c1de09dcf8f2d367fda82f9fd13a8098fd57c0"
            },
            "downloads": -1,
            "filename": "recsys_lite-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3fc574d6a88468012c03236279295021",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.9",
            "size": 33227,
            "upload_time": "2025-07-17T06:49:24",
            "upload_time_iso_8601": "2025-07-17T06:49:24.293486Z",
            "url": "https://files.pythonhosted.org/packages/7a/09/c8481dc654f552ac686fb8d3083b78c7ca9f8f55a0853fcc4870e466a1ce/recsys_lite-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15a73255907bb0d002d23014ff3be938282de0ce32959f2f148b05cf1302927b",
                "md5": "d9a0466c962bd06ff71616db278b8743",
                "sha256": "5e6a27bed1cbe86c96f4fe22850880e958976bf8f3cf003b9c1aff0108cf7fe0"
            },
            "downloads": -1,
            "filename": "recsys_lite-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d9a0466c962bd06ff71616db278b8743",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.9",
            "size": 32704,
            "upload_time": "2025-07-17T06:49:25",
            "upload_time_iso_8601": "2025-07-17T06:49:25.371946Z",
            "url": "https://files.pythonhosted.org/packages/15/a7/3255907bb0d002d23014ff3be938282de0ce32959f2f148b05cf1302927b/recsys_lite-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-17 06:49:25",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "recsys_lite"
}
        
Elapsed time: 1.01842s