MonotonicUnion
, StandardUnion
public abstract class Union extends ApproximatedEntity
Modifier and Type | Field | Description |
---|---|---|
static int |
ASCENDING |
Type of union, assigned when union is ascending which means that it contains examples from basic class x
or better.
|
static int |
AT_LEAST |
Alias for
Union.ASCENDING |
static int |
AT_MOST |
Alias for
Union.DESCENDING |
static int |
DESCENDING |
Type of union, assigned when union is descending which means that it contains examples from basic class x
or worse.
|
static int |
DOWNWARD |
Alias for
Union.DESCENDING |
static int |
UPWARD |
Alias for
Union.ASCENDING |
NONNEGATIVE_CONFIRMATION, POSITIVE_CONFIRMATION
Modifier and Type | Method | Description |
---|---|---|
java.lang.Object |
clone() |
Clones this union
|
boolean |
exampleBelongsToThisUnion(int exampleNumber) |
Checks if example with given number belongs to this union
|
Field |
getBasicClassForAdjacentOppositeUnion() |
Gets basic class for adjacent union of opposite type.
|
int |
getDecisionAttributeNumber() |
Gets the number of decision attribute for which this union is defined.
|
int |
getDecisionCriterionNumber() |
Gets the number of decision criterion for which this union is defined.
|
java.lang.String |
getDescription() |
Gets description of this union, showing its direction and basic class.
|
java.util.HashSet<java.lang.Integer> |
getNEGRegionExamples(byte[] attributesMask) |
Gets hash set with (
Integer ) numbers of examples belonging to negative (NEG) region of this union,
calculated for the most restrictive VC-DRSA parameter value (classical DRSA) and for given mask for attributes. |
java.util.HashSet<java.lang.Integer> |
getNEGRegionExamples(double VCDRSAParameterValue,
byte[] attributesMask) |
Gets hash set with (
Integer ) numbers of examples belonging to negative (NEG) region of this union,
calculated for given VC-DRSA parameter value and for given mask for attributes, according to used VC-DRSA. |
int |
getType() |
Gets type of this union
|
int[] |
getUpperApproximation(double VCDRSAParameterValue,
Union oppositeUnionForShiftedBasicClass) |
Gets numbers of examples belonging to upper approximation of this union.
|
int[] |
getUpperApproximation(double VCDRSAParameterValue,
Union oppositeUnionForShiftedBasicClass,
byte[] attributesMask) |
Gets numbers of examples belonging to upper approximation of this union.
|
int[] |
getUpperApproximation(Union oppositeUnionForShiftedBasicClass) |
Gets numbers of examples belonging to upper approximation of this union.
|
int[] |
getUpperApproximation(Union oppositeUnionForShiftedBasicClass,
byte[] attributesMask) |
Gets numbers of examples belonging to upper approximation of this union.
|
void |
reset() |
Resets all results of calculations stored in this union and causes that each first call to any 'get'
method retrieving any approximation, boundary, quality of approximation or accuracy of approximation
will be connected with additional (re)calculations.
|
void |
setBoundary(int[] boundary,
double boundaryVCParameterValue,
byte[] boundaryAttributesMask,
int boundaryPairFieldDominanceCheckMethod) |
Sets boundary of this union and all parameters describing conditions under which this boundary has been calculated
|
void |
setLowerApproximation(int[] lowerApproximation,
double lowerApproximationVCParameterValue,
byte[] lowerApproximationAttributesMask,
int lowerApproximationPairFieldDominanceCheckMethod) |
Sets lower approximation of this union and all parameters describing conditions under which this approximation has been calculated
|
void |
setUpperApproximation(int[] upperApproximation,
double upperApproximationVCParameterValue,
byte[] upperApproximationAttributesMask,
int upperApproximationPairFieldDominanceCheckMethod) |
Sets upper approximation of this union and all parameters describing conditions under which this approximation has been calculated
|
containsExample, getAccuracyOfApproximation, getAccuracyOfApproximation, getAccuracyOfApproximation, getAccuracyOfApproximation, getBasicClass, getBNDRegionExamples, getBNDRegionExamples, getBNDRegionExamples, getBNDRegionExamples, getBoundary, getBoundary, getBoundary, getBoundary, getCharacteristicDecisionClass, getExamples, getExamplesSet, getInconsistentExamplesForExtendedLowerApproximation, getInconsistentExamplesForExtendedLowerApproximation, getLowerApproximation, getLowerApproximation, getLowerApproximation, getLowerApproximation, getMemoryContainer, getNEGRegionExamples, getNEGRegionExamples, getNeutralExamples, getNeutralExamplesSet, getPOSRegionExamples, getPOSRegionExamples, getPOSRegionExamples, getPOSRegionExamples, getQualityOfApproximation, getQualityOfApproximation, getQualityOfApproximation, getQualityOfApproximation, getTheMostRestrictiveVariableConsistencyParameterValue, getUpperApproximation, getUpperApproximation, getUpperApproximation, getUpperApproximation, setBoundary, setLowerApproximation, setUpperApproximation, size, variableConsistencyParameterValueIsTheMostRestrictiveOne
public static final int ASCENDING
public static final int AT_LEAST
Union.ASCENDING
public static final int UPWARD
Union.ASCENDING
public static final int DESCENDING
public static final int AT_MOST
Union.DESCENDING
public static final int DOWNWARD
Union.DESCENDING
public int getType()
public int getDecisionCriterionNumber()
getDecisionAttributeNumber()
.public int getDecisionAttributeNumber()
getDecisionCriterionNumber()
.getDecisionAttributeNumber
in class ApproximatedEntity
public boolean exampleBelongsToThisUnion(int exampleNumber)
exampleNumber
- number of example which should be checkedtrue
if example with given number belongs to this union, false
otherwisepublic Field getBasicClassForAdjacentOppositeUnion()
ASCENDING
,
2 will be returned. If this union's basic class is 4 and this union's type is DESCENDING
,
5 will be returned.ASCENDING
and approximate rule was induced from boundary of that union,
then decision side of the rule should be (state >= medium) OR (state <= bad).
First condition can be easily created, using basic class and type of concerned union.
Relation in second condition is obvious since it has to be opposite to first relation.
This method may be used to calculate decision class from second condition.java.lang.UnsupportedOperationException
- see calculateAdjacentDecisionClass(int)
public int[] getUpperApproximation(Union oppositeUnionForShiftedBasicClass)
getUpperApproximation(Union, byte[])
method and passes null
as mask for attributes
to indicate that mask for attributes should not be used.getUpperApproximation(Union, byte[])
method.oppositeUnionForShiftedBasicClass
- reference to opposite union, defined for the same memory container
and the same decision criterion number and created for basic class different about 1.
For example if this union is ASCENDING
and its basicClass
is equal to 3,
then opposite union must be DESCENDING
with basicClass
equal to 2.
And if this union is DESCENDING
with basicClass
equal to 6,
then opposite union must be ASCENDING
with basicClass
equal to 7.
Opposite union reference is used only to get lower approximation of given union.
Upper approximation of this union is then calculated as the difference between all examples
from memory container and lower approximation of the opposite union with basic class different about one.InvalidValueException
- when given union is not opposite to this one,
when opposite union's basic class is incorrect,
when opposite union is defined for different decision criterion number
or when opposite union is defined for different memory container (reference comparison!)java.lang.ClassCastException
- when class of oppositeUnionForShiftedBasicClass
parameter
is different than class of this object and is not a subclass of class of this objectpublic int[] getUpperApproximation(Union oppositeUnionForShiftedBasicClass, 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.getUpperApproximation(byte[])
method is that when lower approximation
(for the most restrictive VC-DRSA parameter value and for the same mask for attributes) for given opposite union
with basic class different about one was calculated first (and thus automatically stored in the opposite union),
this method is much faster.oppositeUnionForShiftedBasicClass
- reference to opposite union, defined for the same memory container
and the same decision criterion number and created for basic class different about 1.
For example if this union is ASCENDING
and its basicClass
is equal to 3,
then opposite union must be DESCENDING
with basicClass
equal to 2.
And if this union is DESCENDING
with basicClass
equal to 6,
then opposite union must be ASCENDING
with basicClass
equal to 7.
Opposite union reference is used only to get lower approximation of given union,
for given mask for attributes.
Upper approximation of this union is then calculated as the difference between all examples
from memory container and lower approximation of the opposite union with basic class different about one.attributesMask
- mask for attributes allowing upper approximation calculations for a subset
of active and condition attributes.
It is checked if length of the mask is equal to the quantity of attributes in memory container.
If attributesMask(i) is equal to zero, than corresponding attribute is not taken into account
at all when calculating upper approximation. If attributesMask(i) is different than zero,
than corresponding attribute is taken into account when calculating upper approximation.InvalidValueException
- when given union is not opposite to this one,
when opposite union's basic class is incorrect,
when opposite union is defined for different decision criterion number,
when opposite union is defined for different memory container (reference comparison!)
or when length of the mask for attributes is different than quantity of attributes in memory containerjava.lang.ClassCastException
- when class of oppositeUnionForShiftedBasicClass
parameter
is different than class of this object and is not a subclass of class of this objectpublic int[] getUpperApproximation(double VCDRSAParameterValue, Union oppositeUnionForShiftedBasicClass)
getUpperApproximation(double, Union, byte[])
method and passes null
as mask for attributes
to indicate that mask for attributes should not be used.getUpperApproximation(double, Union, byte[])
method.VCDRSAParameterValue
- VC-DRSA parameter value for which upper approximation should be calculated (VC-DRSA)oppositeUnionForShiftedBasicClass
- reference to opposite union, defined for the same memory container
and the same decision criterion number and created for basic class different about 1.
For example if this union is ASCENDING
and its basicClass
is equal to 3,
then opposite union must be DESCENDING
with basicClass
equal to 2.
And if this union is DESCENDING
with basicClass
equal to 6,
then opposite union must be ASCENDING
with basicClass
equal to 7.
Opposite union reference is used only to get lower approximation of given union,
for given value of VC-DRSA parameter.
Upper approximation of this union is then calculated as the difference between all examples
from memory container and lower approximation of the opposite union with basic class different about one.InvalidValueException
- when VC-DRSA parameter value is outside [0, 1] range,
when given union is not opposite to this one,
when opposite union's basic class is incorrect,
when opposite union is defined for different decision criterion number
or when opposite union is defined for different memory container (reference comparison!)java.lang.ClassCastException
- when class of oppositeUnionForShiftedBasicClass
parameter
is different than class of this object and is not a subclass of class of this objectpublic int[] getUpperApproximation(double VCDRSAParameterValue, Union oppositeUnionForShiftedBasicClass, 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.getUpperApproximation(double, byte[])
method is that when lower approximation
(for the same VC-DRSA parameter value, for used VC-DRSA calculation method and for the same mask for attributes)
for given opposite union with basic class different about one
was calculated first (and thus automatically stored in the opposite union), this method is much faster.VCDRSAParameterValue
- VC-DRSA parameter value for which upper approximation should be calculated (VC-DRSA)oppositeUnionForShiftedBasicClass
- reference to opposite union, defined for the same memory container
and the same decision criterion number and created for basic class different about 1.
For example if this union is ASCENDING
and its basicClass
is equal to 3,
then opposite union must be DESCENDING
with basicClass
equal to 2.
And if this union is DESCENDING
with basicClass
equal to 6,
then opposite union must be ASCENDING
with basicClass
equal to 7.
Opposite union reference is used only to get lower approximation of given union,
for given value of VC-DRSA parameter and for given mask for attributes.
Upper approximation of this union is then calculated as the difference between all examples
from memory container and lower approximation of the opposite union with basic class different about one.attributesMask
- mask for attributes allowing upper approximation calculations for a subset
of active and condition attributes.
It is checked if length of the mask is equal to the quantity of attributes in memory container.
If attributesMask(i) is equal to zero, than corresponding attribute is not taken into account
at all when calculating upper approximation. If attributesMask(i) is different than zero,
than corresponding attribute is taken into account when calculating upper approximation.InvalidValueException
- when VC-DRSA parameter value is outside [0, 1] range,
when given union is not opposite to this one,
when opposite union's basic class is incorrect,
when opposite union is defined for different decision criterion number,
when opposite union is defined for different memory container (reference comparison!)
or when length of the mask for attributes is different than quantity of attributes in memory containerjava.lang.ClassCastException
- when class of oppositeUnionForShiftedBasicClass
parameter
is different than class of this object and is not a subclass of class of this objectpublic java.util.HashSet<java.lang.Integer> getNEGRegionExamples(byte[] attributesMask)
Integer
) numbers of examples belonging to negative (NEG) region of this union,
calculated for the most restrictive VC-DRSA parameter value (classical DRSA) and for given mask for attributes.
Returns examples belonging to POS region of the opposite union
(e.g. for union "at least 3" opposite union is "at most 2").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.getNEGRegionExamples
in class ApproximatedEntity
attributesMask
- mask for attributes allowing negative region calculations for a subset
of active and condition attributes.
It is checked if length of the mask is equal to the quantity of attributes in memory container.
If attributesMask(i) is equal to zero, than corresponding attribute is not taken into account
at all when calculating negative region. If attributesMask(i) is different than zero,
than corresponding attribute is taken into account when calculating negative region.Integer
) numbers of examples belonging to negative (NEG) region of this union,
calculated for given mask for attributesInvalidValueException
- when length of the mask for attributes is different than quantity of attributes in memory containerpublic java.util.HashSet<java.lang.Integer> getNEGRegionExamples(double VCDRSAParameterValue, byte[] attributesMask)
Integer
) numbers of examples belonging to negative (NEG) region of this union,
calculated for given VC-DRSA parameter value and for given mask for attributes, according to used VC-DRSA.
Because POS regions may overlap, NEG region consists of those examples belonging to
POS region of the opposite union of decision classes (e.g. for union "at least 3" opposite union is "at most 2"),
which are not in POS region of considered union at the same time.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.getNEGRegionExamples
in class ApproximatedEntity
VCDRSAParameterValue
- VC-DRSA parameter value for which NEG region should be calculated (according to used VC-DRSA)attributesMask
- mask for attributes allowing negative region calculations for a subset
of active and condition attributes.
It is checked if length of the mask is equal to the quantity of attributes in memory container.
If attributesMask(i) is equal to zero, than corresponding attribute is not taken into account
at all when calculating negative region. If attributesMask(i) is different than zero,
than corresponding attribute is taken into account when calculating negative region.Integer
) numbers of examples belonging to negative (NEG) region of this union,
calculated for given value of VC-DRSA parameter and for given mask for attributesInvalidValueException
- when VC-DRSA parameter value is outside [0, 1] range
or when length of the mask for attributes is different than quantity of attributes in memory containerpublic void reset()
validate
method and throws
appropriate exception if any irregularity has been found.validate
method,
which is called here.java.lang.NullPointerException
- when memory container is null
InvalidValueException
- when memory container contains no attributes or no examples,
when type of this union is not ASCENDING
nor DESCENDING
,
when attribute with given number is not active, not decision or has no preference type assigned
or when basic class is incorrect - it does not appear in any example from memory container
(union would be empty) or union contains all examplesjava.lang.IndexOutOfBoundsException
- when decision criterion number is too small or too big
for given memory containerInvalidTypeException
- when type of basicClass
is different than type of the default value
for given decision criterionValueNotFoundException
- when no active condition criterion has been found in memory containerpublic void setLowerApproximation(int[] lowerApproximation, double lowerApproximationVCParameterValue, byte[] lowerApproximationAttributesMask, int lowerApproximationPairFieldDominanceCheckMethod)
lowerApproximation
- array with numbers of objects from memory container which belong to lower approximation of this unionlowerApproximationVCParameterValue
- VC-DRSA parameter value for which given lower approximation has been calculated (VC-DRSA)lowerApproximationAttributesMask
- mask for attributes allowing lower approximation calculations for a subset
of active and condition attributes.
It is checked if length of the mask is equal to the quantity of attributes in memory container.
If attributesMask(i) is equal to zero, than corresponding attribute has not been taken into account
at all when calculating lower approximation. If attributesMask(i) is different than zero,
than corresponding attribute has been taken into account when calculating lower approximation.lowerApproximationPairFieldDominanceCheckMethod
- dominance check method for attributes of type PairField
,
which has been used to calculate given lower approximation. Should be either PairField.STRICT_ORDINAL_DOMINANCE_CHECK_METHOD
or PairField.CLASSIC_ORDINAL_DOMINANCE_CHECK_METHOD
.InvalidValueException
- when VC-DRSA parameter value is outside [0, 1] range,
when length of the mask for attributes is different than quantity of attributes in memory container
or when lowerApproximationPairFieldDominanceCheckMethod
is neither
PairField.STRICT_ORDINAL_DOMINANCE_CHECK_METHOD
nor PairField.CLASSIC_ORDINAL_DOMINANCE_CHECK_METHOD
public void setUpperApproximation(int[] upperApproximation, double upperApproximationVCParameterValue, byte[] upperApproximationAttributesMask, int upperApproximationPairFieldDominanceCheckMethod)
upperApproximation
- array with numbers of objects from memory container which belong to upper approximation of this unionupperApproximationVCParameterValue
- VC-DRSA parameter value for which given upper approximation has been calculated (VC-DRSA)upperApproximationAttributesMask
- mask for attributes allowing upper approximation calculations for a subset
of active and condition attributes.
It is checked if length of the mask is equal to the quantity of attributes in memory container.
If attributesMask(i) is equal to zero, than corresponding attribute has not been taken into account
at all when calculating upper approximation. If attributesMask(i) is different than zero,
than corresponding attribute has been taken into account when calculating upper approximation.upperApproximationPairFieldDominanceCheckMethod
- dominance check method for attributes of type PairField
,
which has been used to calculate given upper approximation. Should be either PairField.STRICT_ORDINAL_DOMINANCE_CHECK_METHOD
or PairField.CLASSIC_ORDINAL_DOMINANCE_CHECK_METHOD
.InvalidValueException
- when VC-DRSA parameter value is outside [0, 1] range,
when length of the mask for attributes is different than quantity of attributes in memory container
or when upperApproximationPairFieldDominanceCheckMethod
is neither
PairField.STRICT_ORDINAL_DOMINANCE_CHECK_METHOD
nor PairField.CLASSIC_ORDINAL_DOMINANCE_CHECK_METHOD
public void setBoundary(int[] boundary, double boundaryVCParameterValue, byte[] boundaryAttributesMask, int boundaryPairFieldDominanceCheckMethod)
boundary
- array with numbers of objects from memory container which belong to boundary of this unionboundaryVCParameterValue
- VC-DRSA parameter value for which given boundary has been calculated (VC-DRSA)boundaryAttributesMask
- mask for attributes allowing boundary calculations for a subset
of active and condition attributes.
It is checked if length of the mask is equal to the quantity of attributes in memory container.
If attributesMask(i) is equal to zero, than corresponding attribute has not been taken into account
at all when calculating boundary. If attributesMask(i) is different than zero,
than corresponding attribute has been taken into account when calculating boundary.boundaryPairFieldDominanceCheckMethod
- dominance check method for attributes of type PairField
,
which has been used to calculate given boundary. Should be either PairField.STRICT_ORDINAL_DOMINANCE_CHECK_METHOD
or PairField.CLASSIC_ORDINAL_DOMINANCE_CHECK_METHOD
.InvalidValueException
- when VC-DRSA parameter value is outside [0, 1] range,
when length of the mask for attributes is different than quantity of attributes in memory container
or when boundaryPairFieldDominanceCheckMethod
is neither
PairField.STRICT_ORDINAL_DOMINANCE_CHECK_METHOD
nor PairField.CLASSIC_ORDINAL_DOMINANCE_CHECK_METHOD
public java.lang.String getDescription()
>= 3
".getDescription
in class ApproximatedEntity
public java.lang.Object clone()
clone
in class ApproximatedEntity