Packages

object LinAlg

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LinAlg
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def argmax(scores: Array[Float]): Int

    Gets the index with the highest score.

    Gets the index with the highest score.

    scores

    Array of Scores to max

    returns

    Index of the highest score

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def avgPooling(flattenEmbeddings: Array[Float], attentionMask: Array[Array[Long]], shape: Array[Long]): DenseMatrix[Float]

    Performs average pooling on embeddings using an attention mask.

    Performs average pooling on embeddings using an attention mask.

    This method takes flattened embeddings, an attention mask, and the shape of the embeddings, and computes the average pooling. The pooling is done by grouping the embeddings based on the attention mask and computing the weighted sum of these groups. The result is normalized by the total weight of the attention mask.

    flattenEmbeddings

    Array of flattened embeddings

    attentionMask

    2D Array representing the attention mask

    shape

    Array representing the shape of the embeddings (dimensions)

    returns

    A DenseMatrix of floats representing the average pooled embeddings

  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  8. def denseMatrixToArray(matrix: DenseMatrix[Float]): Array[Array[Float]]

    Converts a DenseMatrix to a 2D array of floats.

    Converts a DenseMatrix to a 2D array of floats.

    This method is used to transform a DenseMatrix[Float] into a two-dimensional array. It iterates over the rows and columns of the DenseMatrix, copying each element into the corresponding position in the newly created 2D array.

    matrix

    DenseMatrix[Float] that needs to be converted to a 2D array

    returns

    An 2D array representing the same data as the input DenseMatrix

  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. def l2Normalize(embeddings: DenseMatrix[Float]): DenseMatrix[Float]

    Normalizes each row of a DenseMatrix using the L2 norm.

    Normalizes each row of a DenseMatrix using the L2 norm.

    This method applies L2 normalization to the embeddings. It first computes the L2 norm for each row (embedding) in the input matrix. Then, it creates a matrix where each row is the computed norms vector, ensuring the dimensions match the input embeddings. Finally, it normalizes each row in the embeddings by dividing by the corresponding L2 norm.

    The result is a DenseMatrix where each row (embedding) is L2 normalized, ensuring that embeddings have a consistent scale for further processing.

    embeddings

    DenseMatrix[Float] representing the embeddings to be normalized

    returns

    DenseMatrix[Float] where each row is an L2 normalized version of the corresponding row in the input matrix

  16. def lpNormalizeArray(array: Array[Float], p: Int = 2): Array[Float]
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def softmax(logitValues: Array[Float]): Array[Float]

    Calculates softmax probabilities for an array of logits.

    Calculates softmax probabilities for an array of logits.

    logitValues

    Predicted raw logits

    returns

    Probabilities for each class

  21. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  26. object implicits

Inherited from AnyRef

Inherited from Any

Ungrouped