airoldilab / sgd

An R package for large scale estimation with stochastic gradient descent
62 stars 18 forks source link

No support for weights #91

Open jeffwong-nflx opened 7 years ago

jeffwong-nflx commented 7 years ago

Hi, it would be great to have support for a weights vector as in glmnet

ChrisBotella commented 6 years ago

Hello,

I met the same limitation when trying to use this package to fit a "glm" model.

More precisely, I need to optimize a loss function where each term is multiplied by a constant scalar given by the user. This corresponds to the argument "weights" of the glm function (stats package).

If the package is still maintained, it would be very usefull to add this feature and I suppose this is not very costly in term of code. However, it seemed to me this part of the code is written in C++, which I don't know how to deal with.

tomwenseleers commented 1 year ago

As a workaround, I suppose you can just multiple both your covariate matrix x and y by sqrt(weights) ?