Himalaya: Multiple-target linear models
=======================================
|Github| |Python| |License| |Build| |Codecov| |Downloads|
``Himalaya`` [1]_ implements machine learning linear models in Python, focusing
on computational efficiency for large numbers of targets.
Use ``himalaya`` if you need a library that:
- estimates linear models on large numbers of targets,
- runs on CPU and GPU hardware,
- provides estimators compatible with ``scikit-learn``'s API.
``Himalaya`` is stable (with particular care for backward compatibility) and
open for public use (give it a star!).
Example
=======
.. code-block:: python
import numpy as np
n_samples, n_features, n_targets = 10, 5, 4
np.random.seed(0)
X = np.random.randn(n_samples, n_features)
Y = np.random.randn(n_samples, n_targets)
from himalaya.ridge import RidgeCV
model = RidgeCV(alphas=[1, 10, 100])
model.fit(X, Y)
print(model.best_alphas_) # [ 10. 100. 10. 100.]
- The model ``RidgeCV`` uses the same API as ``scikit-learn``
estimators, with methods such as ``fit``, ``predict``, ``score``, etc.
- The model is able to efficiently fit a large number of targets (routinely
used with 100k targets).
- The model selects the best hyperparameter ``alpha`` for each target
independently.
More examples
-------------
Check more examples of use of ``himalaya`` in the `gallery of examples
<https://gallantlab.github.io/himalaya/_auto_examples/index.html>`_.
Tutorials using ``himalaya`` for fMRI
-------------------------------------
``Himalaya`` was designed primarily for functional magnetic resonance imaging
(fMRI) encoding models. In depth tutorials about using ``himalaya`` for fMRI
encoding models can be found at `gallantlab/voxelwise_tutorials
<https://github.com/gallantlab/voxelwise_tutorials>`_.
Models
======
``Himalaya`` implements the following models:
- Ridge, RidgeCV
- KernelRidge, KernelRidgeCV
- GroupRidgeCV, MultipleKernelRidgeCV, WeightedKernelRidge
- SparseGroupLassoCV
See the `model descriptions
<https://gallantlab.github.io/himalaya/models.html>`_ in the documentation
website.
Himalaya backends
=================
``Himalaya`` can be used seamlessly with different backends.
The available backends are ``numpy`` (default), ``cupy``, ``torch``, and
``torch_cuda``.
To change the backend, call:
.. code-block:: python
from himalaya.backend import set_backend
backend = set_backend("torch")
and give ``torch`` arrays inputs to the ``himalaya`` solvers. For convenience,
estimators implementing ``scikit-learn``'s API can cast arrays to the correct
input type.
GPU acceleration
----------------
To run ``himalaya`` on a graphics processing unit (GPU), you can use either
the ``cupy`` or the ``torch_cuda`` backend:
.. code-block:: python
from himalaya.backend import set_backend
backend = set_backend("cupy") # or "torch_cuda"
data = backend.asarray(data)
Installation
============
Dependencies
------------
- Python 3
- Numpy
- Scikit-learn
Optional (GPU backends):
- PyTorch (1.9+ preferred)
- Cupy
Standard installation
---------------------
You may install the latest version of ``himalaya`` using the package manager
``pip``, which will automatically download ``himalaya`` from the Python Package
Index (PyPI):
.. code-block:: bash
pip install himalaya
Installation from source
------------------------
To install ``himalaya`` from the latest source (``main`` branch), you may
call:
.. code-block:: bash
pip install git+https://github.com/gallantlab/himalaya.git
Developers can also install ``himalaya`` in editable mode via:
.. code-block:: bash
git clone https://github.com/gallantlab/himalaya
cd himalaya
pip install --editable .
.. |Github| image:: https://img.shields.io/badge/github-himalaya-blue
:target: https://github.com/gallantlab/himalaya
.. |Python| image:: https://img.shields.io/badge/python-3.7%2B-blue
:target: https://www.python.org/downloads/release/python-370
.. |License| image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg
:target: https://opensource.org/licenses/BSD-3-Clause
.. |Build| image:: https://github.com/gallantlab/himalaya/actions/workflows/run_tests.yml/badge.svg
:target: https://github.com/gallantlab/himalaya/actions/workflows/run_tests.yml
.. |Codecov| image:: https://codecov.io/gh/gallantlab/himalaya/branch/main/graph/badge.svg?token=ECzjd9gvrw
:target: https://codecov.io/gh/gallantlab/himalaya
.. |Downloads| image:: https://pepy.tech/badge/himalaya
:target: https://pepy.tech/project/himalaya
Cite this package
=================
If you use ``himalaya`` in your work, please give it a star, and cite our
publication:
.. [1] Dupré La Tour, T., Eickenberg, M., Nunez-Elizalde, A.O., & Gallant, J. L. (2022).
Feature-space selection with banded ridge regression. `NeuroImage <https://doi.org/10.1016/j.neuroimage.2022.119728>`_.
Raw data
{
"_id": null,
"home_page": "https://github.com/gallantlab/himalaya",
"name": "himalaya",
"maintainer": "Tom Dupre la Tour",
"docs_url": null,
"requires_python": null,
"maintainer_email": "tomdlt@berkeley.edu",
"keywords": null,
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/33/2a/524cd30559becc09ae48043bac9a9108a9ff8dd506d86bcf382ba7485efb/himalaya-0.4.6.tar.gz",
"platform": null,
"description": "Himalaya: Multiple-target linear models\n=======================================\n\n|Github| |Python| |License| |Build| |Codecov| |Downloads|\n\n``Himalaya`` [1]_ implements machine learning linear models in Python, focusing\non computational efficiency for large numbers of targets.\n\nUse ``himalaya`` if you need a library that:\n\n- estimates linear models on large numbers of targets,\n- runs on CPU and GPU hardware,\n- provides estimators compatible with ``scikit-learn``'s API.\n\n``Himalaya`` is stable (with particular care for backward compatibility) and\nopen for public use (give it a star!).\n\nExample\n=======\n\n.. code-block:: python\n\n import numpy as np\n n_samples, n_features, n_targets = 10, 5, 4\n np.random.seed(0)\n X = np.random.randn(n_samples, n_features)\n Y = np.random.randn(n_samples, n_targets)\n\n from himalaya.ridge import RidgeCV\n model = RidgeCV(alphas=[1, 10, 100])\n model.fit(X, Y)\n print(model.best_alphas_) # [ 10. 100. 10. 100.]\n\n\n- The model ``RidgeCV`` uses the same API as ``scikit-learn``\n estimators, with methods such as ``fit``, ``predict``, ``score``, etc.\n- The model is able to efficiently fit a large number of targets (routinely\n used with 100k targets).\n- The model selects the best hyperparameter ``alpha`` for each target\n independently.\n\nMore examples\n-------------\n\nCheck more examples of use of ``himalaya`` in the `gallery of examples\n<https://gallantlab.github.io/himalaya/_auto_examples/index.html>`_.\n\nTutorials using ``himalaya`` for fMRI\n-------------------------------------\n\n``Himalaya`` was designed primarily for functional magnetic resonance imaging\n(fMRI) encoding models. In depth tutorials about using ``himalaya`` for fMRI\nencoding models can be found at `gallantlab/voxelwise_tutorials\n<https://github.com/gallantlab/voxelwise_tutorials>`_.\n\nModels\n======\n\n``Himalaya`` implements the following models:\n\n- Ridge, RidgeCV\n- KernelRidge, KernelRidgeCV\n- GroupRidgeCV, MultipleKernelRidgeCV, WeightedKernelRidge\n- SparseGroupLassoCV\n\n\nSee the `model descriptions\n<https://gallantlab.github.io/himalaya/models.html>`_ in the documentation\nwebsite.\n\nHimalaya backends\n=================\n\n``Himalaya`` can be used seamlessly with different backends.\nThe available backends are ``numpy`` (default), ``cupy``, ``torch``, and\n``torch_cuda``.\nTo change the backend, call:\n\n.. code-block:: python\n\n from himalaya.backend import set_backend\n backend = set_backend(\"torch\")\n\n\nand give ``torch`` arrays inputs to the ``himalaya`` solvers. For convenience,\nestimators implementing ``scikit-learn``'s API can cast arrays to the correct\ninput type.\n\nGPU acceleration\n----------------\n\nTo run ``himalaya`` on a graphics processing unit (GPU), you can use either\nthe ``cupy`` or the ``torch_cuda`` backend:\n\n.. code-block:: python\n\n from himalaya.backend import set_backend\n backend = set_backend(\"cupy\") # or \"torch_cuda\"\n\n data = backend.asarray(data)\n\n\nInstallation\n============\n\nDependencies\n------------\n\n- Python 3\n- Numpy\n- Scikit-learn\n\nOptional (GPU backends):\n\n- PyTorch (1.9+ preferred)\n- Cupy\n\n\nStandard installation\n---------------------\nYou may install the latest version of ``himalaya`` using the package manager\n``pip``, which will automatically download ``himalaya`` from the Python Package\nIndex (PyPI):\n\n.. code-block:: bash\n\n pip install himalaya\n\n\nInstallation from source\n------------------------\n\nTo install ``himalaya`` from the latest source (``main`` branch), you may\ncall:\n\n.. code-block:: bash\n\n pip install git+https://github.com/gallantlab/himalaya.git\n\n\nDevelopers can also install ``himalaya`` in editable mode via:\n\n.. code-block:: bash\n\n git clone https://github.com/gallantlab/himalaya\n cd himalaya\n pip install --editable .\n\n\n.. |Github| image:: https://img.shields.io/badge/github-himalaya-blue\n :target: https://github.com/gallantlab/himalaya\n\n.. |Python| image:: https://img.shields.io/badge/python-3.7%2B-blue\n :target: https://www.python.org/downloads/release/python-370\n\n.. |License| image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg\n :target: https://opensource.org/licenses/BSD-3-Clause\n\n.. |Build| image:: https://github.com/gallantlab/himalaya/actions/workflows/run_tests.yml/badge.svg\n :target: https://github.com/gallantlab/himalaya/actions/workflows/run_tests.yml\n\n.. |Codecov| image:: https://codecov.io/gh/gallantlab/himalaya/branch/main/graph/badge.svg?token=ECzjd9gvrw\n :target: https://codecov.io/gh/gallantlab/himalaya\n\n.. |Downloads| image:: https://pepy.tech/badge/himalaya\n :target: https://pepy.tech/project/himalaya\n\n\nCite this package\n=================\n\nIf you use ``himalaya`` in your work, please give it a star, and cite our\npublication:\n\n.. [1] Dupr\u00e9 La Tour, T., Eickenberg, M., Nunez-Elizalde, A.O., & Gallant, J. L. (2022).\n Feature-space selection with banded ridge regression. `NeuroImage <https://doi.org/10.1016/j.neuroimage.2022.119728>`_.\n \n\n\n",
"bugtrack_url": null,
"license": "BSD (3-clause)",
"summary": "Multiple-target machine learning",
"version": "0.4.6",
"project_urls": {
"Homepage": "https://github.com/gallantlab/himalaya"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b414dca8837fd6e81f1a641dc165fdf80202bcc113e91fd2f86281c139c12f76",
"md5": "102ee820c81a229092f29d7aa3be7aba",
"sha256": "f1d45cedef830d069c34bab4352e0231e86413921046ef2f36a773c91e218d65"
},
"downloads": -1,
"filename": "himalaya-0.4.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "102ee820c81a229092f29d7aa3be7aba",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 83754,
"upload_time": "2024-06-21T22:22:18",
"upload_time_iso_8601": "2024-06-21T22:22:18.158822Z",
"url": "https://files.pythonhosted.org/packages/b4/14/dca8837fd6e81f1a641dc165fdf80202bcc113e91fd2f86281c139c12f76/himalaya-0.4.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "332a524cd30559becc09ae48043bac9a9108a9ff8dd506d86bcf382ba7485efb",
"md5": "bb61063346bde2fa14e6028a3039050e",
"sha256": "c84d5a2e01d1fd957d6d9cc083bb6b69c9ee2674ed8a277210e1b065471a3e3c"
},
"downloads": -1,
"filename": "himalaya-0.4.6.tar.gz",
"has_sig": false,
"md5_digest": "bb61063346bde2fa14e6028a3039050e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 70943,
"upload_time": "2024-06-21T22:22:19",
"upload_time_iso_8601": "2024-06-21T22:22:19.706795Z",
"url": "https://files.pythonhosted.org/packages/33/2a/524cd30559becc09ae48043bac9a9108a9ff8dd506d86bcf382ba7485efb/himalaya-0.4.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-21 22:22:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gallantlab",
"github_project": "himalaya",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "himalaya"
}