# TruthValue

An Atom may have one of several different kinds of **TruthValue**s. These include (among others) SimpleTruthValues, FormulaTruthValues, CountTruthValues and IndefiniteTruthValues. All truth values expose at least two parameters describing truth:

**Strength**, a floating-point value ranging from 0 to 1, with 0 denoting the classical Boolean*false*, and 1.0 denoting*true*.

**Confidence**, a floating point value ranging from 0 to 1, expressing the certainty of the strength, with 0 denoting*completely uncertain*, and 1 denoting*completely confident*.

Other truth value types may express strength or confidence intervals, or provide features for statistics gathering or temporal information.

The TruthValue can be introduced into a symbolic expression (arithmetic formula) by using the TruthValueOf, StrengthOf, and ConfidenceOf links.

**CAUTION**: in PLN, it is assumed that the truth value of EvaluationLink and MemberLink is a fuzzy set membership value, and NOT a probabilistic truth value. Neither the C++ code, nor the python or scheme wrappers distinguish these two types of truth values at this time. Combining these two different kinds of truth values can and will result in crazy results. *Caveat Emptor!*. This can be remedied in two different ways: one way is to use the FuzzyTruthValue, described below, when and where appropriate; the other is to use the Generalized Distributional TV [1].

The base type for all TruthValues is the FloatValue. The standard type specification system can be used to describe what functions return what kinds of truth values. See GroundedPredicateNode for an explicit example of specifying the signature of function returning a truth value.

## SimpleTruthValue

Holds two floating-point values, commonly called "strength" and "confidence".

### Strength

Unless it is a fuzzy truth value (perhaps implementing GDTV would be more indicated), the strength represents a probability estimate of the true unknown probability.

### Confidence

The confidence captures the spread of the second order distribution over the true unknown probability. If the confidence is 1 the spread is null. If the confidence is 0 the spread is uniform, that is we know nothing about the true probability.

The spread of the second order distribution shrinks as more evidence accumulates, so it depends on the number of observations. There is a function to translate the count N (number of observations) into confidence

c = N / (N + K)

as the count increases, so does the confidence. This function is could be something else, like say 1 - std-dev, or anything that is monotonous and has co-domain [0, 1], but it has the advantage of being simple.

## FormulaTruthValue

The FormulaTruthValue holds a numeric formula that is re-evaluated every time that it's numeric value is requested. This it can be a dynamically-changing function of it's inputs. When evaluated, it always returns a SimpleTruthValue.

## CountTruthValue

Holds three floating point values. The third number is meant to be interpreted as a raw count (integer) of having seen some event. Occasionally, the third number may hold the logarithm of the normalized frequency (*i.e.* observed probability) of the event.

## IndefiniteTruthValue

Holds four floating point numbers.

## FuzzyTruthValue

FuzzyTruthValue: A TruthValue that stores a mean and the number of observations (strength and confidence).

## ProbabilisticTruthValue

ProbabilisticTruthValue: A TruthValue that stores a mean, a confidence and the number of observations.

## EvidenceCountTruthValue

EvidenceCountTruthValue: A TruthValue that stores a positive and an optional total count, and calculates on demand the mean and the confidence when the total count is defined.