Package weka.classifiers
Class AggregateEvaluations
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- weka.classifiers.AggregateEvaluations
-
- All Implemented Interfaces:
ErrorProvider,LoggingSupporter,SizeOfHandler,Serializable
public class AggregateEvaluations extends LoggingObject implements ErrorProvider
Allows the aggregation ofEvaluationobjects.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected weka.classifiers.Evaluationm_Aggregatedthe aggregated evaluation.protected List<String>m_ClassLabelsthe optional class labels.protected Comparatorm_Comparatorthe comparator to use.protected Stringm_LastErrorthe last error.protected List<weka.classifiers.evaluation.Prediction>m_Predictionsthe collected predictions.protected Stringm_RelationNamedataset name.protected booleanm_Reversewhether to reverse the sorting.protected booleanm_SortLabelswhether to sort the labels.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AggregateEvaluations()Initializes the object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringadd(SpreadSheet sheet, int colAct, int colPred, int colWeight, int[] colsDist, boolean useColNamesAsLabels)Adds the data from the spreadsheet as predictions.Stringadd(weka.classifiers.Evaluation eval)Adds the predictions of the givenEvaluationobject.Stringadd(weka.classifiers.evaluation.Prediction pred)Adds the prediction.weka.classifiers.Evaluationaggregated()Returns the aggregated evaluation.protected weka.classifiers.EvaluationdoAggregate()Performs the aggregation.List<String>getClassLabels()Returns the currently set class labels, if any.ComparatorgetComparator()Returns the comparator to use.StringgetLastError()Returns the error that occurred during the last operation.List<weka.classifiers.evaluation.Prediction>getPredictions()Returns all the currently stored predictions.booleangetReverse()Returns whether to reverse the sorting.booleangetSortLabels()Returns whether to store the labels with the specified comparator.booleanhasLastError()Returns whether an error was encountered during the last operation.protected voidinitialize()Initializes the members.voidsetClassLabels(List<String> value)Sets the class labels to use.voidsetComparator(Comparator value)Sets the comparator to use.voidsetReverse(boolean value)Sets whether to reverse the sorting.voidsetSortLabels(boolean value)Sets whether to sort the labels with the specified comparator.StringtoString()Returns a short description of current state.-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_RelationName
protected String m_RelationName
dataset name.
-
m_Predictions
protected List<weka.classifiers.evaluation.Prediction> m_Predictions
the collected predictions.
-
m_Aggregated
protected transient weka.classifiers.Evaluation m_Aggregated
the aggregated evaluation.
-
m_SortLabels
protected boolean m_SortLabels
whether to sort the labels.
-
m_Comparator
protected Comparator m_Comparator
the comparator to use.
-
m_Reverse
protected boolean m_Reverse
whether to reverse the sorting.
-
m_LastError
protected String m_LastError
the last error.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.
-
getPredictions
public List<weka.classifiers.evaluation.Prediction> getPredictions()
Returns all the currently stored predictions.- Returns:
- the predictions
-
setClassLabels
public void setClassLabels(List<String> value)
Sets the class labels to use.- Parameters:
value- the labels
-
getClassLabels
public List<String> getClassLabels()
Returns the currently set class labels, if any.- Returns:
- the labels, null if none set
-
setSortLabels
public void setSortLabels(boolean value)
Sets whether to sort the labels with the specified comparator.- Parameters:
value- true if to sort
-
getSortLabels
public boolean getSortLabels()
Returns whether to store the labels with the specified comparator.- Returns:
- true if to sort
-
setComparator
public void setComparator(Comparator value)
Sets the comparator to use.- Parameters:
value- the comparator
-
getComparator
public Comparator getComparator()
Returns the comparator to use.- Returns:
- the comparator
-
setReverse
public void setReverse(boolean value)
Sets whether to reverse the sorting.- Parameters:
value- true if to reverse
-
getReverse
public boolean getReverse()
Returns whether to reverse the sorting.- Returns:
- true if to reverse
-
add
public String add(weka.classifiers.evaluation.Prediction pred)
Adds the prediction.- Parameters:
pred- the prediction to add- Returns:
- null if successfully added, otherwise error message
-
add
public String add(weka.classifiers.Evaluation eval)
Adds the predictions of the givenEvaluationobject.- Parameters:
eval- the evaluation to add- Returns:
- null if successfully added, otherwise error message
-
add
public String add(SpreadSheet sheet, int colAct, int colPred, int colWeight, int[] colsDist, boolean useColNamesAsLabels)
Adds the data from the spreadsheet as predictions.- Parameters:
sheet- the spreadsheet with the datacolAct- the "actual" column indexcolPred- the "predicted" column indexcolWeight- the column with the weight, -1 if not presentcolsDist- the columns with the class distribution, null if not presentuseColNamesAsLabels- whether to use the column names as class labels, requires colsDist- Returns:
- null if successfully added, otherwise error message
-
doAggregate
protected weka.classifiers.Evaluation doAggregate()
Performs the aggregation.- Returns:
- the aggregated evaluation
-
aggregated
public weka.classifiers.Evaluation aggregated()
Returns the aggregated evaluation.- Returns:
- the aggregated evaluation
-
hasLastError
public boolean hasLastError()
Returns whether an error was encountered during the last operation.- Specified by:
hasLastErrorin interfaceErrorProvider- Returns:
- true if an error occurred
-
getLastError
public String getLastError()
Returns the error that occurred during the last operation.- Specified by:
getLastErrorin interfaceErrorProvider- Returns:
- the error string, null if none occurred
-
-