Sparselandtools
:sparkles: A Python package for sparse representations and dictionary learning, including matching pursuit, K-SVD and applications.
Install / Use
/learn @fubel/SparselandtoolsREADME
Sparselandtools
Note: I am no longer maintaining this project so I decided to archive it.
Sparselandtools is a Python 3 package that provides implementations for sparse representations and dictionary learning.
Note: I did this project mainly to generate plots for my Master's thesis. Some of the implementations are more educational than efficient. If you want to learn more about sparse representations and dictionary learning using Python, or use dictionary learning algorithms in small dimensions, this package is for you. If you want to use these functions for industrial applications, you should have a look at more efficient C++-based implementations:
Getting Started
Sparselandtools is available as a PyPI package. You can install it using
pip install sparselandtools

The following code creates a redundant (=overcomplete) DCT-II dictionary and plots it. It also prints out the dictionaries mutual coherence.
from sparselandtools.dictionaries import DCTDictionary
import matplotlib.pyplot as plt
# create dictionary
dct_dictionary = DCTDictionary(8, 11)
# plot dictionary
plt.imshow(dct_dictionary.to_img())
plt.show()
# print mutual coherence
print(dct_dictionary.mutual_coherence())
More examples can be found in the corresponding Jupyter Notebook.
Resources and References
Algorithms are based on pursuit implementations of scikit-learn and descriptions in the following papers and projects
- Aharon, Michal, Michael Elad, and Alfred Bruckstein. "K-SVD: An algorithm for designing overcomplete dictionaries for sparse representation." IEEE Transactions on signal processing 54.11 (2006): 4311-4322.
- Elad, Michael, and Michal Aharon. "Image denoising via sparse and redundant representations over learned dictionaries." IEEE Transactions on Image processing 15.12 (2006): 3736-3745.
- Elad, Michael. Sparse and redundant representations: from theory to applications in signal and image processing. Springer Science & Business Media, 2010.
- K-SVD Implementation by Rubinstein
- The Efficient K-SVD Denoiser by Lebrun
License
The original code in this repository is licensed under the MIT License - see the LICENSE file for details. Note that the implementations are educational, and are my own implementations of algorithms presented in published papers and books. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. This project relies on various third-party libraries and dependencies, each with their own licensing terms. These dependencies might not be included in the MIT License that covers my original code. Users are responsible for complying with all applicable third-party licenses and are solely responsible for identifying and obtaining any necessary patent licenses for their specific use cases.
Related Skills
claude-opus-4-5-migration
109.7kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
349.7kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
TrendRadar
51.0k⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。
mcp-for-beginners
15.8kThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
