LowRankModels.jl
LowRankModels.jl copied to clipboard
Some regularizers do not work
Hello,
I just noticed something weird in the code and thought it would be helpful to share it with you: the fact that the copy function makes a copy of the regularizer with no arguments, i.e.,
function copy(r::Regularizer)
newr = typeof(r)()
for field in @compat fieldnames(r)
setfield!(newr, field, copy(getfield(r, field)))
end
newr
end
make it impossible to use regularizers that do require an argument, for instance fixed_latent_features
and fixed_last_latent_features
.
I guess one could solve this by also copying the arguments?
There are a few ways to fix this. One is to define default parameters for every regularizer, so typeof(r)() works. Another is to more cleverly copy the fields of the regularizer. I'd welcome a PR.
On Thu, Dec 22, 2016 at 9:57 PM, Andre Manoel [email protected] wrote:
Hello,
I just noticed something weird in the code and thought it would be helpful to share it with you: the fact that the copy function makes a copy of the regularizer with no arguments, i.e.,
function copy(r::Regularizer) newr = typeof(r)() for field in @compat fieldnames(r) setfield!(newr, field, copy(getfield(r, field))) end newrend
make it impossible to use regularizers that do require an argument, for instance fixed_latent_features and fixed_last_latent_features. I guess one could solve this by also copying the arguments?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/madeleineudell/LowRankModels.jl/issues/71, or mute the thread https://github.com/notifications/unsubscribe-auth/AAyp9LM1r-oDAodfBaT904lasKoi9soZks5rKoHFgaJpZM4LUAOp .
-- Madeleine Udell Assistant Professor, Operations Research and Information Engineering Cornell University https://people.orie.cornell.edu/mru8/ (415) 729-4115