public abstract class HyperrectanglesAlgorithm
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int[][] |
confMatrix
Confusion matrix for test
|
protected long |
initialTime
Initial time.
|
protected int |
inputAtt
Number of input attributes
|
protected Attribute[] |
inputs
Inputs attributes
|
protected double |
modelTime
Generation model time.
|
protected java.lang.String |
name
Naming.
|
protected int |
nClasses
Number of classes.
|
protected int[] |
nInstances
Number of instances of each classes.
|
protected boolean[] |
nulls
Missing values of a instance
|
protected java.lang.String[] |
outFile
Output files names
|
protected Attribute |
output
Output attribute
|
protected int[][] |
prediction
predictions for test
|
protected int[][] |
realClass
real classes values for test
|
protected InstanceSet |
reference
Reference dataset
|
protected double[][] |
referenceData
Reference input data.
|
protected java.lang.String |
referenceFile
Reference file name
|
protected int[] |
referenceOutput
Reference output data.
|
protected java.lang.String |
relation
Relation string.
|
protected java.lang.String |
ruleSetText
Rules set text
|
protected long |
seed
Random seed.
|
protected Instance |
temp
Temporal instance.
|
protected InstanceSet |
test
Test dataset
|
protected double[][] |
testData
Test input data.
|
protected java.lang.String |
testFile
Test file name
|
protected int[] |
testOutput
Test output data.
|
protected double |
testTime
Test prediction time.
|
protected InstanceSet |
train
Training dataset
|
protected int[][] |
trainConfMatrix
Confusion matrix for training
|
protected double[][] |
trainData
Training input data.
|
protected java.lang.String |
trainFile
Train file name
|
protected double |
trainingTime
Training prediction time.
|
protected int[] |
trainOutput
Training output data.
|
protected int[][] |
trainPrediction
Predictions for training
|
protected int[][] |
trainRealClass
real classes values for training
|
protected int |
trainUnclassified
number of instances unclassified for training
|
protected int |
unclassified
number of instances unclassified for test
|
Constructor and Description |
---|
HyperrectanglesAlgorithm() |
Modifier and Type | Method and Description |
---|---|
protected double |
euclideanDistance(double[] instance1,
double[] instance2)
Calculates the Euclidean distance between two instances
|
protected abstract int |
evaluate(double[] example)
Evaluates a instance to predict its class.
|
void |
execute()
Executes the classification of train and test data sets
|
void |
executeReference()
Executes the classification of reference and test data sets
|
protected double |
manhattanDistance(double[] instance1,
double[] instance2)
Calculates the Manhattan distance between two instances
|
protected void |
normalizeReference()
This function builds the data matrix for reference data and normalizes inputs values
|
protected void |
normalizeTest()
This function builds the data matrix for test data and normalizes inputs values
|
protected void |
normalizeTrain()
This function builds the data matrix for training data and normalizes inputs values
|
static java.lang.String |
printInstance(int[] instance)
Generates a string with the contents of the instance
|
protected void |
readConfiguracion(java.lang.String script)
Reads configuration script, and extracts its contents.
|
protected void |
readDataFiles(java.lang.String script)
Read the configuration and data files, and process it.
|
protected abstract void |
readParameters(java.lang.String script)
Reads the parameters of the algorithm.
|
protected boolean |
same(double[] a,
double[] b)
Checks if two instances are the same
|
protected void |
setInitialTime()
Sets the time counter
|
protected abstract int |
writeRules()
Writes the final ruleset obtained, in the ruleSetText variable.
|
protected java.lang.String[] outFile
protected java.lang.String testFile
protected java.lang.String trainFile
protected java.lang.String referenceFile
protected InstanceSet train
protected InstanceSet test
protected InstanceSet reference
protected Instance temp
protected int inputAtt
protected Attribute[] inputs
protected Attribute output
protected boolean[] nulls
protected double[][] trainData
protected int[] trainOutput
protected double[][] testData
protected int[] testOutput
protected double[][] referenceData
protected int[] referenceOutput
protected java.lang.String relation
protected int nClasses
protected int[] nInstances
protected long initialTime
protected double modelTime
protected double trainingTime
protected double testTime
protected java.lang.String name
protected long seed
protected int[][] confMatrix
protected int unclassified
protected int[][] realClass
protected int[][] prediction
protected int[][] trainConfMatrix
protected int trainUnclassified
protected int[][] trainRealClass
protected int[][] trainPrediction
protected java.lang.String ruleSetText
protected void readDataFiles(java.lang.String script)
script
- Name of the configuration scriptprotected void readConfiguracion(java.lang.String script)
script
- Name of the configuration scriptprotected abstract void readParameters(java.lang.String script)
script
- Configuration scriptprotected void normalizeTrain() throws DataException
DataException
- if the data cant be read correctlyprotected void normalizeTest() throws DataException
DataException
- if the data cant be read correctlyprotected void normalizeReference() throws DataException
DataException
- if the data cant be read correctlypublic void execute()
public void executeReference()
protected abstract int evaluate(double[] example)
example
- Instance evaluatedprotected double euclideanDistance(double[] instance1, double[] instance2)
instance1
- First instanceinstance2
- Second instanceprotected double manhattanDistance(double[] instance1, double[] instance2)
instance1
- First instanceinstance2
- Second instanceprotected boolean same(double[] a, double[] b)
a
- First instanceb
- Second instancepublic static java.lang.String printInstance(int[] instance)
instance
- Instance to print.protected void setInitialTime()
protected abstract int writeRules()