Object/Class

org.clulab.dynet

Utils

Related Docs: class Utils | package dynet

Permalink

object Utils

Utility methods used by DyNet applications

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

Type Members

  1. class ByLineArrayBuilder extends ByLineBuilder[ArrayBuffer[String], Array[String], IndexedSeq[String]]

    Permalink
  2. abstract class ByLineBuilder[IntermediateValueType, FinalValueType, DefaultValueType] extends AnyRef

    Permalink
  3. class ByLineCharIntMapBuilder extends ByLineMapBuilder[Char]

    Permalink
  4. class ByLineCharMapBuilder extends ByLineMapBuilder[Char]

    Permalink
  5. class ByLineCounterBuilder[KeyType] extends ByLineBuilder[Counter[KeyType], Counter[KeyType], IndexedSeq[(KeyType, Double)]]

    Permalink
  6. class ByLineFloatBuilder extends ByLineBuilder[MutableNumber[Option[Float]], Float, Float]

    Permalink
  7. class ByLineIntBuilder extends ByLineBuilder[MutableNumber[Option[Int]], Int, Int]

    Permalink
  8. class ByLineMapBuilder[KeyType] extends ByLineBuilder[Map[KeyType, Int], Map[KeyType, Int], IndexedSeq[(KeyType, Int)]]

    Permalink
  9. class ByLineStringBuilder extends ByLineBuilder[HashSet[String], String, String]

    Permalink
  10. class ByLineStringCounterBuilder extends ByLineCounterBuilder[String]

    Permalink
  11. class ByLineStringMapBuilder extends ByLineMapBuilder[String]

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val DEFAULT_DROPOUT_PROBABILITY: Float

    Permalink
  5. val EOS_WORD: String

    Permalink
  6. val LOG_MIN_VALUE: Float

    Permalink
  7. val RANDOM_SEED: Long

    Permalink
  8. val START_TAG: String

    Permalink
  9. val STOP_TAG: String

    Permalink
  10. val UNK_EMBEDDING: Int

    Permalink
  11. val UNK_WORD: String

    Permalink
  12. val WEIGHT_DECAY: Float

    Permalink
  13. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. var concatenateCount: Int

    Permalink
  16. def concatenateStates(l1: Iterable[Expression], l2: Iterable[Expression]): Iterable[Expression]

    Permalink
  17. def emissionScoresToArrays(expressions: Iterable[Expression]): Array[Array[Float]]

    Permalink
  18. def emissionScoresToArraysAllTasks(expressions: Array[ExpressionVector]): Array[Array[Array[Float]]]

    Permalink
  19. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  21. def expressionDropout(expression: Expression, dropoutProb: Float, doDropout: Boolean): Expression

    Permalink
  22. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. def fromIndexToChar(s2i: Map[Char, Int]): Array[Char]

    Permalink
  24. def fromIndexToString(s2i: Map[String, Int]): Array[String]

    Permalink
  25. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  26. def getModHeadPairs(labels: IndexedSeq[Label]): Option[IndexedSeq[ModifierHeadPair]]

    Permalink
  27. def greedyPredict(lattice: Array[Array[Float]]): Array[Int]

    Permalink

    Runs a greedy algorithm to generate the sequence of tag ids, ignoring transition scores

  28. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  29. def initializeDyNet(autoBatch: Boolean = false, mem: String = ""): Unit

    Permalink
  30. def initializeEmbeddings(w2v: SanitizedWordEmbeddingMap, w2i: Map[String, Int], lookupParameters: LookupParameter): Unit

    Permalink
  31. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  32. def loadParameters(dynetFilename: String, modelParameters: ParameterCollection, key: String = "/all"): Unit

    Permalink
  33. def mkCharacterEmbedding(word: String, c2i: Map[Char, Int], charLookupParameters: LookupParameter, charFwRnnBuilder: RnnBuilder, charBwRnnBuilder: RnnBuilder): Expression

    Permalink
  34. def mkDynetFilename(baseFilename: String): String

    Permalink
  35. def mkPartitionScore(emissionScoresForSeq: ExpressionVector, transitionMatrix: ExpressionVector, startTag: Int, stopTag: Int): Expression

    Permalink

    Implements the forward algorithm to compute the partition score for this lattice This code inspired by this PyTorch implementation: https://pytorch.org/tutorials/beginner/nlp/advanced_tutorial.html

  36. def mkTransitionMatrix(parameters: ParameterCollection, t2i: Map[String, Int]): LookupParameter

    Permalink

    Initializes the transition matrix for a tagset of size size T[i, j] stores a transition *to* i *from* j

  37. def mkWordVocab(w2v: SanitizedWordEmbeddingMap): Map[String, Int]

    Permalink
  38. def mkX2iFilename(baseFilename: String): String

    Permalink
  39. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  40. def newPrintWriter(filename: String): PrintWriter

    Permalink
  41. def newSource(filename: String): Source

    Permalink
  42. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  43. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  44. def pick2D(matrix: ExpressionVector, row: Int, column: Int): Expression

    Permalink

    Picks the scalar element from an expression that is a matrix

  45. def printCoNLLOutput(pw: PrintWriter, words: IndexedSeq[String], golds: IndexedSeq[String], preds: IndexedSeq[String]): Unit

    Permalink
  46. def printTagScores(header: String, scores: Array[Float], i2t: Array[String]): Unit

    Permalink
  47. def readString2Ids(s2iFilename: String): Map[String, Int]

    Permalink
  48. def save(printWriter: PrintWriter, value: String, comment: String): Unit

    Permalink
  49. def save(printWriter: PrintWriter, value: Float, comment: String): Unit

    Permalink
  50. def save(printWriter: PrintWriter, value: Long, comment: String): Unit

    Permalink
  51. def save[T](printWriter: PrintWriter, values: Array[T], comment: String): Unit

    Permalink
  52. def save[T](printWriter: PrintWriter, values: Counter[T], comment: String)(implicit ev: (T) ⇒ Ordered[T]): Unit

    Permalink
  53. def save[T](printWriter: PrintWriter, values: Map[T, Int], comment: String)(implicit ev: (T) ⇒ Ordered[T]): Unit

    Permalink
  54. def saveCharMap(printWriter: PrintWriter, values: Map[Char, Int], comment: String): Unit

    Permalink
  55. def sentenceLossCrf(emissionScoresForSeq: ExpressionVector, transitionMatrix: ExpressionVector, golds: IndexedSeq[Int], t2i: Map[String, Int]): Expression

    Permalink

    Objective function that maximizes the CRF probability of the gold sequence of tags for a given sentence

    Objective function that maximizes the CRF probability of the gold sequence of tags for a given sentence

    emissionScoresForSeq

    emission scores for the whole sequence, and all tags

    transitionMatrix

    transition matrix between all tags

    golds

    gold sequence of tags

    returns

    the negative prob of the gold sequence (in log space)

  56. def sentenceLossGreedy(emissionScoresForSeq: ExpressionVector, golds: IndexedSeq[Int]): Expression

    Permalink

    Greedy loss function, ignoring transition scores

  57. def sentenceScore(emissionScoresForSeq: ExpressionVector, transitionMatrix: ExpressionVector, tagCount: Int, tagSeq: IndexedSeq[Int], startTag: Int, stopTag: Int): Expression

    Permalink

    Computes the score of the given sequence of tags (tagSeq)

  58. def setRnnDropout(rnnBuilder: RnnBuilder, dropoutProb: Float, doDropout: Boolean): Unit

    Permalink
  59. def srlPredict(lattice: Array[Array[Float]], predPosition: Int, oId: Int): Array[Int]

    Permalink
  60. def stringToChar(string: String): Char

    Permalink
    Attributes
    protected
  61. def stringToCharInt(string: String): Char

    Permalink
    Attributes
    protected
  62. def stringToString(string: String): String

    Permalink
    Attributes
    protected
  63. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  64. def toIds[T](tags: IndexedSeq[T], t2i: Map[T, Int]): IndexedSeq[Int]

    Permalink
  65. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  66. def transduce(embeddings: Iterable[Expression], builder: RnnBuilder): ExpressionVector

    Permalink
  67. def transduceLastOpt(embeddings: Iterable[Expression], builder: RnnBuilder): Option[Expression]

    Permalink
  68. def transitionMatrixToArrays(trans: LookupParameter, size: Int): Array[Array[Float]]

    Permalink
  69. def viterbi(emissionScores: Array[Array[Float]], transitionMatrix: Array[Array[Float]], tagCount: Int, startTagIdx: Int, stopTagIdx: Int): Array[Int]

    Permalink
  70. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  71. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  72. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped