public abstract class AbstractDataIndexer extends Object implements DataIndexer
| Modifier and Type | Field and Description |
|---|---|
protected int[][] |
contexts
The integer contexts associated with each unique event.
|
protected int[] |
numTimesEventsSeen
The number of times an event occured in the training data.
|
protected String[] |
outcomeLabels
The names of the outcomes.
|
protected int[] |
outcomeList
The integer outcome associated with each unique event.
|
protected int[] |
predCounts
The number of times each predicate occured.
|
protected String[] |
predLabels
The predicate/context names.
|
| Constructor and Description |
|---|
AbstractDataIndexer() |
| Modifier and Type | Method and Description |
|---|---|
int[][] |
getContexts()
Returns the array of predicates seen in each event.
|
int |
getNumEvents()
Returns the number of total events indexed.
|
int[] |
getNumTimesEventsSeen()
Returns an array indicating the number of times a particular event was seen.
|
String[] |
getOutcomeLabels()
Returns an array of outcome names.
|
int[] |
getOutcomeList()
Returns an array indicating the outcome index for each event.
|
int[] |
getPredCounts()
Returns an array of the count of each predicate in the events.
|
String[] |
getPredLabels()
Returns an array of predicate/context names.
|
float[][] |
getValues()
Returns the values associated with each event context or null if integer values are to be used.
|
protected int |
sortAndMerge(List<ComparableEvent> eventsToCompare,
boolean sort)
Sorts and uniques the array of comparable events and return the number of unique events.
|
protected static String[] |
toIndexedStringArray(Map<String,Integer> labelToIndexMap)
Utility method for creating a String[] array from a map whose
keys are labels (Strings) to be stored in the array and whose
values are the indices (Integers) at which the corresponding
labels should be inserted.
|
protected static void |
update(String[] ec,
Set<String> predicateSet,
Map<String,Integer> counter,
int cutoff)
Updates the set of predicated and counter with the specified event contexts and cutoff.
|
protected int[][] contexts
protected int[] outcomeList
protected int[] numTimesEventsSeen
protected String[] predLabels
protected String[] outcomeLabels
protected int[] predCounts
public int[][] getContexts()
DataIndexergetContexts in interface DataIndexerpublic int[] getNumTimesEventsSeen()
DataIndexergetNumTimesEventsSeen in interface DataIndexerpublic int[] getOutcomeList()
DataIndexergetOutcomeList in interface DataIndexerpublic String[] getPredLabels()
DataIndexergetPredLabels in interface DataIndexergetContexts.public String[] getOutcomeLabels()
DataIndexergetOutcomeLabels in interface DataIndexerpublic int[] getPredCounts()
DataIndexergetPredCounts in interface DataIndexerprotected int sortAndMerge(List<ComparableEvent> eventsToCompare, boolean sort)
eventsToCompare - a ComparableEvent[] valuepublic int getNumEvents()
DataIndexergetNumEvents in interface DataIndexerprotected static void update(String[] ec, Set<String> predicateSet, Map<String,Integer> counter, int cutoff)
ec - The contexts/features which occur in a event.predicateSet - The set of predicates which will be used for model building.counter - The predicate counters.cutoff - The cutoff which determines whether a predicate is included.protected static String[] toIndexedStringArray(Map<String,Integer> labelToIndexMap)
labelToIndexMap - a TObjectIntHashMap valueString[] valuepublic float[][] getValues()
DataIndexergetValues in interface DataIndexerCopyright © 2016 The Apache Software Foundation. All rights reserved.