LxMLS / lxmls-toolkit

Machine Learning applied to Natural Language Processing Toolkit used in the Lisbon Machine Learning Summer School
Other
223 stars 215 forks source link

Vectorization of weight gradient calculation #175

Closed gonced8 closed 3 months ago

gonced8 commented 3 years ago

The for loop along the multiple samples is unnecessary and can be simplified with just a matrix multiplication. There are possible other places in the code where the same simplification can be implemented (probably search for loops computing np.outer).

pedrobalage commented 3 months ago

It makes sense to keep the optimized version. The original version was just a literal translation from the Algorithm 8 pseudocode (for m = 1 to M′ do:), but because we are using matrix multiplications in other loops of this algorihtm, so it makes sense to change this too.