public abstract class SequenceElement extends java.lang.Object implements java.lang.Comparable<SequenceElement>, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected short |
codeLength |
protected java.util.List<java.lang.Byte> |
codes |
protected com.google.common.util.concurrent.AtomicDouble |
elementFrequency |
protected int |
index |
protected boolean |
init |
protected boolean |
isLabel |
protected java.util.List<java.lang.Integer> |
points |
protected java.util.concurrent.atomic.AtomicLong |
sequencesCount |
protected boolean |
special |
protected java.lang.Long |
storageId |
Constructor and Description |
---|
SequenceElement() |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(SequenceElement o) |
boolean |
equals(java.lang.Object object)
Equals method override should be properly implemented for any extended class, otherwise it will be based on label equality
|
int |
getCodeLength()
Returns Huffman code length.
|
java.util.List<java.lang.Byte> |
getCodes()
Returns Huffman tree codes
|
double |
getElementFrequency()
This method returns SequenceElement's frequency in current training corpus.
|
double |
getGradient(int index,
double g,
double lr)
Deprecated.
|
org.nd4j.linalg.api.ndarray.INDArray |
getHistoricalGradient()
Deprecated.
|
int |
getIndex()
Returns index in Huffman tree
|
abstract java.lang.String |
getLabel()
This method should return string representation of this SequenceElement, so it can be used for
|
static long |
getLongHash(java.lang.String string) |
java.util.List<java.lang.Integer> |
getPoints()
Returns Huffman tree points
|
long |
getSequencesCount()
This method returns number of documents/sequences where this element was evidenced
|
java.lang.Long |
getStorageId() |
int |
hashCode()
hashCode method override should be properly implemented for any extended class, otherwise it will be based on label hashCode
|
void |
increaseElementFrequency(int by)
Increases element frequency counter by argument
|
void |
incrementElementFrequency()
Increases element frequency counter by 1
|
void |
incrementSequencesCount()
Increments document count by one
|
void |
incrementSequencesCount(long count)
Increments document count by specified value
|
boolean |
isLabel()
Returns whether this element was defined as label, or no
|
static org.nd4j.shade.jackson.databind.ObjectMapper |
mapper() |
void |
markAsLabel(boolean isLabel)
This method specifies, whether this element should be treated as label for some sequence/document or not.
|
void |
setCodeLength(short codeLength)
This method fills codes and points up to codeLength
|
void |
setCodes(java.util.List<java.lang.Byte> codes)
Sets Huffman tree codes
|
void |
setElementFrequency(long value)
This method sets frequency value for this element
|
void |
setHistoricalGradient(org.nd4j.linalg.api.ndarray.INDArray gradient)
Deprecated.
|
void |
setIndex(int index)
Sets index in Huffman tree
|
void |
setPoints(int[] points)
Sets Huffman tree points
|
void |
setPoints(java.util.List<java.lang.Integer> points)
Sets Huffman tree points
|
void |
setSequencesCount(long count)
This method sets documents count to specified value
|
abstract java.lang.String |
toJSON() |
java.lang.String |
toString() |
protected com.google.common.util.concurrent.AtomicDouble elementFrequency
protected int index
protected java.util.List<java.lang.Byte> codes
protected java.util.List<java.lang.Integer> points
protected short codeLength
protected boolean special
protected boolean isLabel
protected java.util.concurrent.atomic.AtomicLong sequencesCount
protected boolean init
protected java.lang.Long storageId
public abstract java.lang.String getLabel()
public long getSequencesCount()
public void setSequencesCount(long count)
count
- public void incrementSequencesCount()
public void incrementSequencesCount(long count)
count
- public boolean isLabel()
public void markAsLabel(boolean isLabel)
isLabel
- public double getElementFrequency()
public void setElementFrequency(long value)
value
- public void incrementElementFrequency()
public void increaseElementFrequency(int by)
by
- public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- public int getIndex()
public void setIndex(int index)
index
- public java.util.List<java.lang.Byte> getCodes()
public void setCodes(java.util.List<java.lang.Byte> codes)
codes
- public java.util.List<java.lang.Integer> getPoints()
public void setPoints(java.util.List<java.lang.Integer> points)
points
- public void setPoints(int[] points)
points
- public int getCodeLength()
public void setCodeLength(short codeLength)
codeLength
- public static final long getLongHash(@NonNull java.lang.String string)
@Deprecated public double getGradient(int index, double g, double lr)
index
- g
- lr
- @Deprecated public void setHistoricalGradient(org.nd4j.linalg.api.ndarray.INDArray gradient)
@Deprecated public org.nd4j.linalg.api.ndarray.INDArray getHistoricalGradient()
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(SequenceElement o)
compareTo
in interface java.lang.Comparable<SequenceElement>
public java.lang.String toString()
toString
in class java.lang.Object
public abstract java.lang.String toJSON()
public java.lang.Long getStorageId()
public static org.nd4j.shade.jackson.databind.ObjectMapper mapper()