Package com.groiss.ml.classifier
Class EvaluationResult
java.lang.Object
com.groiss.store.PersistentObject
com.groiss.store.ExportablePersistentObject
com.groiss.ml.classifier.EvaluationResult
- All Implemented Interfaces:
KeyValuePair<String,
,String> Exportable
,Persistent
,Serializable
,Cloneable
This class is used to store the result of the evaluation of classification model.
- See Also:
-
Field Summary
Fields inherited from class com.groiss.store.PersistentObject
filled, oid
Fields inherited from interface com.groiss.store.Persistent
emptyKeys
-
Constructor Summary
ConstructorDescriptionCreates an empty evaluation result objectEvaluationResult
(Persistent belongsTo, Duration duration, int amountOfData, double accuracy, String confusionMatrix, String additionalInfos) Creates a new evaluation result of classification model. -
Method Summary
Modifier and TypeMethodDescriptiondouble
accuracy()
Returns the accuracy (as value between 0 and 1) of the model, i.e. how well the model performs in predicting the correct result.Returns additional information about the result.int
Returns the number of data records used for calculation this resultReturns the representative of the model to which this result belongs toReturns the confusion matrix for the data of this result.Returns the date when this result was createdlong
duration()
Returns how long it took (in seconds) for calculating this resultString[][]
getKeys()
A class may return key field groups in order to identify already existing objects of that class.Get the object name in localized form.This method must return the table name of the database table in which this persistent object is stored.toString()
Methods inherited from class com.groiss.store.PersistentObject
afterDelete, afterInsert, afterRead, afterUpdate, beforeDelete, beforeInsert, beforeUpdate, clone, dbFields, equals, getKey, getOid, getValue, hashCode, isFilled, isValid, onDelete, onInsert, onRead, onUpdate, setFilled, setOid, setOid, toListString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.groiss.store.Exportable
beforeImport, exportFields, getAdditionalObjects, getRequiredObjects, getRequiredReferences
Methods inherited from interface com.groiss.store.Persistent
afterDelete, afterInsert, afterRead, afterUpdate, beforeDelete, beforeInsert, beforeUpdate, dbFields, getKey, getOid, getStore, getValue, isFilled, isValid, setFilled, setOid, setOid, toListString
-
Constructor Details
-
EvaluationResult
public EvaluationResult(Persistent belongsTo, Duration duration, int amountOfData, double accuracy, String confusionMatrix, String additionalInfos) Creates a new evaluation result of classification model.- Parameters:
belongsTo
- aPersistent
representing the model to which this result belongs toduration
- the duration (in seconds) for calculating this resultamountOfData
- the number of data records used for calculation this resultaccuracy
- the accuracy of the model (as value between 0 and 1)confusionMatrix
- the confusion matrix for the data of this resultadditionalInfos
- additional information about the result; may vary depending on the used evaluation implementation
-
EvaluationResult
public EvaluationResult()Creates an empty evaluation result object
-
-
Method Details
-
getTableName
Description copied from interface:Persistent
This method must return the table name of the database table in which this persistent object is stored.- Returns:
- The table name of the database table in which this persistent object is stored.
-
belongsTo
Returns the representative of the model to which this result belongs to- Returns:
- the representative of the model to which this result belongs to
-
createdAt
Returns the date when this result was created- Returns:
- the date when this result was created
-
duration
public long duration()Returns how long it took (in seconds) for calculating this result- Returns:
- the duration (in seconds) for calculating this result
-
amountOfData
public int amountOfData()Returns the number of data records used for calculation this result- Returns:
- the number of data records used for calculation this result
-
accuracy
public double accuracy()Returns the accuracy (as value between 0 and 1) of the model, i.e. how well the model performs in predicting the correct result.- Returns:
- the accuracy of the model
-
confusionMatrix
Returns the confusion matrix for the data of this result. A confusion matrix shows for all classes how many records of a given class have been predicted to be a member of one of the available classes.- Returns:
- string representation of the confusion matrix
-
additionalInfos
Returns additional information about the result. It content will vary depending on the evaluation implementation used to create this evaluation result.- Returns:
- a string representation of additional information about the result
-
toString
-
getKeys
Description copied from interface:Persistent
A class may return key field groups in order to identify already existing objects of that class. A key field group must uniquely identify an object. Multiple such key field groups can be defined. Each of the key field groups must be unique for an object to be unique (thus, group1 matches OR group2 matches etc.).The first key field group is occasionally treated in a special manner as the primary business key. E.g. the export import functionality checks for object existence according to just the first key field group.
If no key field groups can be provided by the implementing class an empty result must be returned - use
Persistent.emptyKeys
to do so.- Specified by:
getKeys
in interfacePersistent
- Overrides:
getKeys
in classPersistentObject
- Returns:
- An array of arrays containing object field names of those fields which
constitute key field groups for uniquely identifying objects of classes implementing this
interface. An example would be
{{"name", "birthdate"},{"ssn"}}
for a class defining two key field groups. The first one contains the fieldsname
andbirthdate
, the second key field group has just one fieldssn
.
-
getLocalObjectName
Description copied from class:PersistentObject
Get the object name in localized form. Subclasses should override this method!- Specified by:
getLocalObjectName
in interfacePersistent
- Overrides:
getLocalObjectName
in classPersistentObject
- Returns:
- the name of the objects in localized form
-
getLocalClassName
- Specified by:
getLocalClassName
in interfacePersistent
- Overrides:
getLocalClassName
in classPersistentObject
- Returns:
- the name of the class in localized form. Subclasses should override this method!
-