scikit-learn-contrib / metric-learn

Metric learning algorithms in Python
http://contrib.scikit-learn.org/metric-learn/
MIT License
1.4k stars 234 forks source link

Including new algorithm #53

Open eduardomax opened 7 years ago

eduardomax commented 7 years ago

Hi, i wanna know how to include one file generate from Build? Because i'm interested in include other metric learning algorithm. I'm suffering to include in the project

perimosocordiae commented 7 years ago

I'm not exactly sure what you're asking, but if you'd like to open a Pull Request with your changes I'll be happy to take a look.

eduardomax commented 7 years ago

Example, i wanna put the k-stochastic-neighbor (kNCA) from https://github.com/kswersky/k-stochastic-neighbor, but they included one lib file generated from code c++, called "knca_alg.A.dylib". So i dont know how to add :) if you can help me in this case.

perimosocordiae commented 7 years ago

The first issue is that the k-stochastic-neighbor repo doesn't have a clear license, so you'll probably want to ask @kswersky for permission before copying that code here. (For reference, this repo is MIT-licensed.)

The second issue is the technical problem of including compiled code. So far, none of the methods here require compilation, so there isn't a build mechanism in place yet, but the idea is to commit the C/C++/Cython sources and configure setup.py to build the native code and place the resulting shared library in the correct location. I don't want to make native compilation a hard dependency, though, so there should be a pure-Python fallback implementation as well (like we have for LMNN).

perimosocordiae commented 7 years ago

For an example of conditionally building native code, see: https://github.com/perimosocordiae/sparray/blob/e13fb0948b0f3b38813f072031d97dcf2dcd57e3/setup.py#L4