ConvertToInstances
MonotonicUnionContainer
, StandardUnionContainer
public abstract class UnionContainer extends ApproximatedEntityContainer implements ConvertToInstances
Modifier and Type | Field | Description |
---|---|---|
static int |
AT_LEAST |
TODO add description
|
static int |
AT_MOST |
TODO add description
|
static int |
ORIGINAL |
TODO add description
|
Constructor | Description |
---|---|
UnionContainer(MemoryContainer memoryContainer) |
Constructor for
UnionContainer class.Stores given reference to memory container, calculates decision criterion number and all basic classes and creates all upward and downward unions. |
UnionContainer(MemoryContainer memoryContainer,
int decisionCriterionNumber) |
Constructor for
UnionContainer class.Stores given reference to memory container and decision criterion number, calculates all basic classes and creates all upward and downward unions. All exceptions that may be thrown by this method come from protected validate() method,
which is called here. |
UnionContainer(MemoryContainer memoryContainer,
int decisionCriterionNumber,
Union[] upwardUnions,
Union[] downwardUnions) |
Constructor for
UnionContainer class.Stores given reference to memory container, decision criterion number, upward unions, downward unions and calculates all basic classes. This method may throw described exceptions as well as exceptions which come from protected validate() method,
which is called here. |
Modifier and Type | Method | Description |
---|---|---|
java.lang.Object |
clone() |
Clones this union container
|
weka.core.Instances |
convertToInstances(int type) |
Converts objects from union container to WEKA component instances.
|
weka.core.Instances |
convertToInstances(int type,
double VCDRSAParameterValue) |
Converts objects from union container to WEKA component instances.
|
weka.core.Instances |
convertToInstancesLowerBoundDecision() |
TODO add description
|
weka.core.Instances |
convertToInstancesLowerBoundDecision(double VCDRSAParameterValue) |
TODO add description
|
weka.core.Instances |
convertToInstancesOriginalDecision() |
TODO add description
|
weka.core.Instances |
convertToInstancesOriginalDecision(double VCDRSAParameterValue) |
TODO add description
|
weka.core.Instances |
convertToInstancesUpperBoundDecision() |
TODO add description
|
weka.core.Instances |
convertToInstancesUpperBoundDecision(double VCDRSAParameterValue) |
TODO add description
|
Field[] |
getBasicClasses() |
Gets ordered (from the worst to the best) array of all decision classes, which can be found in memory container.
|
int |
getDecisionCriterionNumber() |
Gets number of considered decision criterion in memory container
|
abstract java.lang.String |
getDefaultComment() |
Gets default comment for this union container
|
Union[] |
getDownwardUnions() |
Gets array containing all downward unions which can be defined for memory container.
|
double |
getQualityOfApproximation(byte[] attributesMask) |
Gets quality of approximation of all unions which can be defined for memory container (decision table or PCT).
Uses given mask for attributes or considers all attributes if mask is null . |
double |
getQualityOfApproximation(double VCDRSAParameterValue,
byte[] attributesMask) |
Gets quality of approximation of all unions which can be defined for memory container (decision table or PCT).
|
Union |
getUnion(int type,
Field basicClass) |
Gets upward/downward union of decision classes (depending on
type ), with given basic class. |
Union[] |
getUpwardUnions() |
Gets array containing all upward unions which can be defined for memory container.
|
abstract boolean |
isWriteDateToFile() |
Tells if 'Date' tag should be present in *.apx or *.regions file to which this container is saved.
|
void |
reset() |
Forces re-calculation of basic classes and re-creation or reset of all upward and downward unions
(re-creation if basic classes changed, reset when basic classes remained unchanged).
|
void |
saveArffFile(java.lang.String fileName) |
Writes unions in WEKA ARFF file format.
|
void |
saveArffFile(java.lang.String lowerBoundFileName,
java.lang.String upperBoundFileName) |
Creates two files with lower bounds and upper bounds of decision for all
objects from lower approximations, in WEKA ARFF file format.
|
void |
saveArffFile(java.lang.String lowerBoundFileName,
java.lang.String upperBoundFileName,
double VCDRSAParameterValue) |
Creates two files with lower bounds and upper bounds of decision for all
objects from lower approximations, in WEKA ARFF file format.
|
java.lang.String |
toString() |
Creates a string with information about overall approximation quality and approximation
accuracies in the unions of classes stored in this container.
|
void |
writeApproximations(java.lang.String fileName,
double VCDRSAParameterValue,
boolean writeDominationInformation,
java.lang.String comment) |
Writes approximations for given VC-DRSA parameter value to the file with given name (path).
|
void |
writePosNegBndRegionsExamples(java.lang.String fileName,
double VCDRSAParameterValue,
java.lang.String comment) |
Writes POS, NEG and BND regions for given VC-DRSA parameter value to the file with given name (path).
|
getMemoryContainer, getQualityOfApproximation, getQualityOfApproximation
public static final int AT_LEAST
public static final int AT_MOST
public static final int ORIGINAL
public UnionContainer(MemoryContainer memoryContainer, int decisionCriterionNumber)
UnionContainer
class.validate()
method,
which is called here.memoryContainer
- reference to memory container for which this union container is defineddecisionCriterionNumber
- number of decision criterion for which this union container is definedpublic UnionContainer(MemoryContainer memoryContainer, int decisionCriterionNumber, Union[] upwardUnions, Union[] downwardUnions)
UnionContainer
class.validate()
method,
which is called here.memoryContainer
- reference to memory container for which this union container is defineddecisionCriterionNumber
- number of decision criterion for which this union container is definedupwardUnions
- array of upward unions which should be stored in this container.
Unions must be sorted from the most specific to the least specific one.downwardUnions
- array of downward unions which should be stored in this container.
Unions must be sorted from the most specific to the least specific one.java.lang.NullPointerException
- when given upward or downward unions are null
InvalidValueException
- when the number of upward or downward unions is incorrect for given memory container
or when any basic class for any of given upward/downward unions is incorrect (which may happen for example
when upward/downward unions are not sorted from the most specific to the least specific one)public UnionContainer(MemoryContainer memoryContainer)
UnionContainer
class.InvalidValueException
is thrown. Otherwise found attribute becomes decision criterion
for which this union container is defined.validateMemoryContainer()
and validateDecisionCriterionNumber()
methods, which are called here.memoryContainer
- reference to memory container for which this union container is definedInvalidValueException
- when quantity of active decision criteria is different than onepublic abstract boolean isWriteDateToFile()
true
if 'Date' tag should be present in *.apx or *.regions file to which this container is saved,
false
otherwisepublic abstract java.lang.String getDefaultComment()
public void reset()
validate()
method and throws
appropriate exception if any irregularity has been found.validate()
method,
which is called here.public double getQualityOfApproximation(byte[] attributesMask)
null
.
If attributesMask(i) = 0 then corresponding attribute should be ignored.
Any non-zero value means that corresponding attribute should be considered.
In fact only mask values corresponding to active and condition attributes are important.
All other values are not taken into account and may be any.getQualityOfApproximation(double, byte[])
method and passes the most restrictive VC-DRSA parameter value.getQualityOfApproximation
in class ApproximatedEntityContainer
attributesMask
- Mask for attributes allowing quality of approximation calculations for a subset
of active and condition attributes.
It is checked if length of the mask is equal to the number of attributes in memory container.
If attributesMask(i) is equal to zero, than corresponding attribute is not taken into account
at all when calculating quality of approximation. If attributesMask(i) is different than zero,
than corresponding attribute is taken into account when calculating quality of approximation.InvalidValueException
- when length of the mask for attributes is different than number of attributes
in memory containerpublic double getQualityOfApproximation(double VCDRSAParameterValue, byte[] attributesMask)
null
.
If attributesMask(i) = 0 then corresponding attribute should be ignored.
Any non-zero value means that corresponding attribute should be considered.
In fact only mask values corresponding to active and condition attributes are important.
All other values are not taken into account and may be any.getQualityOfApproximation
in class ApproximatedEntityContainer
VCDRSAParameterValue
- VC-DRSA parameter value for which boundaries of all ascending unions should be calculated (VC-DRSA)attributesMask
- Mask for attributes allowing quality of approximation calculations for a subset
of active and condition attributes.
It is checked if length of the mask is equal to the number of attributes in memory container.
If attributesMask(i) is equal to zero, than corresponding attribute is not taken into account
at all when calculating quality of approximation. If attributesMask(i) is different than zero,
than corresponding attribute is taken into account when calculating quality of approximation.InvalidValueException
- when VC-DRSA parameter value is outside [0, 1] range
or when length of the mask for attributes is different than number of attributes in memory containerpublic int getDecisionCriterionNumber()
public Field[] getBasicClasses()
basicClasses
.public Union[] getUpwardUnions()
public Union[] getDownwardUnions()
public void writePosNegBndRegionsExamples(java.lang.String fileName, double VCDRSAParameterValue, java.lang.String comment) throws java.io.IOException
fileName
- name of the file in which POS, NEG and BND regions' examples should be savedVCDRSAParameterValue
- VC-DRSA parameter value for which unions' POS, NEG and BND regions
should be calculatedcomment
- Comment which will be written to saved regions file in Rem1
tag. Can be null
,
in which case default comment (see defaultComment
field) is written to file.InvalidValueException
- when VC-DRSA parameter value is not in [0, 1] rangejava.io.IOException
- if file with given name can't be opened for writepublic void writeApproximations(java.lang.String fileName, double VCDRSAParameterValue, boolean writeDominationInformation, java.lang.String comment) throws java.io.IOException
fileName
- name of the file in which approximations should be savedVCDRSAParameterValue
- VC-DRSA parameter value for which unions' approximations and boundaries
should be calculatedwriteDominationInformation
- switch for changing output file contents. If equal to true
,
P-dominating and P-dominated sets will be saved to file. If equal to false
, sets will
not be saved (storage savings).comment
- comment which will be written to saved apx file in Rem1
tag. Can be null
in which case default comment (see defaultComment
field) is written to file.InvalidValueException
- when VC-DRSA parameter value is not in [0, 1] rangejava.io.IOException
- if file with given name can't be opened for writepublic weka.core.Instances convertToInstances(int type)
type
- this parameter takes tree possible values:
ORIGINAL
- objects get original value from the data set,
AT_LEAST
- lower bound of decision is assigned,
AT_MOST
- upper bound of decision is assigned.public weka.core.Instances convertToInstances(int type, double VCDRSAParameterValue)
type
- this parameter takes tree possible values:
ORIGINAL
- objects get original value from the data set,
AT_LEAST
- lower bound of decision is assigned,
AT_MOST
- upper bound of decision is assigned.VCDRSAParameterValue
- VC-DRSA parameter value for which lower approximations
are calculated. This parameter is taken into account only when
type is different than ORIGINAL
.public weka.core.Instances convertToInstancesOriginalDecision()
convertToInstancesOriginalDecision
in interface ConvertToInstances
public weka.core.Instances convertToInstancesOriginalDecision(double VCDRSAParameterValue)
VCDRSAParameterValue
- TODO add descriptionpublic weka.core.Instances convertToInstancesLowerBoundDecision()
convertToInstancesLowerBoundDecision
in interface ConvertToInstances
public weka.core.Instances convertToInstancesLowerBoundDecision(double VCDRSAParameterValue)
VCDRSAParameterValue
- TODO add descriptionpublic weka.core.Instances convertToInstancesUpperBoundDecision()
convertToInstancesUpperBoundDecision
in interface ConvertToInstances
public weka.core.Instances convertToInstancesUpperBoundDecision(double VCDRSAParameterValue)
VCDRSAParameterValue
- TODO add descriptionpublic void saveArffFile(java.lang.String fileName) throws java.io.IOException
saveArffFile
in interface ConvertToInstances
fileName
- name of file to which unions are savedjava.io.IOException
- TODO add descriptionpublic void saveArffFile(java.lang.String lowerBoundFileName, java.lang.String upperBoundFileName) throws java.io.IOException
saveArffFile
in interface ConvertToInstances
lowerBoundFileName
- name of file in which objects with lower bound
of decision are saved.upperBoundFileName
- name of file in which objects with upper bound
of decision are saved.java.io.IOException
- TODO add descriptionpublic void saveArffFile(java.lang.String lowerBoundFileName, java.lang.String upperBoundFileName, double VCDRSAParameterValue) throws java.io.IOException
lowerBoundFileName
- name of file in which objects with lower bound
of decision are saved.upperBoundFileName
- name of file in which objects with upper bound
of decision are saved.VCDRSAParameterValue
- VC-DRSA parameter value at which lower approximations
are calculated.java.io.IOException
- TODO add descriptionpublic Union getUnion(int type, Field basicClass)
type
), with given basic class.type
- type of the union sought-afterbasicClass
- basic class of the union sought-aftertype
), with given basic class, or null
if the union sought-after is not present in this containerpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object clone()
clone
in class ApproximatedEntityContainer