Closed eggie5 closed 3 years ago
Hrm, the broadcast syntax is indeed broken and I'll endeavour to fix it, but this works fine:
normalize(dm, Axis._1)
On Mon, Aug 23, 2021 at 12:00 PM Alex Egg @.***> wrote:
How can I do the L2 norm of a matrix w/ breeze?
numpy
normd_vecs = (word_vecs.T / np.linalg.norm(word_vecs, axis=1)).T #L2 normalize return np.mean(normd_vecs, axis=0) #avg across axis 0
breeze
val word_vecs = ??? // L2 normalize val mean_pool = mean(normd_vecs(::,*)).t //avg across axis 0
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/scalanlp/breeze/issues/820, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACLIKPWUF4SUNYORIBUNDT6KLFBANCNFSM5CVGA64A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
also normalize(dm(::, *), 2.0) should work, at least in the 2.0 RC's
On Mon, Aug 23, 2021 at 2:44 PM David Hall @.***> wrote:
Hrm, the broadcast syntax is indeed broken and I'll endeavour to fix it, but this works fine:
normalize(dm, Axis._1)
On Mon, Aug 23, 2021 at 12:00 PM Alex Egg @.***> wrote:
How can I do the L2 norm of a matrix w/ breeze?
numpy
normd_vecs = (word_vecs.T / np.linalg.norm(word_vecs, axis=1)).T #L2 normalize return np.mean(normd_vecs, axis=0) #avg across axis 0
breeze
val word_vecs = ??? // L2 normalize val mean_pool = mean(normd_vecs(::,*)).t //avg across axis 0
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/scalanlp/breeze/issues/820, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACLIKPWUF4SUNYORIBUNDT6KLFBANCNFSM5CVGA64A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
I don't see any way to trick Scala's implicits into making normalize(dm, Axis._1)
to work without either breaking something else or another overhaul of implicit organization that I don't have the will to do
How can I do the L2 norm of a matrix w/ breeze?
numpy
breeze