public class FrequencyGrid extends HyperHeuristicGrid
The Input can be an ArrayList of ArrayList of: strings (concepts) or MetricValue
s
that are concepts (getName()) with scores (getValue() of type Double).
If scores are present, the count in incremented by the score, if concepts only, then the increment is 1.
Memory use is a problem, but it should be OK for 5000 or more concepts, or a 5000 x 5000 grid.
There are two clustering versions, labelled as SolverConst
.FREQGRIDV1
or .FREQGRIDV2
.
The first version probably produces more clusters but maybe also more isolated rows.
The second version probably produces fewer clusters but also fewer isolated rows.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
gridName
The name of the grid
|
protected java.lang.String |
version
Which version to use.
|
errorFeedback, gridSolution, gridType, lib
Constructor and Description |
---|
FrequencyGrid(TestSpec testSpec)
Create a new instance of FrequencyGrid.
|
Modifier and Type | Method and Description |
---|---|
void |
clusters()
Determine the best clusters based on the frequency counts and the selected
version . |
protected void |
clustersV1()
Determine the best clusters based on the frequency counts.
|
protected void |
clustersV2()
Determine the best clusters based on the frequency counts.
|
void |
copyGridCells(java.util.ArrayList<org.ai_heuristic.eval.metric.MetricDataset> theGridCells)
Set the array of grid of cell values to process.
|
void |
frequencyCounts(java.util.ArrayList<java.lang.String> dataRow)
Update the frequency counts for the cells in the data row - rows and columns.
|
java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> |
getClusterIndexes()
Get the grouped index sets for the input data, for each cluster.
|
java.util.ArrayList<java.util.ArrayList<CellCount>> |
getClusters()
Get the list of concepts grouped together into each cluster.
|
java.util.ArrayList<java.util.ArrayList<java.lang.String>> |
getGridCells()
Get the array of grid cell values.
|
Result |
getGridSolution()
Get the list of solutions that are part of a best match.
|
protected void |
initialiseData()
Initialise the data for solving.
|
boolean |
newCategories(java.util.ArrayList<java.lang.String> dataRow)
Check if the data row contains new categories and add to
categories list. |
void |
newGridRows()
Add new row and column cells for any new categories.
|
void |
resetValues()
Reset some values
|
void |
setGridCells(java.util.ArrayList<java.util.ArrayList<java.lang.String>> theGridCells)
Set the array of grid of cell values to process.
|
void |
setGridName(java.lang.String theGridName)
Set the name of the grid.
|
void |
solve()
Solve the currently saved grid.
|
getErrorFeedback, getGridName, getGridType
protected java.lang.String gridName
protected java.lang.String version
public FrequencyGrid(TestSpec testSpec)
testSpec
- the test specification. The only required fields are:testSpec.getTestScript().getTokenizer()
is the dta tokenizer, and testSpec.getTestScript().metricType
is the cluster algorithm choice.public void resetValues()
public void solve() throws java.lang.Exception
solve
in class HyperHeuristicGrid
java.lang.Exception
- any error.public void frequencyCounts(java.util.ArrayList<java.lang.String> dataRow) throws java.lang.Exception
dataRow
- the data row with the cell names.java.lang.Exception
- any error.public void clusters() throws java.lang.Exception
version
.java.lang.Exception
- any error.protected void clustersV1() throws java.lang.Exception
java.lang.Exception
- any error.protected void clustersV2() throws java.lang.Exception
java.lang.Exception
- any error.protected void initialiseData() throws java.lang.Exception
java.lang.Exception
- any error.public boolean newCategories(java.util.ArrayList<java.lang.String> dataRow)
categories
list.dataRow
- the data row.public void newGridRows()
public void setGridName(java.lang.String theGridName)
setGridName
in class HyperHeuristicGrid
theGridName
- the name of the grid.public void copyGridCells(java.util.ArrayList<org.ai_heuristic.eval.metric.MetricDataset> theGridCells)
theGridCells
- the array of cell values.public void setGridCells(java.util.ArrayList<java.util.ArrayList<java.lang.String>> theGridCells)
theGridCells
- the array of cell values.public java.util.ArrayList<java.util.ArrayList<java.lang.String>> getGridCells()
public java.util.ArrayList<java.util.ArrayList<CellCount>> getClusters()
public java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> getClusterIndexes()
public Result getGridSolution() throws java.lang.Exception
getGridSolution
in class HyperHeuristicGrid
java.lang.Exception
- any error.