public abstract class FunctionModel extends Model
UPFunctionModel.M
.
The main action is in and around condModel(id)
.
Also see Dependent
. For a simple but useful example of a
Function Model see CPT
(conditional probability table).
Note that 'id' and/or 'od' may be multivariate.
(And, a FunctionModel is a Model, not a Function
.-)
Also see Model
and SeriesModel
.Model.Defaults, Model.Transform
Value.Atomic, Value.Bool, Value.Char, Value.Chars, Value.Cts, Value.Defer, Value.Discrete, Value.Enum, Value.Inc_Or, Value.Int, Value.Lambda, Value.List, Value.Maybe, Value.Option, Value.Real, Value.Scannable, Value.Structured, Value.Triv, Value.Tuple
Constructor and Description |
---|
FunctionModel(double msg1,
double msg2,
Value sp)
Construct a fully parameterised FunctionModel with 2-part message
length msg1+msg2, and statistical parameter(s), sp.
|
Modifier and Type | Method and Description |
---|---|
FunctionModel |
asGiven(double msg2)
Calls
asGiven(0, msg2) . |
FunctionModel |
asGiven(double msg1,
double msg2)
Return a clone of 'this' FunctionModel but with msg1
and msg2 as specified.
|
UPFunctionModel |
asUPModel()
Treat 'this' fully parameterised FunctionModel as an
UnParameterised one.
|
abstract Model |
condModel(Value id)
Return the Model for output datum, od, conditional upon the
given input datum, id.
|
double |
condNl2Pr(Value id,
Value od)
Base 2 (bits) version of
condNlPr . |
double |
condNlPr(Value id,
Value od)
Return the negative log probability of the output datum, od,
conditional upon the input datum, id.
|
double |
condPr(Value id,
Value od)
Return the probability of the output datum, od, conditional upon
the input datum, id.
|
double |
nlPr(Value iod)
Given iod = 〈id, od〉,
return -log pr(od|id).
|
double |
pr(Value iod)
Given iod = 〈id, od〉,
return pr(od|id).
|
Value |
random()
random() is inappropriate and throws an Exception
but see random(id) . |
Value |
random(Value id)
|
asEstimator, m1m2sp, msg, msg1, msg1bits, msg2, msg2bits, msgBits, nl2LH, nl2Pr, nlLH, random, randomSeries, statParams, stats, stats, stats, stats, sumNlPr, toString, transform, type, zeroTriv
public FunctionModel(double msg1, double msg2, Value sp)
public abstract Model condModel(Value id)
condModel(id)
is the
key thing to define for a new FunctionModel.
Also see condNlPr(id,od)
and condPr(id,od)
.public double nlPr(Value iod)
conditional
upon id.
(Also see Dependent
.)public double pr(Value iod)
conditional
upon id.
(Also see Dependent
.)public double condNlPr(Value id, Value od)
condModel(id)
.nlPr(od)
but a sub-class might know a short cut?public double condPr(Value id, Value od)
condModel(id)
.pr(od)
but a sub-class might know a short cut?public FunctionModel asGiven(double msg2)
asGiven(0, msg2)
.public FunctionModel asGiven(double msg1, double msg2)
asGiven(,)
.public UPFunctionModel asUPModel()
asUPModel()
.public Value random()
random()
is inappropriate and throws an Exception
but see random(id)
.
Note, that condModel(id)
might implement random(), we hope.public Value random(Value id)
condModel(id)
.random()
.
Given an input datum 'id', generate a random output datum.
Obviously requires condModel(id) to implement random().