vector_recsys_lite


Namevector_recsys_lite JSON
Version 0.1.8 PyPI version JSON
download
home_pageNone
SummaryπŸ”₯ Lightweight recommender for teaching and small-scale production
upload_time2025-07-17 05:16:56
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/vector-recsys-lite/actions/workflows/ci.yml/badge.svg)](https://github.com/Lunexa-AI/vector-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/vector-recsys-lite.svg)](https://pypi.org/project/vector-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 Use vector-recsys-lite?

- **Purpose-built for teaching and learning:**
  Interactive CLI, educator guides, and Jupyter demosβ€”no need to reinvent the wheel for every class or workshop.
- **Robust, tested, and production-ready:**
  Handles edge cases, bad input, and large/sparse data gracefullyβ€”unlike most one-off scripts.
- **Resource-light and offline-ready:**
  <50MB install, runs on 2GB RAM, and works without internet after install.
- **Simple, reproducible production:**
  One-command API deployment, clean CLI, and Docker support.
- **Multiple algorithms, modern tooling:**
  SVD, ALS (implicit), KNN (cosine), bias handling, chunked processing, and more.
- **Extensible and community-focused:**
  Easy to add new datasets, metrics, or algorithms. Contributor-friendly with templates and guides.
- **World-class documentation and examples:**
  Notebooks, educator guides, and API docs for fast onboarding.

---

## πŸš€ Getting Started

### Installation

```bash
pip install vector_recsys_lite
```

Offline: See guide below.

### Quick Example

```python
import numpy as np
from vector_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: `vector-recsys --help`

## πŸŽ“ For Educators & Students

Teach recommendation systems without fancy hardware.

- **Interactive Mode**: `vector-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**: `vector-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**: `vector-recsys benchmark`

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

### ML Tooling Examples

**ALS (Implicit Feedback)**:
```python
from vector_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 vector_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 vector_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 vector_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 vector_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 vector_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 vector_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": "vector_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/e6/e3/5bcaf511861efb9844658a6e1c3aa62723705b682587c38045d7053cf2b0/vector_recsys_lite-0.1.8.tar.gz",
    "platform": null,
    "description": "\n[![CI](https://github.com/Lunexa-AI/vector-recsys-lite/actions/workflows/ci.yml/badge.svg)](https://github.com/Lunexa-AI/vector-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/vector-recsys-lite.svg)](https://pypi.org/project/vector-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## \ud83c\udf1f Why Use vector-recsys-lite?\n\n- **Purpose-built for teaching and learning:**\n  Interactive CLI, educator guides, and Jupyter demos\u2014no need to reinvent the wheel for every class or workshop.\n- **Robust, tested, and production-ready:**\n  Handles edge cases, bad input, and large/sparse data gracefully\u2014unlike most one-off scripts.\n- **Resource-light and offline-ready:**\n  <50MB install, runs on 2GB RAM, and works without internet after install.\n- **Simple, reproducible production:**\n  One-command API deployment, clean CLI, and Docker support.\n- **Multiple algorithms, modern tooling:**\n  SVD, ALS (implicit), KNN (cosine), bias handling, chunked processing, and more.\n- **Extensible and community-focused:**\n  Easy to add new datasets, metrics, or algorithms. Contributor-friendly with templates and guides.\n- **World-class documentation and examples:**\n  Notebooks, educator guides, and API docs for fast onboarding.\n\n---\n\n## \ud83d\ude80 Getting Started\n\n### Installation\n\n```bash\npip install vector_recsys_lite\n```\n\nOffline: See guide below.\n\n### Quick Example\n\n```python\nimport numpy as np\nfrom vector_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: `vector-recsys --help`\n\n## \ud83c\udf93 For Educators & Students\n\nTeach recommendation systems without fancy hardware.\n\n- **Interactive Mode**: `vector-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**: `vector-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**: `vector-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 vector_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 vector_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 vector_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 vector_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 vector_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 vector_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 vector_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": "0.1.8",
    "project_urls": null,
    "split_keywords": [
        "recommender-system",
        " svd",
        " numpy",
        " machine-learning",
        " collaborative-filtering",
        " education"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "07977f1f74201ce25a4accc4c7d5ad47d386f6cc74868e6988fa510f30ac8abb",
                "md5": "29798a0e7e4b2ce457457f9853230b8e",
                "sha256": "b170d9cf5694492fc3f2e000b6ef09a249c75b975201d663f5c3b79ff5bbb735"
            },
            "downloads": -1,
            "filename": "vector_recsys_lite-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "29798a0e7e4b2ce457457f9853230b8e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.9",
            "size": 33275,
            "upload_time": "2025-07-17T05:16:55",
            "upload_time_iso_8601": "2025-07-17T05:16:55.236113Z",
            "url": "https://files.pythonhosted.org/packages/07/97/7f1f74201ce25a4accc4c7d5ad47d386f6cc74868e6988fa510f30ac8abb/vector_recsys_lite-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e6e35bcaf511861efb9844658a6e1c3aa62723705b682587c38045d7053cf2b0",
                "md5": "abc27ef030c0cdce461ef21c1e7c8691",
                "sha256": "da66924d2d2dd2c9270b5c03460107930fbbeb41cdebc11dcafbd098286f5fb4"
            },
            "downloads": -1,
            "filename": "vector_recsys_lite-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "abc27ef030c0cdce461ef21c1e7c8691",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.9",
            "size": 32370,
            "upload_time": "2025-07-17T05:16:56",
            "upload_time_iso_8601": "2025-07-17T05:16:56.041103Z",
            "url": "https://files.pythonhosted.org/packages/e6/e3/5bcaf511861efb9844658a6e1c3aa62723705b682587c38045d7053cf2b0/vector_recsys_lite-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-17 05:16:56",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "vector_recsys_lite"
}
        
Elapsed time: 2.04981s