public class NaiveBayes extends UPFunctionModel
NaiveBayes.M
. For a Discrete Bounded
variable, od:O, and arbitrary variable(s), id:I,
NaiveBayes I→O is based on a Dependent Model,
dpndt
:O×I,
[Bayes's theorem], and the (naive) assumption
that id's components are independent of each other.Modifier and Type | Class and Description |
---|---|
class |
NaiveBayes.M
The fully parameterised NaiveBayes FunctionModel I→O;
the UnParameterised FunctionModel is
NaiveBayes . |
UPFunctionModel.Est, UPFunctionModel.K
UPModel.Transform
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 |
---|---|
Dependent |
dpndt
The (UnParameterised) Dependent Model, made of
〈O, O→I〉, that we are going to turn around
(invert) to get I→O as desired.
|
Value |
lwb
lwb and upb, the bounds on the output datum, od.
|
int |
lwb_n
lwb_n and upb_n the
bounds on the
output datum, od, as ints. |
Value |
upb
lwb and upb, the bounds on the output datum, od.
|
int |
upb_n
lwb_n and upb_n the
bounds on the
output datum, od, as ints. |
Constructor and Description |
---|
NaiveBayes(Value dp)
Given definition parameter, dp, being an UnParameterised
Dependent Model, dp:O×I, construct
an UnParameterised NaiveBayes FunctionModel of I→O. |
Modifier and Type | Method and Description |
---|---|
UPFunctionModel.Est |
estimator(Value ps)
Return the Estimator for NaiveBayes; any parameter(s), ps,
is passed to the
Dependent 's Estimator. |
NaiveBayes.M |
sp2Model(double msg1,
double msg2,
Value sps)
Given two-part message lengths, and statistical parameters
sp, return a fully parameterised
model . |
Vector |
stats(boolean add,
Value ss0,
Value ss1)
Combine
stats ss0 and ss1, either
additively (add=true) or negatively (add=false). |
Vector |
stats(Vector ds,
int lo,
int hi)
Given a data-set ds, return statistics ss=ds.[lo,hi) the data itself.
|
apply
public final Value lwb
public final Value upb
public final int lwb_n
bounds
on the
output datum, od, as ints.public final int upb_n
bounds
on the
output datum, od, as ints.public final Dependent dpndt
NaiveBayes.M.dpndt_m
.public Vector stats(Vector ds, int lo, int hi)
M.nlLH(ss)
really needs ss to be the raw data.)public Vector stats(boolean add, Value ss0, Value ss1)
stats
ss0 and ss1, either
additively (add=true) or negatively (add=false).public UPFunctionModel.Est estimator(Value ps)
Dependent
's Estimator.
It seems that msg1 should be smaller than here:
The condModels of I got from the O→I need not be so precise
because the Is are actually common knowledge?public NaiveBayes.M sp2Model(double msg1, double msg2, Value sps)
model
.sp2Model
in class UPFunctionModel