Interface WeightLookupTable<T extends SequenceElement>

    • Method Detail

      • getTableId

        Long getTableId()
        Returns unique ID of this table. Used for JointStorage/DistributedLookupTable mechanics
        Returns:
        ID of this table
      • setTableId

        void setTableId​(Long tableId)
        Set's table Id. Please note, it should be unique withing Joint/Distributed LookupTable
        Parameters:
        tableId -
      • layerSize

        int layerSize()
        The layer size for the lookup table
        Returns:
        the layer size for the lookup table
      • getGradient

        double getGradient​(int column,
                           double gradient)
        Returns gradient for specified word
        Parameters:
        column -
        gradient -
        Returns:
      • resetWeights

        void resetWeights​(boolean reset)
        Clear out all weights regardless
        Parameters:
        reset -
      • putCode

        void putCode​(int codeIndex,
                     org.nd4j.linalg.api.ndarray.INDArray code)
        Parameters:
        codeIndex -
        code -
      • loadCodes

        org.nd4j.linalg.api.ndarray.INDArray loadCodes​(int[] codes)
        Loads the co-occurrences for the given codes
        Parameters:
        codes - the codes to load
        Returns:
        an ndarray of code.length by layerSize
      • iterate

        @Deprecated
        void iterate​(T w1,
                     T w2)
        Deprecated.
        Iterate on the given 2 vocab words
        Parameters:
        w1 - the first word to iterate on
        w2 - the second word to iterate on
      • iterateSample

        @Deprecated
        void iterateSample​(T w1,
                           T w2,
                           AtomicLong nextRandom,
                           double alpha)
        Deprecated.
        Iterate on the given 2 vocab words
        Parameters:
        w1 - the first word to iterate on
        w2 - the second word to iterate on
        nextRandom - nextRandom for sampling
        alpha - the alpha to use for learning
      • putVector

        void putVector​(String word,
                       org.nd4j.linalg.api.ndarray.INDArray vector)
        Inserts a word vector
        Parameters:
        word - the word to insert
        vector - the vector to insert
      • vector

        org.nd4j.linalg.api.ndarray.INDArray vector​(String word)
        Parameters:
        word -
        Returns:
      • resetWeights

        void resetWeights()
        Reset the weights of the cache
      • setLearningRate

        void setLearningRate​(double lr)
        Sets the learning rate
        Parameters:
        lr -
      • vectors

        Iterator<org.nd4j.linalg.api.ndarray.INDArray> vectors()
        Iterates through all of the vectors in the cache
        Returns:
        an iterator for all vectors in the cache
      • getWeights

        org.nd4j.linalg.api.ndarray.INDArray getWeights()
      • getVocabCache

        VocabCache<T> getVocabCache()
        Returns corresponding vocabulary