[9d04bd]: impnotes / netica.html Maximize Restore History

Download this file

netica.html    61 lines (60 with data), 19.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>33.13. Netica Interface</title><link rel="stylesheet" href="impnotes.css" type="text/css" /><link rev="made" href="mailto:clisp-list@lists.sourceforge.net" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_8465" /><link rel="home" href="index.html" title="Implementation Notes for GNU CLISP" /><link rel="up" href="ext-modules.html" title="Chapter 33. Extensions Implemented as Modules" /><link rel="prev" href="matlab.html" title="33.12. Matlab Interface" /><link rel="next" href="pcre.html" title="33.14. Perl Compatible Regular Expressions" /><link rel="copyright" href="legalese.html" title="Legal Status of the CLISP Implementation Notes" /><meta name="date" content="'generated: 2009-07-28 12:48:49-04:00'" /><link rel="author" title="Authors" href="index.html#authors" /><link rel="contents" title="Table of Contents" href="index.html" /><link rel="glossary" href="glossary.html" /><link rel="help" href="faq.html#faq-help" title="How do I ask for help?" /><link rel="home" title="Home" href="http://clisp.cons.org" /><link rel="index" href="idx.html" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">33.13. Netica Interface</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="matlab.html">Prev</a> </td><th width="60%" align="center">Chapter 33. Extensions Implemented as Modules</th><td width="20%" align="right"> <a accesskey="n" href="pcre.html">Next</a></td></tr></table><hr /></div><div class="section" title="33.13. Netica Interface"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="netica"></a>33.13. Netica Interface</h2></div></div></div><p>This is an interface to the <a class="ulink" href="http://norsys.com/netica_c_api.htm" target="_top">Netica C API</a> (<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> API version 3.25)
for working with Bayesian belief networks and influence diagrams.</p><p>The package <strong class="package"><span class="quote"><span class="quote">NETICA</span></span></strong> is
<a class="link" href="package-case.html" title="11.5. Package Case-Sensitivity">case-sensitive</a>, e.g., you would write
<code class="code">(netica:GetNodeExpectedUtils_bn ...)</code>
when you need to call
<a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeExpectedUtils_bn.html"><code class="function">GetNodeExpectedUtils_bn</code></a>.</p><p>When this module is present, <a href="features.html" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:NETICA</code>.</p><p>All public <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> functions are available as
<a class="link" href="dffi.html" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s.</p><p>The functions which are specified to return <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> arrays,
namely </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeBeliefs_bn.html"><code class="function">GetNodeBeliefs_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeExpectedUtils_bn.html"><code class="function">GetNodeExpectedUtils_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeLikelihood_bn.html"><code class="function">GetNodeLikelihood_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeProbs_bn.html"><code class="function">GetNodeProbs_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeLevels_bn.html"><code class="function">GetNodeLevels_bn</code></a></td></tr></table><p> correspond to <a class="link" href="dffi.html" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s which return <a class="link" href="dffi.html#c-pointer"><span class="type">FFI:C-POINTER</span></a>s.
We define low level wrappers for them, namely </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="function">GetNodeBeliefs</code></td></tr><tr><td><code class="function">GetNodeExpectedUtils</code></td></tr><tr><td><code class="function">GetNodeLikelihood</code></td></tr><tr><td><code class="function">GetNodeProbs</code></td></tr><tr><td><code class="function">GetNodeLevels</code></td></tr></table><p> which return the appropriate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s.</p><p>Additionally, some higher level functionality is available
(see <a class="clisp-cvs" href="http://clisp.cvs.sourceforge.net/*checkout*/clisp/clisp/modules/netica/demo.lisp"><code class="filename">modules/netica/demo.lisp</code></a>
for sample usage):</p><div class="variablelist"><dl><dt><span class="term"><code class="code">(netica:start-netica <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
:license :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewNeticaEnviron_ns.html"><code class="function">NewNeticaEnviron_ns</code></a>
and <a class="netica" href="http://norsys.com/onLineAPIManual/functions/InitNetica2_bn.html"><code class="function">InitNetica2_bn</code></a> and print some
statistics; initialize <code class="varname">netica:*env*</code>.
</dd><dt><span class="term"><code class="code">(netica:check-errors <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
:env :clear :severity)</code></span></dt><dd>Show and, optionally, clear
(<a class="netica" href="http://norsys.com/onLineAPIManual/functions/ClearError_ns.html"><code class="function">ClearError_ns</code></a>), the errors of the
given severity (<a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorSeverity_ns.html"><code class="function">ErrorSeverity_ns</code></a>)
and above.
You should call this function after <span class="emphasis"><em>every</em></span> call
to a Netica function. Every wrapper function in this list calls it,
so you do <span class="strong"><strong>not</strong></span> need to call it after a call to a wrapper function.
</dd><dt><span class="term"><code class="code">(netica:error-message error)</code></span></dt><dd><p>Convert netica error to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> containing</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorCategory_ns.html"><code class="function">ErrorCategory_ns</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorSeverity_ns.html"><code class="function">ErrorSeverity_ns</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorNumber_ns.html"><code class="function">ErrorNumber_ns</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorMessage_ns.html"><code class="function">ErrorMessage_ns</code></a></td></tr></table></dd><dt><span class="term"><code class="code">(netica:close-netica <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
:env :verbose)</code></span></dt><dd>Terminate the Netica session.
Sets <code class="varname">netica:*env*</code> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</dd><dt><span class="term"><code class="code">(netica:make-net <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :name
:comment :title :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewNet_bn.html"><code class="function">NewNet_bn</code></a>,
<a class="netica" href="http://norsys.com/onLineAPIManual/functions/SetNetTitle_bn.html"><code class="function">SetNetTitle_bn</code></a> and
<a class="netica" href="http://norsys.com/onLineAPIManual/functions/SetNetComment_bn.html"><code class="function">SetNetComment_bn</code></a>.
</dd><dt><span class="term"><code class="code">(netica:net-info net <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :out)</code></span></dt><dd><p>Print some information about the net:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetName_bn.html"><code class="function">GetNetName_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetTitle_bn.html"><code class="function">GetNetTitle_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetComment_bn.html"><code class="function">GetNetComment_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetFileName_bn.html"><code class="function">GetNetFileName_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetNodes_bn.html"><code class="function">GetNetNodes_bn</code></a></td></tr></table></dd><dt><span class="term"><code class="code">(netica:make-node <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
:name :net :kind :levels :states :num-states :title :comment :parents
:cpt :x :y :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewNode_bn.html"><code class="function">NewNode_bn</code></a>
with the given name and many other parameters.
</dd><dt><span class="term"><code class="code">(netica:node-info node
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :header :out)</code></span></dt><dd>Print some information about the node, preceded by
the header.</dd><dt><span class="term"><code class="code">(netica:get-beliefs node
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeBeliefs_bn.html"><code class="function">GetNodeBeliefs_bn</code></a>
on the node and pretty-print the results when <code class="constant">:VERBOSE</code>
is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(netica:enter-finding net node
state <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/EnterFinding_bn.html"><code class="function">EnterFinding_bn</code></a>
using <a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeNamed_bn.html"><code class="function">GetNodeNamed_bn</code></a>
and <a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetStateNamed_bn.html"><code class="function">GetStateNamed_bn</code></a>.
</dd><dt><span class="term"><code class="code">(netica:save-net net <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
:file :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/WriteNet_bn.html"><code class="function">WriteNet_bn</code></a>.
</dd><dt><span class="term"><code class="code">(netica:read-net file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
:env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/ReadNet_bn.html"><code class="function">ReadNet_bn</code></a>.
</dd><dt><span class="term"><code class="code">(netica:with-open-dne-file (var
file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> opts) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> body)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewFileStream_ns.html"><code class="function">NewFileStream_ns</code></a>,
execute <em class="replaceable"><code>body</code></em>, then <a class="netica" href="http://norsys.com/onLineAPIManual/functions/DeleteStream_ns.html"><code class="function">DeleteStream_ns</code></a>
- just like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a>.</dd><dt><span class="term"><code class="varname">netica:*verbose*</code></span></dt><dd>The log <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>; the default value for
the <code class="constant">:VERBOSE</code> argument (initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>).
</dd><dt><span class="term"><code class="varname">netica:*license*</code></span></dt><dd>The license key provided by
<a class="ulink" href="http://norsys.com/" target="_top">Norsys</a>; the default value
for the <code class="literal">:LICENSE</code> argument.
</dd><dt><span class="term"><code class="varname">netica:*env*</code></span></dt><dd>The Netica environment object; the default value
for the <code class="literal">:ENV</code> argument.
</dd></dl></div></div><div class="bookinfo"><hr /><table width="100%" summary="impnotes meta info"><th><td align="left">These notes document <a class="ulink" href="http://clisp.cons.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> version 2.48</td><td align="right">Last modified: 2009-07-28</td></th></table></div><div class="custom-footer"><hr /><table width="100%"><tr><td align="left"><a href="http://clisp.cons.org"><img src="clisp.png" width="48" height="48" alt="[CLISP home]" /></a></td><td align="center"><a href="https://sourceforge.net/donate/index.php?group_id=1355"><img src="http://images.sourceforge.net/images/project-support.jpg" width="88" height="32" alt="[Support CLISP]" /></a></td><td align="right"><a href="https://sourceforge.net/projects/clisp"><img width="120" height="30" alt="[SourceForge]" src="http://sflogo.sourceforge.net/sflogo.php?group_id=1355&amp;type=12&amp;page=netica" /></a></td></tr></table></div><hr /><form method="get" action="http://www.google.com/custom" target="_top"><table width="100%" border="0"><tr><td nowrap="nowrap" align="center"><input type="hidden" name="domains" value="clisp.cons.org;clisp.podval.org;www.lisp.org" /><label for="sbi" style="display: none">Enter your search terms</label><input type="text" name="q" size="50" maxlength="255" id="sbi" value="33.13. Netica Interface" /><label for="sbb" style="display: none">Submit search form</label><input type="submit" name="sa" value="Google Search" id="sbb" /></td></tr><tr><td nowrap="nowrap" align="center"><input type="radio" name="sitesearch" value="" checked="1" id="ss0" /><label for="ss0" title="Search the Web"><small>Web</small></label><input type="radio" name="sitesearch" value="clisp.cons.org" id="ss1" /><label for="ss1" title="Search clisp.cons.org"><small>clisp.cons.org</small></label><input type="radio" name="sitesearch" value="clisp.podval.org" id="ss2" /><label for="ss2" title="Search clisp.podval.org"><small>clisp.podval.org</small></label><input type="radio" name="sitesearch" value="www.lisp.org" id="ss3" /><label for="ss3" title="Search www.lisp.org"><small>www.lisp.org</small></label><input type="hidden" name="client" value="pub-4445255502750357" /><input type="hidden" name="forid" value="1" /><input type="hidden" name="ie" value="UTF-8" /><input type="hidden" name="oe" value="UTF-8" /><input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:000000;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:48;LW:48;L:http://clisp.cons.org/clisp.png;S:http://clisp.cons.org;FORID:1" /><input type="hidden" name="hl" value="en" /></td></tr></table></form><hr /><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="matlab.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ext-modules.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="pcre.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">33.12. Matlab Interface </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 33.14. Perl Compatible Regular Expressions</td></tr></table></div></body></html>