ExaScience / smurff

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

Defaults in python interface #103

Closed tvandera closed 6 years ago

tvandera commented 6 years ago
ipasechnikov commented 6 years ago

There are no default values for all noise models because you set noise type based on whether its value is set or not. I suppose we can just add new argument like noise_type to set noise type. Then we can have noise values set by default.

https://github.com/ExaScience/smurff/blob/5f4891b94f52ca5741e2e0691864f5ba296fd700/python/smurff/smurff.pyx#L309-L322

ipasechnikov commented 6 years ago

Add two parameters to Python smurff function: Ynoise - noise tuple for Y matrix, prior_noises - list of noise tuple for each prior in priors list.

Commit 8c2c75ddb35c428b40f7cc5cf3b7d12922d104f4 has all these changes.

Here is an example how to use these parameters: https://github.com/ExaScience/smurff/blob/5ba7b683035542b89536af979ad3a61d81bed722/python/smurff/test/test_smurff.py#L94-L103

You can omit Ynoise parameter. Default C++ noise would be used. As for prior_noises, you can leave them empty, then default noise would be used for every prior. Also you can set any element of prior_noises list to None, then corresponding prior would use default noise.

ipasechnikov commented 6 years ago

Heavily related to issue #105. Noise parameters are updated and should work fine. Tests, examples and jupyter notebook are fixed and use new noise parameters.

ipasechnikov commented 6 years ago

Replaced prior_noises parameter with side_info_noises and aux_data_noises.

side_info_noises is a list of noise tuples. You can omit noise model for any side info by setting it as None, then a default C++ noise model would be used.

# side_info_noises example
[('fixed', 1.0, None, None, None), None, ('adaptive', None, 0.1, 1.0, None)]

So for the first side info fixed noise with precision set as 10 would be used. For the second side info it will use default noise model and for the last one it would be an adaptive noise model with initial signal-to-noise ratio 0.1 and max signal-to-noise ratio 1.0.

aux_data_noises is a list of lists of noise models.

# aux_data_noises example
[ [('fixed', 1.0, None, None, None), None], 
  [None, ('probit', None, None, None, 0.5)], 
  None, 
  [],
  [('adaptive', None, 0.5, 1.0, None)] ]