GithubHelp home page GithubHelp logo

yuki-koyama / mathtoolbox Goto Github PK

View Code? Open in Web Editor NEW
252.0 17.0 35.0 9.15 MB

Mathematical tools (interpolation, dimensionality reduction, optimization, etc.) written in C++11 with Eigen

Home Page: https://yuki-koyama.github.io/mathtoolbox/

License: MIT License

CMake 3.95% C++ 79.88% Python 16.16%
algorithm dimensionality-reduction interpolation eigen optimization rbf gpr mds bfgs

mathtoolbox's Introduction

mathtoolbox

GitHub

Mathematical tools (interpolation, dimensionality reduction, optimization, etc.) written in C++11 and Eigen.

Algorithms

Scattered Data Interpolation and Function Approximation

Dimensionality Reduction and Low-Dimensional Embedding

Numerical Optimization

Linear Algebra

Utilities

Dependencies

Main Library

Python Bindings

Examples

Use as a C++ Library

mathtoolbox uses CMake https://cmake.org/ for building source codes. This library can be built, for example, by

git clone https://github.com/yuki-koyama/mathtoolbox.git --recursive
cd mathtoolbox
mkdir build
cd build
cmake ../
make

and optionally it can be installed to the system by

make install

When the CMake parameter MATHTOOLBOX_BUILD_EXAMPLES is set ON, the example applications are also built. (The default setting is OFF.) This is done by

cmake ../ -DMATHTOOLBOX_BUILD_EXAMPLES=ON
make

When the CMake parameter MATHTOOLBOX_PYTHON_BINDINGS is set ON, the example applications are also built. (The default setting is OFF.) This is done by

cmake ../ -DMATHTOOLBOX_PYTHON_BINDINGS=ON
make

Prerequisites

macOS:

brew install eigen

Ubuntu:

sudo apt install libeigen3-dev

Use as a Python Library

pymathtoolbox is a (sub)set of Python bindings of mathtoolbox. Tested on Python 3.8 and 3.9.

It can be installed via PyPI:

pip install git+https://github.com/yuki-koyama/mathtoolbox

Prerequisites

macOS

brew install cmake eigen

Ubuntu 16.04/18.04

sudo apt install cmake libeigen3-dev

Examples

See python-examples.

Gallery

Bayesian optimization (bayesian-optimization) solves a one-dimensional optimization problem using only a small number of function-evaluation queries.

Classical multi-dimensional scaling (classical-mds) is applied to pixel RGB values of a target image to embed them into a two-dimensional space.

Self-organizing map (som) is also applicable to pixel RGB values of a target image to learn a two-dimensional color manifold.

Projects Using mathtoolbox

Contributing

Bug reports, suggestions, feature requests, and PRs are highly welcomed.

Licensing

The MIT License.

mathtoolbox's People

Contributors

maidamai0 avatar yuki-koyama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mathtoolbox's Issues

Need demos

It is much better to include a demo program for each module

[GPR] Support data normalization

As the current implementation assumes the mean function to be zero constant, it is better to support data normalization, i.e., modify y so that mean(y) = 0.

Also, it is worth discussing the use of scaling, i.e., modify y so that var(y) = 1.

Generate warnings when linking python bindings

https://travis-ci.com/yuki-koyama/mathtoolbox/jobs/262658713#L299-L300

Scanning dependencies of target pymathtoolbox
[ 40%] Building CXX object CMakeFiles/pymathtoolbox.dir/src/pybind/python-bindings.cpp.o
[ 43%] Linking CXX shared module pymathtoolbox.cpython-36m-darwin.so
ld: warning: direct access in function 'pybind11_init_pymathtoolbox(pybind11::module&)' from file '/tmp/lto.o' to global weak symbol 'mathtoolbox::optimization::BayesianOptimizer::EvaluatePoint(Eigen::Matrix<double, -1, 1, 0, -1, 1> const&) const' from file 'libmathtoolbox.a(bayesian-optimization.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'char const* std::__1::__find_end<bool (*)(char, char), char const*, char const*>(char const*, char const*, char const*, char const*, bool (*)(char, char), std::__1::random_access_iterator_tag, std::__1::random_access_iterator_tag)' from file '/tmp/lto.o' to global weak symbol 'std::__1::char_traits<char>::eq(char, char)' from file 'libmathtoolbox.a(gaussian-process-regression.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
[ 43%] Built target pymathtoolbox

This issue should be fixed.

Remove Travis?

Now that this repository uses GitHub Actions to test on macOS and Ubuntu (16.04/18.04), it is not necessary to rely on Travis CI for testing. It is worth considering to remove the dependency to keep the workflow as simple as possible.

Windows support

Currently, this library does not support Windows. I hope this issue will be resolved in the near future (but I don't have access to Windows and am not familiar with it).

The GPR demo sometimes fails to find appropriate hyperparameters

The current demo uses maximum likelihood estimation for hyperparameters, but it fails sometimes. Especially, the length-scale hyperparameter in the ARD squared exponential kernel becomes unrealistically small, resulting in a "no relevance" kernel matrix.

A possible fix is to use maximum a posteriori estimation with an appropriate prior assumption for the hyperparameters.

Remove NLopt dependency?

Now that the library contains numerical optimization algorithms, it may be possible to remove the NLopt dependency. This can be future work.

Line search in BFGS and L-BFGS sometimes fail

I've just found that the demo of GPR sometimes fails to optimize hyperparameters using BFGS or L-BFGS in this library; it throws run-time exceptions during line search. This needs to be examined carefully.

Need documents

It is necessary to write some documentations about (1) how to use the library and (2) which equations are implemented.

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.