This is an interface to the Netica C API (C API version 3.25) for working with Bayesian belief networks and influence diagrams.
The package “NETICA” is :CASE-SENSITIVE,
e.g., you would write (netica:GetNodeExpectedUtils_bn ...)
when you need to call
GetNodeExpectedUtils_bn.
When this module is present, *FEATURES*
contains the symbol :NETICA.
All public C functions are available as
FFI:FOREIGN-FUNCTIONs.
The functions which are specified to return C arrays, namely
GetNodeBeliefs_bn |
GetNodeExpectedUtils_bn |
GetNodeLikelihood_bn |
GetNodeProbs_bn |
GetNodeLevels_bn |
correspond to FFI:FOREIGN-FUNCTIONs which return FFI:C-POINTERs.
We define low level wrappers for them, namely
GetNodeBeliefs |
GetNodeExpectedUtils |
GetNodeLikelihood |
GetNodeProbs |
GetNodeLevels |
which return the appropriate VECTORs.
Additionally, some higher level functionality is available
(see modules/netica/demo.lisp
for sample usage):
(netica:start-netica &KEY
:license :verbose)NewNeticaEnviron_ns
and InitNetica2_bn and print some
statistics; initialize netica:*env*.
(netica:check-errors &KEY
:env :clear :severity)ClearError_ns), the errors of the
given severity (ErrorSeverity_ns)
and above.
You should call this function after every call
to a Netica function. Every wrapper function in this list calls it,
so you do not need to call it after a call to a wrapper function.
(netica:error-message error)Convert netica error to a STRING containing
ErrorCategory_ns |
ErrorSeverity_ns |
ErrorNumber_ns |
ErrorMessage_ns |
(netica:close-netica &KEY
:env :verbose)netica:*env* to NIL.
(netica:make-net &KEY :name
:comment :title :env :verbose)NewNet_bn,
SetNetTitle_bn and
SetNetComment_bn.
(netica:net-info net &KEY :out)Print some information about the net:
GetNetName_bn |
GetNetTitle_bn |
GetNetComment_bn |
GetNetFileName_bn |
GetNetNodes_bn |
(netica:make-node &KEY
:name :net :kind :levels :states :num-states :title :comment :parents
:cpt :x :y :env :verbose)NewNode_bn
with the given name and many other parameters.
(netica:node-info node
&KEY :header :out)(netica:get-beliefs node
&KEY :env :verbose)GetNodeBeliefs_bn
on the node and pretty-print the results when :VERBOSE
is non-NIL.(netica:enter-finding net node
state &KEY :env :verbose)EnterFinding_bn
using GetNodeNamed_bn
and GetStateNamed_bn.
(netica:save-net net &KEY
:file :env :verbose)WriteNet_bn.
(netica:read-net file &KEY
:env :verbose)ReadNet_bn.
(netica:with-open-dne-file (var
file &REST opts) &BODY body)NewFileStream_ns,
execute body, then DeleteStream_ns
- just like WITH-OPEN-STREAM.netica:*verbose*STREAM or NIL; the default value for
the :VERBOSE argument (initially set to NIL).
netica:*license*:LICENSE argument.
netica:*env*:ENV argument.
| These notes document CLISP version 2.49 | Last modified: 2010-07-07 |