|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--shared.SplitScore
A class for determining, holding, and returning the information associated with an attribute split. Uses methods from the Entropy class for the determination of the scores. The scores for a specific item are cached in an internal cache structure. This structure contains the entropy, conditional entropy, split entropy, mutual information, gain ratio, split distribution, label distribution, and the number of instances that these scores have been evaluated on. Access to scores that have been cached are constant time, while items that need refreshment have a longer access time for recalculation.
| Field Summary | |
static byte |
defaultSplitScoreCriterion
Default criterion for determining the score of a particular split. |
static byte |
externalScore
Value indicating how splits are scored. |
static byte |
gainRatio
Value indicating how splits are scored. |
protected LogOptions |
logOptions
Logging options for this class. |
static byte |
mutualInfo
Value indicating how splits are scored. |
static byte |
mutualInfoRatio
Value indicating how splits are scored. |
static byte |
normalizedMutualInfo
Value indicating how splits are scored. |
static java.lang.String[] |
splitScoreCriterionEnum
String names for each form of split criterion. |
| Constructor Summary | |
SplitScore()
Constructor. |
|
SplitScore(SplitScore source)
Copy Constructor. |
|
| Method Summary | |
SplitScore |
assign(SplitScore rhs)
Assigns the given SplitScore data to this SplitScore. |
void |
display()
Produces formatted display of contents of object. |
void |
display(java.io.Writer stream)
Produces formatted display of contents of object. |
void |
display(java.io.Writer stream,
DisplayPref dp)
Produces formatted display of contents of object. |
double |
get_cond_entropy()
Returns cache.condEntropy, first checking to see if it has yet been set. |
double |
get_entropy()
Returns cache.entropy, first checking to see if it has yet been set. |
double |
get_external_score()
Returns the value, set externally, for the score. |
double |
get_gain_ratio()
Determines, and returns, cache.gainRatio. |
double[] |
get_label_dist()
The label distribution is calculated from the split and label distribution. |
int |
get_log_level()
Returns the logging level for this object. |
LogOptions |
get_log_options()
Returns the LogOptions object for this object. |
java.io.Writer |
get_log_stream()
Returns the stream to which logs for this object are written. |
double |
get_mutual_info_ratio()
Returns the mutual information ratio, which is the ratio between the mutual info and entropy. |
double |
get_mutual_info(boolean normalize)
Returns the mutual info (information gain) score for the split this SplitScore object represents. |
double[][] |
get_split_and_label_dist()
Returns a reference to the requested distribution array. |
double[] |
get_split_dist()
The split distribution is calculated from the split and label distribution. |
double |
get_split_entropy()
Returns cache.splitEntropy, first checking to see if it has yet been set. |
byte |
get_split_score_criterion()
Returns the type of criterion used in scoring splits. |
double |
get_unnormalized_mutual_info()
Returns the mutual info (information gain) score for the split this SplitScore object represents. |
boolean |
has_distribution()
Checks if there exists a splitAndLabel distribution. |
boolean |
has_distribution(boolean fatalOnFalse)
Checks if there exists a splitAndLabel distribution. |
boolean |
has_external_score()
Checks if an external score has been set. |
double |
normalize_by_num_splits(double score)
Normalize by the number of splits. |
int |
num_splits()
Returns the number of splits--not including unknowns. |
double[] |
release_label_dist()
Returns the label distribution array and releases ownership. |
double[][] |
release_split_and_label_dist()
Returns the split and label distribution array and releases ownership. |
double[] |
release_split_dist()
Returns the split distribution array and releases ownership. |
void |
reset()
Clear (delete) distribution array data. |
double |
score()
The criterion calculation depends on the score criterion. |
double |
score(double[][] sAndLDist,
double[] sDist,
double[] lDist,
double passedEntropy,
double passedWeight)
Computes the scores and updates the cache when there are being computed many times for the same number of instances and entropy. |
void |
set_external_score(double extScore)
Set the external score. |
void |
set_log_level(int level)
Sets the logging level for this object. |
void |
set_log_options(LogOptions opt)
Sets the LogOptions object for this object. |
void |
set_log_prefixes(java.lang.String file,
int line,
int lvl1,
int lvl2)
Sets the logging message prefix for this object. |
void |
set_log_stream(java.io.Writer strm)
Sets the stream to which logging options are displayed. |
double[][] |
set_split_and_label_dist(double[][] sAndLDist)
Stores the splitAndLabelDist array. |
void |
set_split_dist(double[] sDist)
Stores the cache.splitDist array. |
void |
set_split_score_criterion(byte choice)
Sets the split score criterion. |
double |
total_weight()
Returns the total weight from the cache. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final byte mutualInfo
public static final byte normalizedMutualInfo
public static final byte gainRatio
public static final byte mutualInfoRatio
public static final byte externalScore
public static byte defaultSplitScoreCriterion
mutualInfo,
normalizedMutualInfo,
gainRatio,
mutualInfoRatio,
externalScorepublic static java.lang.String[] splitScoreCriterionEnum
protected LogOptions logOptions
| Constructor Detail |
public SplitScore(SplitScore source)
source - The SplitScore to be copied.public SplitScore()
| Method Detail |
public void set_log_level(int level)
level - The new logging level.public int get_log_level()
public void set_log_stream(java.io.Writer strm)
strm - The stream to which logs will be written.public java.io.Writer get_log_stream()
public LogOptions get_log_options()
public void set_log_options(LogOptions opt)
opt - The new LogOptions object.
public void set_log_prefixes(java.lang.String file,
int line,
int lvl1,
int lvl2)
file - The file name to be displayed in the prefix of log messages.line - The line number to be displayed in the prefix of log messages.lvl1 - The log level of the statement being logged.lvl2 - The level of log messages being displayed.public double get_unnormalized_mutual_info()
public double get_mutual_info(boolean normalize)
normalize - TRUE if normalization is requested, FALSE otherwise.public double normalize_by_num_splits(double score)
score - The score to be normalized.public int num_splits()
public double[] get_split_dist()
public boolean has_distribution()
public boolean has_distribution(boolean fatalOnFalse)
fatalOnFalse - TRUE if an error message is to be displayed if there is no splitAndLabel
distribution.public double get_cond_entropy()
public double total_weight()
public double[] get_label_dist()
public double[][] get_split_and_label_dist()
public double get_entropy()
public double score()
public double score(double[][] sAndLDist,
double[] sDist,
double[] lDist,
double passedEntropy,
double passedWeight)
sAndLDist - The split and label distribution.sDist - The split distribution.lDist - The label distribution.passedEntropy - The entropy value for this split.passedWeight - The weight of instances for this split.Entropy.find_best_threshold(shared.RealAndLabelColumn, double, shared.SplitScore, shared.DoubleRef, shared.IntRef, shared.IntRef, int, double)public byte get_split_score_criterion()
mutualInfo,
normalizedMutualInfo,
gainRatio,
mutualInfoRatio,
externalScorepublic double get_external_score()
public double get_mutual_info_ratio()
public double get_gain_ratio()
public double get_split_entropy()
public void set_split_score_criterion(byte choice)
choice - The chosen split score criterion.mutualInfo,
normalizedMutualInfo,
#rainRatio,
mutualInfoRatio,
externalScorepublic void reset()
public void set_split_dist(double[] sDist)
sDist - The split distribution array to be cached.public double[][] set_split_and_label_dist(double[][] sAndLDist)
sAndLDist - The new split and label distribution.public void set_external_score(double extScore)
extScore - The external score value.public boolean has_external_score()
public void display()
public void display(java.io.Writer stream)
stream - The Writer to be displayed to.
public void display(java.io.Writer stream,
DisplayPref dp)
stream - The Writer to be displayed to.dp - The display preferences.public SplitScore assign(SplitScore rhs)
rhs - The SplitScore to be copied.public double[][] release_split_and_label_dist()
public double[] release_label_dist()
public double[] release_split_dist()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||