public abstract class Estimator extends Function.Native
UnParameterised
Model. Most Estimators will be
instances of UPModel.Est
, UPFunctionModel.Est
or
UPSeriesModel.Est
.
Note that an Estimator can do all that a UPModel can do,
sp2Model(m1,m2,sp)
&
stats(ds)
, and in addition
ds2Model(ds)
&
ss2Model(ss)
. In general these last two
depend on the Estimator's own parameter(s)
which may, for example, control a prior.Function.Native.WithInverse
Function.Cts2Cts, Function.Cts2Cts2Cts, Function.CtsD2CtsD, Function.HasInverse, Function.Native, Function.Native2, Function.Native3
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
Modifier and Type | Field and Description |
---|---|
Value |
params
The Estimator's parameters, notably the parameters
of a prior on the estimated-Model's statistical parameters.
|
Constructor and Description |
---|
Estimator(Value params)
An Estimator may have parameters, notably
parameters of a prior.
|
Modifier and Type | Method and Description |
---|---|
Model |
apply(Value ds)
Apply, 'this' Estimator to a data-set,
ds , that is,
return the Model ds2Model(ds) . |
UPModel |
asUPModel()
In some context, it might(?) be necessary to treat 'this'
Estimator as an
UnParameterised Model, upm, where
upm.estimator(triv) always returns
'this' Estimator. |
abstract Value |
defnParams()
Return problem-defining parameter,
for example, by
UPModel.defnParams() . |
Model |
ds2Model(Vector ds)
|
Value.Tuple |
ds2ModelSp(Vector ds)
|
abstract Model |
sp2Model(double m1,
double m2,
Value sp)
Given part 1 and part 2 message lengths, m1 and m2, and
statistical parameter(s), sp, return a fully parameterised Model.
|
abstract Model |
ss2Model(Value ss)
Given sufficient statistics,
ss= ,
of a data-set, ds, estimate a fully parameterised Model, ss2Model(ss). |
Value.Tuple |
ss2ModelSp(Value ss)
Given stats, ss, estimate a Model and parameters; this default is
(mdl, sp), where mdl=ss2Model(ss) and sp=mdl.statParams()
(usually).
|
abstract Value |
stats(boolean add,
Value ss0,
Value ss1)
Combine
statisticses
ss0 and ss1, '+' if add=true otherwise '-'. |
Value |
stats(boolean add,
Value ss0,
Vector ds,
int lo,
int hi)
Add (remove)
statistics for ds.[lo,hi) to (from)
statistics ss0. |
Value |
stats(Vector ds)
|
abstract Value |
stats(Vector ds,
int lo,
int hi)
Given a data-set 'ds', return sufficient statistics for elements
[lo, hi), lo inclusive to hi exclusive,
ss = stats(ds,lo,hi).
|
java.lang.String |
toString()
Return a String representation of 'this' Estimator.
|
public final Value params
triv
ial.public Estimator(Value params)
public final Model apply(Value ds)
ds
, that is,
return the Model ds2Model(ds)
.
Also see Function.apply(la.la.Value)
.apply
in class Function.Native
public abstract Value defnParams()
UPModel.defnParams()
.public abstract Model sp2Model(double m1, double m2, Value sp)
sp2Model(m1,m2,sp)
.public Value stats(Vector ds)
stats(0,ds.nElts())
. There is
unlikely to be any need for a subclass to override stats(ds).public abstract Value stats(Vector ds, int lo, int hi)
ss2Model(ss)
, say.
More on stats [here
].public abstract Value stats(boolean add, Value ss0, Value ss1)
statisticses
ss0 and ss1, '+' if add=true otherwise '-'.public Value stats(boolean add, Value ss0, Vector ds, int lo, int hi)
Add
(remove)
statistics
for ds.[lo,hi) to (from)
statistics ss0. There is unlikely to be any need for a subclass
to override stats(add,ss0,ds,lo,hi).public final Value.Tuple ds2ModelSp(Vector ds)
public final Model ds2Model(Vector ds)
ss2Model
(stats(ds)
).
Also see ds2ModelSp(ds)
!public Value.Tuple ss2ModelSp(Value ss)
asUPModel()
's estimator(()) –
which returns (mdl, triv). The distinction ss2ModelSp:ss2Model,
and ds2ModelSp:ds2Model, can matter to a compound UnParameterised
Model handed a Model.asUPModel().public abstract Model ss2Model(Value ss)
ss=stats(ds)
,
of a data-set, ds, estimate a fully parameterised Model, ss2Model(ss).
Also see ss2Model(ss)
!public java.lang.String toString()
public UPModel asUPModel()
UnParameterised
Model, upm, where
upm.estimator(triv)
always returns
'this' Estimator. Also see Model.asUPModel()
.