Git Product home page Git Product logo

sparse-solvers's Introduction

Sparse Solvers   Build Status

High performance ℓ₁-minimization solvers for sparse sensing and signal recovery problems.

Releases

Python – The python binding is available as a package on pypi via pip install:

pip install sparsesolvers

Here is a toy example:

import sparsesolvers as ss
import numpy as np

N = 10

# Create an example sensing matrix
A = np.random.normal(loc=0.025, scale=0.025, size=(N, N)) + np.identity(N)

# An incoming signal
signal = np.zeros(N)
signal[2] = 1

# Use the homotopy solver to produce sparse solution, x.
x, info = ss.Homotopy(A).solve(signal, tolerance=0.1)

# Example output: error=0.064195, sparsity=0.9, argmax=2
print("error=%f, sparsity=%f, argmax=%i" % (
    info.solution_error, 1 - np.count_nonzero(x) / np.double(N),
    np.argmax(x)))

References

  1. A. Y. Yang, Z. Zhou, A. Ganesh, S. S. Sastry, and Y. MaFast ℓ₁-minimization Algorithms For Robust Face Recognition – IEEE Trans. Image Processing, vol. 22, pp. 3234–3246, Aug 2013.

  2. R. Chartrand, W. YinIteratively Reweighted Algorithms For Compressive Sensing – Acoustics Speech and Signal Processing 2008. ICASSP 2008. IEEE International Conference, pp. 3869-3872, March 2008.

  3. D. O’LearyRobust Regression Computation Using Iteratively Reweighted Least Squares – Society for Industrial and Applied Mathematics, 1990


Setup, Build & Test

Sparse solvers is also a c++14 library for your own projects. The python binding is a good example of how you can incorporate the solvers in to your own c++ projects with minimal effort.

Requirements

At a minimum, you will need:

  • CMake 3.2

  • A reasonably compliant C++14 compiler, e.g.:

    Windows Linux Mac
    VS 2015 gcc 5.3 / clang 3.6 XCode 7.3

Setup

First, clone the repository and its submodules:

git clone --recurse-submodules https://github.com/rayglover-ibm/sparse-solvers
cd sparse-solvers

Build

Configure and build using CMake in the typical way:

mkdir build && cd build
cmake ..
cmake --build . [--config Release]

Run the test suite and/or (if you've enabled them) benchmarks:

ctest -VV . [--config <config>]

Build – Options

There are a number of sparse solvers specific CMake options:

CMake option Description Default
sparsesolvers_WITH_TESTS Enable unit tests ON
sparsesolvers_WITH_BENCHES Enable benchmarks OFF
sparsesolvers_WITH_PYTHON Enable python binding OFF

Build – Python Package

To build the python package (.whl) you will need the relevant Python development package, such as python-dev for Debian/Ubuntu. For Windows/Mac I recommend Conda. To build the wheel:

mkdir build-py && cd build-py
cmake -Dsparsesolvers_WITH_PYTHON=ON ..
cmake --build . --target bdist_wheel [--config Release]

Once the wheel has been created (usually in build-py/bindings/python/dist) you can install it with pip locally in the usual way:

pip install <path/to/sparsesolvers.whl>


Copyright 2017 International Business Machines Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

sparse-solvers's People

Contributors

rayglover-ibm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sparse-solvers's Issues

Python tests

It's likely far easier to test several aspects of ss through python, rather than pure c++. This includes numerical stability and convergence properties.

Also, the reference implementation is in Python so this should make correctness/validation tests easier, too.

Transition to xtensor

Umbrella issue for a transition to xtensor. The aim here is to replace internal multi-dimensional views and gsl::span<T> representations.

xtensor could also make it easier to interop with numpy via the xtensor-python project.

Windows build

Placeholder for a Windows distribution of the python package.

  • Fix any outstanding issues for building with MSVC
  • Add a Windows CI build
  • Set up automated python package distribution

AVX detection

AVX/SSE detection for intel CPUs would make selecting the correct BLAS microarch easier at build time. An example of this can be found on PaddlePaddle.

It's also worth considering doing this at runtime. OpenBLAS is capable of doing this if it's configured correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.