wpi.associations.arminerSequence
Class Logger

java.lang.Object
  extended bywpi.associations.arminerSequence.Logger

public class Logger
extends java.lang.Object

Handles logging metrics about the Apriori Sets And Sequences algorithm during run time. These metrics are written to a file in ARFF format.

Author:
Keith A. Pray (kap@wpi.edu)

Field Summary
static int AVERAGE_LENGTH_OF_TIMELINE
          Average length of a time line in the data set
static int CONFIDENCE
          Confidence metric.
private static int debug
          Specifies debug info level 0: no debug info 1: input to methods 2: and output from methods 3: and all sorts of stuff
static java.lang.String defaultLogStatsFileName
           
private  java.lang.String[] logMetricNames
          An array of the metrics and their data types captured in logging mode
private  java.lang.StringBuffer[] logMetricValues
          A list of the values to be stored in the log file
private  java.lang.String logStatsFileName
          The name of the log file to write to.
static int MAX_EVENT_LENGTH
          Maximum length of the events.
static int MAX_PER_EVENT_LENGTH
          Maximum length per event.
static int MIN_EVENT_LENGTH
          Minimum length of the events.
static int MIN_PER_EVENT_LENGTH
          Minimum length per event.
static int NAME
          Specifies the name of a metric when retrieving information
static int NUM_ATTRIBUTES
          Number of attributes present in the data set
static int NUM_CANDIDATES_GENERATED
          Number of candidate item sets of size k generated
static int NUM_COMPARISONS_SAVED_REMOVING_CANDIDATES_DURING_SUPPORT_COUNTING
          Number of times a candidate item sets did not have to be compared to instances in the data set because the candidate was removed from the candidate list when it was clear it could not be considered frequent due to the number of instances the candidate was already compared to
static int NUM_EVENT_ATTRIBUTES
          Number of event attributes present in the data set
static int NUM_EVENT_OCCURRENCES
          Number of times events occur in the data set
static int NUM_EVENTS_OF_SAME_TYPE_ALLOWED
          Number of event items of the same type allowed to appear in a rule
static int NUM_FREQUENT_ITEMSETS_FOUND
          Number of frequent item sets of size k found
static int NUM_INSTANCES
          Number of instances in the data set
static int NUM_OCCURRENCES_PER_ATTRIBUTE
          Average number of event occurrences per event attribute
static int NUM_RULES
          Number of association rules found.
static int NUM_UNIQUE_CANDIDATES_GENERATED
          Number of unique item sets candidates of size k generated
static int NUM_UNIQUE_FREQUENT_ITEMSETS_FOUND
          Number of frequent unique item sets of size k found
static int RELATION_NAME
          Relation name of the data set.
static int SECONDS_PER_FREQUENT_ITEMSET
          Total mining seconds per frequent item set found.
static int SECONDS_TO_COUNT_SUPPORT
          Number of seconds to count support of candidate item sets of size k
static int SECONDS_TO_FIND_CONFIDENCE
          Number of seconds to calculate find confidence of association rules.
static int SECONDS_TO_GENERATE_CANDIDATES
          Number of seconds to generate candidates item sets of size k
static int SECONDS_TO_GENERATE_RULES
          Number of seconds to generate association rules from frequent item sets
static int SUPPORT
          Support metric.
static int TIMESTAMP
          Date and time when the mining started.
static int TOTAL_NUM_FREQUENT_ITEMSETS
          Total number of frequent item set found
static int TOTAL_SECONDS_TO_MINE
          Number of seconds for the entire frequent item set mining
static int TYPE
          Specifies the data type of a metric when retreiving information
static int USE_ITEMSET_PREFIX_TREE
          Specifies if item set prefix tree used instead of vector.
static int USE_PREVIOUS_DUPLICATE_HASH
          Specifies if previous duplicate hash used.
 
Constructor Summary
Logger()
          Constructor that uses the default log file name.
Logger(java.lang.String fileName)
          Constructor that allows the log file name to be specified.
 
Method Summary
 void clear()
          Clears the metrics logged thus far.
 java.lang.String getLogMetricInfo(int code, int info)
          Get information about the log metric with the specified integer code.
 java.lang.String getLogMetricName(int code)
          Get the name of the log metric with the specified integer code.
 java.lang.String[] getLogMetricNames()
          Get the list of metrics that can be stored in the log file.
 java.lang.String getLogMetricType(int code)
          Get the data type of the log metric with the specified integer code.
 java.lang.String getValue(int code)
          Returns the value saved for the specified metric.
private  void initLogMetricNames()
          Initializes the array of metric names.
private  void initLogMetricValues()
          Initializes the array of log metric values.
 boolean isClear()
          Check if the Logger is clear.
 void logValue(int code, java.lang.String value)
          Add a metric value to the log.
 void saveLog()
          Saves the logged values to the log file.
 void setLogStatsFileName(java.lang.String fileName)
          Sets the name of the file in which the statistics will be logged to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logStatsFileName

private java.lang.String logStatsFileName
The name of the log file to write to.


defaultLogStatsFileName

public static java.lang.String defaultLogStatsFileName

logMetricNames

private java.lang.String[] logMetricNames
An array of the metrics and their data types captured in logging mode


logMetricValues

private java.lang.StringBuffer[] logMetricValues
A list of the values to be stored in the log file


NAME

public static final int NAME
Specifies the name of a metric when retrieving information

See Also:
Constant Field Values

TYPE

public static final int TYPE
Specifies the data type of a metric when retreiving information

See Also:
Constant Field Values

SECONDS_TO_GENERATE_CANDIDATES

public static final int SECONDS_TO_GENERATE_CANDIDATES
Number of seconds to generate candidates item sets of size k

See Also:
Constant Field Values

SECONDS_TO_COUNT_SUPPORT

public static final int SECONDS_TO_COUNT_SUPPORT
Number of seconds to count support of candidate item sets of size k

See Also:
Constant Field Values

TOTAL_SECONDS_TO_MINE

public static final int TOTAL_SECONDS_TO_MINE
Number of seconds for the entire frequent item set mining

See Also:
Constant Field Values

NUM_CANDIDATES_GENERATED

public static final int NUM_CANDIDATES_GENERATED
Number of candidate item sets of size k generated

See Also:
Constant Field Values

NUM_UNIQUE_CANDIDATES_GENERATED

public static final int NUM_UNIQUE_CANDIDATES_GENERATED
Number of unique item sets candidates of size k generated

See Also:
Constant Field Values

NUM_FREQUENT_ITEMSETS_FOUND

public static final int NUM_FREQUENT_ITEMSETS_FOUND
Number of frequent item sets of size k found

See Also:
Constant Field Values

NUM_UNIQUE_FREQUENT_ITEMSETS_FOUND

public static final int NUM_UNIQUE_FREQUENT_ITEMSETS_FOUND
Number of frequent unique item sets of size k found

See Also:
Constant Field Values

NUM_COMPARISONS_SAVED_REMOVING_CANDIDATES_DURING_SUPPORT_COUNTING

public static final int NUM_COMPARISONS_SAVED_REMOVING_CANDIDATES_DURING_SUPPORT_COUNTING
Number of times a candidate item sets did not have to be compared to instances in the data set because the candidate was removed from the candidate list when it was clear it could not be considered frequent due to the number of instances the candidate was already compared to

See Also:
Constant Field Values

NUM_EVENTS_OF_SAME_TYPE_ALLOWED

public static final int NUM_EVENTS_OF_SAME_TYPE_ALLOWED
Number of event items of the same type allowed to appear in a rule

See Also:
Constant Field Values

NUM_ATTRIBUTES

public static final int NUM_ATTRIBUTES
Number of attributes present in the data set

See Also:
Constant Field Values

NUM_EVENT_ATTRIBUTES

public static final int NUM_EVENT_ATTRIBUTES
Number of event attributes present in the data set

See Also:
Constant Field Values

NUM_EVENT_OCCURRENCES

public static final int NUM_EVENT_OCCURRENCES
Number of times events occur in the data set

See Also:
Constant Field Values

AVERAGE_LENGTH_OF_TIMELINE

public static final int AVERAGE_LENGTH_OF_TIMELINE
Average length of a time line in the data set

See Also:
Constant Field Values

NUM_INSTANCES

public static final int NUM_INSTANCES
Number of instances in the data set

See Also:
Constant Field Values

USE_ITEMSET_PREFIX_TREE

public static final int USE_ITEMSET_PREFIX_TREE
Specifies if item set prefix tree used instead of vector. "true" if the tree is used, "false" otherwise

See Also:
Constant Field Values

USE_PREVIOUS_DUPLICATE_HASH

public static final int USE_PREVIOUS_DUPLICATE_HASH
Specifies if previous duplicate hash used. "true" if the tree is used, "false" otherwise

See Also:
Constant Field Values

SECONDS_TO_GENERATE_RULES

public static final int SECONDS_TO_GENERATE_RULES
Number of seconds to generate association rules from frequent item sets

