-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Hello,
when I look at the code for the function word2vec, the I see, that not all options are used/set.
For example the window size is not set in the training class.
Is it possible to add the settinmg for these missing options?
Goldritter
P.S.
I updated the code in this manner and it works.
(defn my-word2vec
"Return a trained instance of Word2Vec,
The first argument is a seq of seqs, where each seq is a list of words.
The rest of the arguments are hyperparameters used in training the
neural net."
([sentences &
{:keys [ min-vocab-frequency window-size type layer-size initial-learning-rate
use-negative-samples downsampling-rate num-iterations num-threads]
:or { min-vocab-frequency 5
window-size 8
initial-learning-rate 0.05
type NeuralNetworkType/CBOW
layer-size 5
use-negative-samples 25
downsampling-rate 1e-5
num-iterations 100
num-threads (.availableProcessors (Runtime/getRuntime))}
}]
(let [bldr (doto (Word2VecModel/trainer )
(.setLayerSize layer-size)
(.setWindowSize window-size)
(.type type)
(.setInitialLearningRate initial-learning-rate)
(.setMinVocabFrequency min-vocab-frequency)
(.setDownSamplingRate downsampling-rate)
(.useNegativeSamples use-negative-samples)
(.setNumIterations num-iterations)
(.setMinVocabFrequency min-vocab-frequency)
(.useNumThreads num-threads))]
(.train bldr sentences)
)))