Metadata-Version: 2.4
Name: layerlens
Version: 0.1.1
Summary: A library for layer-by-layer explainability of deep learning models
Home-page: https://github.com/navi-04/layerlens
Author: navi-04
Author-email: navi-04 <naveenrajthiyagarajan6@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/navi-04/LayerLens
Project-URL: Documentation, https://github.com/navi-04/LayerLens/blob/main/USAGE.md
Project-URL: Repository, https://github.com/navi-04/LayerLens
Project-URL: Bug Tracker, https://github.com/navi-04/LayerLens/issues
Keywords: explainable-ai,deep-learning,interpretability,xai,layer-wise-analysis,surrogate-models,pytorch,tensorflow
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.19.0
Requires-Dist: scipy>=1.5.0
Requires-Dist: pandas>=1.1.0
Requires-Dist: scikit-learn>=0.24.0
Requires-Dist: networkx>=2.5.0
Requires-Dist: pyyaml>=5.4.0
Requires-Dist: matplotlib>=3.3.0
Requires-Dist: plotly>=4.14.0
Requires-Dist: dash>=2.0.0
Requires-Dist: seaborn>=0.11.0
Requires-Dist: pytest>=6.2.0
Requires-Dist: tqdm>=4.50.0
Provides-Extra: pytorch
Requires-Dist: torch>=1.8.0; extra == "pytorch"
Requires-Dist: torchvision>=0.9.0; extra == "pytorch"
Provides-Extra: tensorflow
Requires-Dist: tensorflow>=2.4.0; extra == "tensorflow"
Provides-Extra: all
Requires-Dist: torch>=1.8.0; extra == "all"
Requires-Dist: torchvision>=0.9.0; extra == "all"
Requires-Dist: tensorflow>=2.4.0; extra == "all"
Requires-Dist: shap>=0.39.0; extra == "all"
Requires-Dist: lime>=0.2.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=6.2.0; extra == "dev"
Requires-Dist: pytest-cov>=2.12.0; extra == "dev"
Requires-Dist: black>=21.0; extra == "dev"
Requires-Dist: flake8>=3.9.0; extra == "dev"
Requires-Dist: sphinx>=4.0.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# LayerLens

LayerLens is a powerful library for layer-by-layer explainability of deep learning models. It provides insights into how models make decisions by analyzing the behavior of individual layers.

[![Python 3.7+](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Features

- **Layer-wise Explanation**: Generate surrogate models for each layer to explain its behavior
- **Hierarchical Insights**: Stitch together layer explanations to understand the full model
- **Interactive Visualization**: Explore model behavior through an intuitive dashboard
- **Production Monitoring**: Detect drift and localize failures in deployed models
- **Framework Agnostic**: Works with PyTorch, TensorFlow, and other major frameworks
- **Comprehensive Testing**: Full test suite ensuring reliability and stability

## Installation

### From Source (Recommended)

```bash
# Clone the repository
git clone https://github.com/your-username/LayerLens.git
cd LayerLens

# Install dependencies
pip install -r requirements.txt

# Install LayerLens
pip install -e .
```

### Via pip (when published)
```bash
pip install layerlens
```

**Note:** You'll also need to install at least one ML framework:
```bash
pip install torch  # For PyTorch support
# or
pip install tensorflow  # For TensorFlow support
```

## Quick Start

```python
from layerlens import Explainer
import numpy as np

# Load your trained model (PyTorch or TensorFlow)
# model = ... (your trained model)

# Create a LayerLens explainer
explainer = Explainer(model)

# Prepare your data
input_data = np.random.rand(10, 28, 28, 1)  # Example

# Generate explanations
explanation = explainer.explain(input_data)

# Visualize the results
explainer.visualize(explanation, output_dir='./explanations')

# Monitor for drift (production use)
explainer.monitor(input_data)
```

## Running Examples

Try the MNIST demo to see LayerLens in action:

```bash
cd examples
jupyter notebook mnist_demo.ipynb
```

## Verification

Verify your installation is working correctly:

```bash
python tests/verify_installation.py
```

Run the full test suite:

```bash
pytest tests/
```

## Documentation

For detailed documentation and usage guides:
- **[USAGE.md](USAGE.md)** - Complete usage guide with examples
- **[docs/](docs/)** - Technical documentation and theory
- **[examples/](examples/)** - Jupyter notebook demos

## Project Structure

```
LayerLens/
├── layerlens/           # Main package
│   ├── core/           # Core explainability engine
│   ├── visualization/  # Interactive dashboards and plots
│   ├── monitoring/     # Production monitoring tools
│   └── utils/          # Helper utilities
├── examples/           # Demo notebooks
├── tests/             # Test suite
└── docs/              # Documentation
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

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

## Citation

If you use LayerLens in your research, please cite:

```bibtex
@software{layerlens,
  title = {LayerLens: Layer-by-Layer Explainability for Deep Learning},
  author = {navi-04},
  year = {2025},
  url = {https://github.com/navi-04/LayerLens}
}
```
D:/GitHub/LayerLens/.venv/Scripts/python.exe -m jupyter notebook mnist_demo.ipynb