See Also:
Constant Field Values

SECONDS_TO_FIND_CONFIDENCE

public static final int SECONDS_TO_FIND_CONFIDENCE
Number of seconds to calculate find confidence of association rules.

See Also:
Constant Field Values

NUM_RULES

public static final int NUM_RULES
Number of association rules found.

See Also:
Constant Field Values

RELATION_NAME

public static final int RELATION_NAME
Relation name of the data set.

See Also:
Constant Field Values

TIMESTAMP

public static final int TIMESTAMP
Date and time when the mining started.

See Also:
Constant Field Values

SUPPORT

public static final int SUPPORT
Support metric.

See Also:
Constant Field Values

CONFIDENCE

public static final int CONFIDENCE
Confidence metric.

See Also:
Constant Field Values

SECONDS_PER_FREQUENT_ITEMSET

public static final int SECONDS_PER_FREQUENT_ITEMSET
Total mining seconds per frequent item set found.

See Also:
Constant Field Values

TOTAL_NUM_FREQUENT_ITEMSETS

public static final int TOTAL_NUM_FREQUENT_ITEMSETS
Total number of frequent item set found

See Also:
Constant Field Values

NUM_OCCURRENCES_PER_ATTRIBUTE

public static final int NUM_OCCURRENCES_PER_ATTRIBUTE
Average number of event occurrences per event attribute

See Also:
Constant Field Values

MIN_EVENT_LENGTH

public static final int MIN_EVENT_LENGTH
Minimum length of the events.

See Also:
Constant Field Values

MAX_EVENT_LENGTH

public static final int MAX_EVENT_LENGTH
Maximum length of the events.

See Also:
Constant Field Values

MIN_PER_EVENT_LENGTH

public static final int MIN_PER_EVENT_LENGTH
Minimum length per event.

See Also:
Constant Field Values

MAX_PER_EVENT_LENGTH

public static final int MAX_PER_EVENT_LENGTH
Maximum length per event.

See Also:
Constant Field Values

debug

private static final int debug
Specifies debug info level 0: no debug info 1: input to methods 2: and output from methods 3: and all sorts of stuff

See Also:
Constant Field Values
Constructor Detail

Logger

public Logger(java.lang.String fileName)
Constructor that allows the log file name to be specified.


Logger

public Logger()
Constructor that uses the default log file name.

Method Detail

setLogStatsFileName

public void setLogStatsFileName(java.lang.String fileName)
Sets the name of the file in which the statistics will be logged to. If the file doesn't exist one will be created.

Parameters:
fileName - name of the file to store statistics

getLogMetricNames

public java.lang.String[] getLogMetricNames()
Get the list of metrics that can be stored in the log file.

Returns:
an array of the names of the metrics

getLogMetricInfo

public java.lang.String getLogMetricInfo(int code,
                                         int info)
Get information about the log metric with the specified integer code. An empty string is returned if there is no metric associated with the code. The information returned is specified by using a code.

Parameters:
code - the integer code representing a mteric
info - Logger.NAME for the metric name
Logger.TYPE for the metric data type
Returns:
the metric name, empty string if code not found

getLogMetricName

public java.lang.String getLogMetricName(int code)
Get the name of the log metric with the specified integer code. An empty string is returned if there is no metric associated with the code.

Parameters:
code - the integer code representing a mteric
Returns:
the metric name, empty string if code not found

getLogMetricType

public java.lang.String getLogMetricType(int code)
Get the data type of the log metric with the specified integer code. An empty string is returned if there is no metric associated with the code.

Parameters:
code - the integer code representing a mteric
Returns:
the metric data type, empty string if code not found

initLogMetricNames

private void initLogMetricNames()
Initializes the array of metric names.


initLogMetricValues

private void initLogMetricValues()
Initializes the array of log metric values.


getValue

public java.lang.String getValue(int code)
Returns the value saved for the specified metric.

Parameters:
code - code for the metric
Returns:
the string stored for the metric, null if the code is not valid

logValue

public void logValue(int code,
                     java.lang.String value)
Add a metric value to the log. If a value already exists for a metric it will be assumed that the metric can be recorded as a time sequence. The new value will be seperated from the previous value by the time sequence delimiter specified in wpi.timesequence.TSUtility.

Parameters:
code - code for the metric
value - value to log for the metric

saveLog

public void saveLog()
Saves the logged values to the log file.


clear

public void clear()
Clears the metrics logged thus far.


isClear

public boolean isClear()
Check if the Logger is clear.