https://github.com/tensorly/tensorly
Revision 4fb9a54f98cd8878ca35346d57d0723cebd32613 authored by Cyrillus Tan on 16 March 2023, 19:35:14 UTC, committed by GitHub on 16 March 2023, 19:35:14 UTC
* Amendment in the functions

* Add more tests

* Black formatting

* Skip transform test on tensorflow

* Some changes for the review

* Adjustments to help with solving speed

* Separate R2 score; make X_r2 and Y_r2 as new attributes

* Avoid creating CPTensor() overhead; remove redundant reshape

* Update tensorly/metrics/tests/test_regression.py

Co-authored-by: Jean Kossaifi <jean.kossaifi@gmail.com>

* Incorporate outer, fix randn call

* More tl.tenalg.outer; used mean-centered tensor

* Some fixes on R2 definitions

* Make a dedicated score function to avoid copying X and Y

* Black formatting

---------

Co-authored-by: Aaron Meyer <ameyer@ucla.edu>
Co-authored-by: Aaron Meyer <2065146+aarmey@users.noreply.github.com>
Co-authored-by: Jean Kossaifi <jean.kossaifi@gmail.com>
1 parent a26ffe0
Raw File
Tip revision: 4fb9a54f98cd8878ca35346d57d0723cebd32613 authored by Cyrillus Tan on 16 March 2023, 19:35:14 UTC
Fix CP Partial Least Square (#492)
Tip revision: 4fb9a54
setup.py
try:
    from setuptools import setup, find_packages
except ImportError:
    from distutils.core import setup, find_packages

import re
from pathlib import Path

def version(root_path):
    """Returns the version taken from __init__.py

    Parameters
    ----------
    root_path : pathlib.Path
        path to the root of the package

    Reference
    ---------
    https://packaging.python.org/guides/single-sourcing-package-version/
    """
    version_path = root_path.joinpath('tensorly', '__init__.py')
    with version_path.open() as f:
        version_file = f.read()
    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
                              version_file, re.M)
    if version_match:
        return version_match.group(1)
    raise RuntimeError("Unable to find version string.")


def readme(root_path):
    """Returns the text content of the README.rst of the package

    Parameters
    ----------
    root_path : pathlib.Path
        path to the root of the package
    """
    with root_path.joinpath('README.rst').open(encoding='UTF-8') as f:
        return f.read()


root_path = Path(__file__).parent
README = readme(root_path)
VERSION = version(root_path)


config = {
    'name': 'tensorly',
    'packages': find_packages(exclude=['doc']),
    'description': 'Tensor learning in Python.',
    'long_description': README,
    'long_description_content_type' : 'text/x-rst',
    'author': 'Jean Kossaifi',
    'author_email': 'jean.kossaifi@gmail.com',
    'version': VERSION,
    'url': 'https://github.com/tensorly/tensorly',
    'download_url': 'https://github.com/tensorly/tensorly/tarball/' + VERSION,
    'install_requires': ['numpy', 'scipy'],
    'license': 'Modified BSD',
    'scripts': [],
    'classifiers': [
        'Topic :: Scientific/Engineering',
        'License :: OSI Approved :: BSD License',
        'Programming Language :: Python :: 3'
    ],
}

setup(**config)
back to top