feat(blogs-corpus): new corpus for word2vec
This commit is contained in:
@@ -26,6 +26,7 @@ module Sibe
|
||||
sigmoid',
|
||||
softmax,
|
||||
softmax',
|
||||
sampledSoftmax,
|
||||
relu,
|
||||
relu',
|
||||
crossEntropy,
|
||||
@@ -181,6 +182,12 @@ module Sibe
|
||||
where
|
||||
sig x = 1 / max (1 + exp (-x)) 1e-10
|
||||
|
||||
-- used for negative sampling
|
||||
sampledSoftmax :: Int -> Vector Double -> Vector Double
|
||||
sampledSoftmax n x = cmap (\a -> exp a / s) x
|
||||
where
|
||||
s = V.sum . exp $ V.take n x
|
||||
|
||||
relu :: Vector Double -> Vector Double
|
||||
relu = cmap (max 0.1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user