Skip to content

Ignored options #4

Description

@Goldritter

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)
)))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions