|
latest version v1.9 - last update 24 Nov 2005 |
|
#include <ltiClassifier.h>
Inheritance diagram for lti::classifier::outputVector:


Public Member Functions | |
| outputVector () | |
| outputVector (const outputVector &other) | |
| outputVector (const int &size) | |
| outputVector (const ivector &theIds, const dvector &theValues) | |
| outputVector & | copy (const outputVector &other) |
| outputVector & | operator= (const outputVector &other) |
| outputVector * | clone () const |
| int | size () const |
| bool | find (const int &id, int &pos) const |
| void | setValues (const dvector &theValues) |
| bool | setValueByPosition (const int &pos, const double &value) |
| bool | setValueById (const int &id, const double &value) |
| const dvector & | getValues () const |
| void | setIds (const ivector &theIds) |
| void | setIdsAndValues (const ivector &theIds, const dvector &theValues) |
| const ivector & | getIds () const |
| bool | setPair (const int &pos, const int &id, const double &value) |
| bool | getId (const int &pos, int &id) const |
| bool | getValueByPosition (const int &pos, double &value) const |
| bool | getValueById (const int &id, double &value) const |
| bool | getPair (const int &pos, int &id, double &value) const |
| bool | setWinnerUnit (const int &pos) |
| int | setWinnerAtMax () |
| int | getWinnerUnit () const |
| void | setReject (const bool &rej) |
| bool | isRejected () const |
| void | setConfidenceValue (const double &conf) |
| double | getConfidenceValue () const |
| void | sortAscending () |
| void | sortDescending () |
| void | makeProbDistribution () |
| bool | compatible (const outputVector &other) const |
| bool | noMultipleIds () const |
| void | idMaximize () |
| void | idSum () |
| double | maxValue () const |
| int | maxPosition () const |
| int | maxId () const |
| void | maxPair (int &id, double &value) const |
| double | minValue () const |
| int | minPosition () const |
| int | minId () const |
| void | minPair (int &id, double &value) const |
| outputVector & | add (const outputVector &other) |
| outputVector & | add (const outputVector &a, const outputVector &b) |
| outputVector & | add (const double &s) |
| outputVector & | addScaled (const outputVector &other, const double &s) |
| outputVector & | mul (const outputVector &other) |
| outputVector & | mul (const outputVector &a, const outputVector &b) |
| outputVector & | mul (const double &s) |
| outputVector & | divide (const double &s) |
| outputVector & | max (const outputVector &other) |
| outputVector & | max (const outputVector &a, const outputVector &b) |
| outputVector & | min (const outputVector &other) |
| outputVector & | min (const outputVector &a, const outputVector &b) |
| bool | write (ioHandler &handler, const bool complete=true) const |
| bool | read (ioHandler &handler, const bool complete=true) |
Protected Attributes | |
| ivector | ids |
| dvector | values |
| int | winner |
| double | confidence |
| bool | reject |
| bool | valid |
| bool | sortedAsc |
| bool | sortedDesc |
It is usually built by a classifier using its internal outputTemplate. The outputVector contains labels (also called ids) and values (usually probabilities). Typically, each label occurs only once in the outputVector and all values are between 0 and 1 and form a probability distribution. However, this is not required by definition. Each classifier should document the nature of its outputVector.
In general, an ouputVector looks like this:
Some classifiers have multiple outputs for each class or unnormalized values. In case this is not wanted in further processing outputVector supplies several methods for manipulation of labels and values.
The method idMaximize() searches for all multiple ids and erases all but the entry with the highest value. For the above example this leads to the following outputVector:
The values for multiple ids are summed using the method idSum(). After execution there is only one entry for each label with the sum of values as new value. For the example the result is:
Due to algorithmic reasons both methods sort the labels in ascending order. You can check wether multiple labels exist with the method noMultipleIds().
For many application it is useful if the values of the ouputVector form a probability distribution over the labels, i.e. all values are greater equal zero and the sum over all values is one. This is accomplished by the method makeProbDistribution(). It sets values below zero to zero and then normalizes the values to sum to one. When applied to the two outputVectors above the method gives the following results:
A classifier or an independent module can decide that a classification result does not contain any useful informations. Such an outputVector is marked as rejected by calling setReject() with argument either true or false. The status is queried with isRejected().
Some classifiers, instead of rejecting a result or not, give confidence values. These lie between 0 for lowest and 1 for highest confidence. The confidence is set with setConfidenceValue() and queried with getConfidenceValue().
NOTE: Confidence values are not taken into account when algebraic methods are called.
If possible all classifiers should define a winner unit. This is the index (which usually corresponds to the same posisition in an internal result) in the ouputVector which achieved the best result in the classification. The winner unit is specified by calling setWinnerUnit(). If the winner unit is the one with the maximum value in the ouputVector, the method setWinnerAtMax() can be used. The information is retrieved with getWinnerUnit().
If two or more outputVectors are to be merged or compared it is useful to know whether they describe the same set of labels. The method compatible() checks whether another outputVector contains exactly the same labels as this outputVector.
Other functional groups of methods include:
|
|
Default Constructor.
|
|
|
Copy Constructor.
|
|
|
Constructor. Creates an outputVector of the given size.
|
|
||||||||||||
|
Constructor. Sets the values and the ids. |
|
|
Adds the given scalar to each value of the outputVector.
|
|
||||||||||||
|
Adds the two outputVectors and writes the result into this outputVector.
|
|
|
Adds the other outputVector to this outputVector. I.e. for each id that exists in both outputVectors the values are added, else the value remains unchanged and the new ids are appended to this outputVector.
|
|
||||||||||||
|
Adds the other outputVector scaled by s to this outputVector. I.e. for each id that exists in both outputVectors the values are added, else the value remains unchanged and the new ids are appended to this outputVector.
|
|
|
clone method.
|
|
|
Checks whether the other outputVector contains exactly the same ids as this outputVector.
|
|
|
copy method. Copy other into this and return this. |
|
|
Divides each value of the outputVector by the given scalar.
|
|
||||||||||||
|
Finds the given id in the outputVector and returns its position if contained in the outputVector. If the id is not found false is returned and the position set to -1.
|
|
|
Returns the confidence value for this outputVector. Values are between zero (no confidence) and one (total confidence). |
|
||||||||||||
|
Returns the id at the given position.
|
|
|
Returns a const reference to the ids of the outputVector.
|
|
||||||||||||||||
|
Returns the id and the value at the given position.
|
|
||||||||||||
|
Returns the value for the given id. If an id is used more than once the value with the lowest position is returned.
|
|
||||||||||||
|
Returns the value at the given position.
|
|
|
Returns a const reference to the values of the outputVector.
|
|
|
Get position of the winner.
|
|
|
If an id is given more than once, the maximum value is sought and all other units of this id erased. The resulting outputVector is sorted by ids. |
|
|
If an id is given more than once, the sum of the values is computed and only one unit of that id remains. The resulting outputVector is sorted by ids. |
|
|
Returns whether the ouputVector was marked as rejected or not.
|
|
|
Lets the outputVector comply to rules for probability distributions: Values between 0 and 1, sum of values equals 1. This is done by setting values that are lower than zero to zero and afterwards dividing each value by the sum of values. |
|
||||||||||||
|
Calculates the maximum between the two outputVectors and writes it into this outputVector. Analog to inplace version.
|
|
|
Calculates the maximum between the other and this outputVector. I.e. for each id that exists in both outputVectors the maximum is taken, else the value stays unchanged and the new ids are appended to this outputVector.
|
|
|
Find the id of the maximum value in the outputVector.
|
|
||||||||||||
|
Find the id-value pair with the maximum value in the outputVector. This is faster than finding them separately!
|
|
|
Find the position of the maximum value in the outputVector.
|
|
|
Find the maximum value in the outputVector.
|
|
||||||||||||
|
Calculates the minimum between the two outputVectors and writes it into this outputVector. Analog to inplace version.
|
|
|
Calculates the minimum between the other and this outputVector. I.e. for each id that exists in both outputVectors the minimum is taken, else the value is zero and the new ids are appended to this outputVector.
|
|
|
Find the id of the minimum value in the outputVector.
|
|
||||||||||||
|
Find the id-value pair with the minimum value in the outputVector. This is faster than finding them separately!
|
|
|
Find the position of the minimum value in the outputVector.
|
|
|
Find the minimum value in the outputVector.
|
|
|
Multiplies each value of the outputVector with the given scalar.
|
|
||||||||||||
|
Multiplies the two outputVectors and writes the result into this outputVector.
|
|
|
Multiplies the other outputVector with this outputVector. I.e. for each id that exists in both outputVectors the values are multiplied, else the value is zero and the new ids are appended to this outputVector.
|
|
|
Returns true if there are never two elements of the outputVector with the same id.
|
|
|
copy operator. Copy other into this and return this. |
|
||||||||||||
|
read the objectProb from the given ioHandler
Reimplemented from lti::ioObject. |
|
|
Sets the confidence value for this outputVector. The value must be between 0 and 1 for lowest and highest confidence. Default is 1. Other values are cropped.
|
|
|
Sets the ids of the outputVector.
|
|
||||||||||||
|
Sets the ids of the outputVector and the values. The state of the instance will be exactly as after constructing an outputVector with ids and values. If the sizes of both vectors are not equal, the smallest size will be used and the largest vector will be cut.
|
|
||||||||||||||||
|
Sets the id and the value at the given position. If the position does not exist, false is returned.
|
|
|
Sets whether result is rejected. Default for reject is false.
|
|
||||||||||||
|
Sets the value for the given id in the outputVector.
|
|
||||||||||||
|
Sets the value at the given position of the outputVector.
|
|
|
Sets the values of the outputVector. The internal vector will be resized to the size of theValues.
|
|
|
Set the winner unit as the position of the maximum value of the outputVector.
|
|
|
Set the winner unit.
|
|
|
Returns the number of elements in the outputVector.
|
|
|
Sorts the outputVector so that values are in ascending order. The sort is only executed if the vector is not already sorted. Ids and winner position are adjusted accordingly. |
|
|
Sorts the outputVector so that values are in descending order. The sort is only executed if the vector is not already sorted. Ids and winner position are adjusted accordingly. |
|
||||||||||||
|
write the objectProb in the given ioHandler
Reimplemented from lti::ioObject. |
|
|
Expresses the confidence in this outputVector. A value of 0 means no confidence, a value of 1 stands for 100% confidence. Default is 1. |
|
|
The ids of the the objects for which the corresponding values (usually a probability) stand.
|
|
|
The outputVector is rejected when this flag is true.
|
|
|
Indicates if vector is sorted in ascending order.
|
|
|
Indicates if vector is sorted in descending order.
|
|
|
The outputVector is valid only when this flag is true (default). Invalid results should not be used for further processing. |
|
|
The actual results of each output unit. Usually, the values are probabilities but other double values are legitimate as well. |
|
|
The position in the outputVector that contains the winner element, ie internal id.
|