ExaScience / smurff

Bayesian Factorization with Side Information in C++ with Python wrapper
MIT License
70 stars 14 forks source link

Defaults in Python from C++ #105

Closed tvandera closed 6 years ago

tvandera commented 6 years ago

in smurff.pyx use defaults from statics in e.g. smurff::Config::

ipasechnikov commented 6 years ago

It seems that cython does not support C++ static fields. So I used a workaround that substitutes variable name with a provided string when cython generates .cpp file. Maybe there is another way to solve this problem. Feel free to propose any ideas.

https://github.com/ExaScience/smurff/blob/ff52f8c870fdc3be6960116c90b270b67e3a7558/python/smurff/Config.pxd#L19-L33

So currently smurff function looks like this:

https://github.com/ExaScience/smurff/blob/ff52f8c870fdc3be6960116c90b270b67e3a7558/python/smurff/smurff.pyx#L268-L292

There is still a problem related to default noise values. This was already mentioned in issue https://github.com/ExaScience/smurff/issues/103#issuecomment-372232753.

ipasechnikov commented 6 years ago

I suppose we can consider this issue closed. Python interface now uses smurff::Config:: static fields as default values for parameters.