GithubHelp home page GithubHelp logo

hichamjanati / mtw Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 6.0 754 KB

Wasserstein regularization for sparse multi-task regression

License: BSD 3-Clause "New" or "Revised" License

Python 97.60% Makefile 2.40%

mtw's People

Contributors

massich avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

mtw's Issues

proximal update

Hi, it seems the proximal update function is different from the paper. Line 48 in solver_cd.pyx shows:
z = theta - a - b
But in the paper the corresponding component in the derived proximal operator is:
z = theta - marginal*(b+1)

Hope you could help shed light on this.

Cheers,
Liu Peng

updage .gitingore

I get this:

(mtw-env) ❯ git status
On branch fix_more_ci
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   mtw/solver_cd.c

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	doc/_build/
	doc/auto_examples/
	doc/generated/
	mtw.egg-info/

maybe you should not track solver_cd.c and all the sphinx things need to be ignored

BUG: cannot import mtw because of "from ot import"

(mtw-env) ➜  mtw git:(master) ✗ python
Python 3.7.1 | packaged by conda-forge | (default, Nov 13 2018, 18:33:04) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mtw import MTW
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mathurin/workspace/mtw/mtw/__init__.py", line 1, in <module>
    from .mtw import MTW
  File "/home/mathurin/workspace/mtw/mtw/mtw.py", line 2, in <module>
    from .solver import solver
  File "/home/mathurin/workspace/mtw/mtw/solver.py", line 10, in <module>
    from .otfunctions import (barycenterkl, barycenterkl_img, barycenterkl_log,
  File "/home/mathurin/workspace/mtw/mtw/otfunctions.py", line 6, in <module>
    from ot import emd2
ModuleNotFoundError: No module named 'ot'

@hichamjanati 

What is ot supposed to be ?

Cython compilation errors

Hello -- thank you for making this project available.

I am running into some trouble trying to build and compile this:

(mtw) mtw (pep518)$pip install --no-deps -e . 
  WARNING: Missing build requirements in pyproject.toml for file:///Users/arokem/source/mtw.
  WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'wheel'.
open errors.tx  ERROR: Command errored out with exit status 1:
   command: /Users/arokem/.virtualenvs/mtw/bin/python3.7 /Users/arokem/.virtualenvs/mtw/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/56/4s8_k8_s2n9c1622_bmnz7m40000gn/T/tmpjvb234qh
       cwd: /Users/arokem/source/mtw
  Complete output (1412 lines):
  /private/var/folders/56/4s8_k8_s2n9c1622_bmnz7m40000gn/T/pip-build-env-w7qtokj_/overlay/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /Users/arokem/source/mtw/mtw/solver_cd.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/ddot.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/dasum.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/daxpy.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/dnrm2.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/dcopy.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport cython
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:6:0: 'scipy/linalg/cython_blas/dscal.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/sdot.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/sasum.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/saxpy.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/snrm2.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/scopy.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np
  import numpy as np
  from cython cimport floating
  from libc.math cimport fabs, sqrt, fmax
  from scipy.linalg.cython_blas cimport ddot, dasum, daxpy, dnrm2, dcopy, dscal
  from scipy.linalg.cython_blas cimport sdot, sasum, saxpy, snrm2, scopy, sscal
  ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:7:0: 'scipy/linalg/cython_blas/sscal.pxd' not found
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:23:15: 'sdot' is not a constant, variable or function identifier
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                     ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:23:20: Cannot convert 'int *' to Python object
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                        ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:23:23: Cannot convert 'float *' to Python object
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                           ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:23:26: Cannot convert 'int *' to Python object
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                                 ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:23:32: Cannot convert 'float *' to Python object
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
      else:
          return sdot(n, x, inc1, y, inc2)
                                    ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:23:35: Cannot convert 'int *' to Python object
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return -1.0
  
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
                ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:21:15: 'ddot' is not a constant, variable or function identifier
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return -1.0
  
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
                     ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:21:20: Cannot convert 'int *' to Python object
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return -1.0
  
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
                        ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:21:23: Cannot convert 'double *' to Python object
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return -1.0
  
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
                           ^
  ------------------------------------------------------------
  
  mtw/solver_cd.pyx:21:26: Cannot convert 'int *' to Python object
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return -1.0
  
  cdef floating fdot(int * n, floating * x, int * inc1, floating * y,
                          int * inc2) nogil:
      if floating is double:
          return ddot(n, x, inc1, y, inc2)
                 ...

Unwanted files

There are files like .DS_blabla from macosx and .pyx that should not be there.

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.