The binary for windows of mlpy is provided only for 32bit, so build it by yourself. usage environment:
Get the library you need
If you're trying to use mlpy, you probably already have it installed.
If not, install it with pip install numpy scipy
You will need a static library. I used to build another GSL more than half a year ago, but now it seems that things are changing.
When I did it, I referred to the link below. It was surprisingly easy.
Now the link to the visual studio project is gone. The version is a little old, but gsl-1.15-vc10.zip I found a page that distributes. There was also something that looked like an All in One package (gnu-gsl-for-windows). I'm not using either, so I'm not sure if it's really available.
Modify the source code for 64-bit environment.
" win32 "
in setup.py to " win-amd64 "
. However, the 25th line remains as it isbefore
setup.py(29-41 lines)
#### libs
if get_platform() == "win32":
gsl_lib = ['gsl', 'cblas']
math_lib = []
else:
gsl_lib = ['gsl', 'gslcblas']
math_lib = ['m']
#### Extra compile args
if get_platform() == "win32":
extra_compile_args = []
else:
extra_compile_args = ['-Wno-strict-prototypes']
after
setup.py(29-41 lines)
#### libs
if get_platform() == "win-amd64":
gsl_lib = ['gsl', 'cblas']
math_lib = []
else:
gsl_lib = ['gsl', 'gslcblas']
math_lib = ['m']
#### Extra compile args
if get_platform() == "win-amd64":
extra_compile_args = []
else:
extra_compile_args = ['-Wno-strict-prototypes']
before
mlpy/fastcluster/fastcluster/src/fastcluster.cpp(630-632 lines)
// Complexity: Θ(size)
// Reference: Cormen, Leiserson, Rivest, Stein, Introduction to Algorithms,
// 3rd ed., 2009, Section 6.3 “Building a heap”
after Delete comment
np.int_t
to np.int64_t
If you do not correct it, a runtime error will occur due to a mismatch between int type and long long type, and even Tutorial cannot be executed. __ There may be other areas that need to be fixed, but I haven't found them yet __ before
mlpy/libsvm/libsvm.pyx(28-32 lines)
# array 1D to svm node
cdef svm_node *array1d_to_node(np.ndarray[np.float64_t, ndim=1] x):
cdef int i, k
cdef np.ndarray[np.int_t, ndim=1] nz
cdef svm_node *ret
after
mlpy/libsvm/libsvm.pyx(28-32 lines)
# array 1D to svm node
cdef svm_node *array1d_to_node(np.ndarray[np.float64_t, ndim=1] x):
cdef int i, k
cdef np.ndarray[np.int64_t, ndim=1] nz
cdef svm_node *ret
before
mlpy/adatron/adatron.pyx(69-73 lines)
cdef np.ndarray[np.int_t, ndim=1] ynew
cdef np.ndarray[np.float_t, ndim=2] K_arr
cdef np.ndarray[np.float_t, ndim=1] alpha_arr
cdef double margin
after
mlpy/adatron/adatron.pyx(69-73 lines)
cdef np.ndarray[np.int64_t, ndim=1] ynew
cdef np.ndarray[np.float_t, ndim=2] K_arr
cdef np.ndarray[np.float_t, ndim=1] alpha_arr
cdef double margin
Sorry I made you wait later
set LIB=%LIB%;(gsl.lib,cblas.Directory with lib)
python setup.py build_ext --include-dirs=(gsl include directory)
python setup.py install
Or(If you installed anaconda)
python setup.py build_ext --include-dirs=(gsl include directory) --compiler=msvc install
It is completed with. Thank you for your hard work.
Recommended Posts