Package weka.classifiers
Class AggregateEvaluations
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- weka.classifiers.AggregateEvaluations
-
- All Implemented Interfaces:
adams.core.ErrorProvider
,adams.core.logging.LoggingSupporter
,adams.core.SizeOfHandler
,Serializable
public class AggregateEvaluations extends adams.core.logging.LoggingObject implements adams.core.ErrorProvider
Allows the aggregation ofEvaluation
objects.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected weka.classifiers.Evaluation
m_Aggregated
the aggregated evaluation.protected List<String>
m_ClassLabels
the optional class labels.protected Comparator
m_Comparator
the comparator to use.protected String
m_LastError
the last error.protected List<weka.classifiers.evaluation.Prediction>
m_Predictions
the collected predictions.protected String
m_RelationName
dataset name.protected boolean
m_Reverse
whether to reverse the sorting.protected boolean
m_SortLabels
whether to sort the labels.
-
Constructor Summary
Constructors Constructor Description AggregateEvaluations()
Initializes the object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
add(adams.data.spreadsheet.SpreadSheet sheet, int colAct, int colPred, int colWeight, int[] colsDist, boolean useColNamesAsLabels)
Adds the data from the spreadsheet as predictions.String
add(weka.classifiers.Evaluation eval)
Adds the predictions of the givenEvaluation
object.String
add(weka.classifiers.evaluation.Prediction pred)
Adds the prediction.weka.classifiers.Evaluation
aggregated()
Returns the aggregated evaluation.protected weka.classifiers.Evaluation
doAggregate()
Performs the aggregation.List<String>
getClassLabels()
Returns the currently set class labels, if any.Comparator
getComparator()
Returns the comparator to use.String
getLastError()
Returns the error that occurred during the last operation.List<weka.classifiers.evaluation.Prediction>
getPredictions()
Returns all the currently stored predictions.boolean
getReverse()
Returns whether to reverse the sorting.boolean
getSortLabels()
Returns whether to store the labels with the specified comparator.boolean
hasLastError()
Returns whether an error was encountered during the last operation.protected void
initialize()
Initializes the members.void
setClassLabels(List<String> value)
Sets the class labels to use.void
setComparator(Comparator value)
Sets the comparator to use.void
setReverse(boolean value)
Sets whether to reverse the sorting.void
setSortLabels(boolean value)
Sets whether to sort the labels with the specified comparator.String
toString()
Returns a short description of current state.
-
-
-
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 givenEvaluation
object.- Parameters:
eval
- the evaluation to add- Returns:
- null if successfully added, otherwise error message
-
add
public String add(adams.data.spreadsheet.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:
hasLastError
in interfaceadams.core.ErrorProvider
- Returns:
- true if an error occurred
-
getLastError
public String getLastError()
Returns the error that occurred during the last operation.- Specified by:
getLastError
in interfaceadams.core.ErrorProvider
- Returns:
- the error string, null if none occurred
-
-