/usr/share/doc/python-pebl/html/data.html is in python-pebl-doc 1.0.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | <!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>data – Pebl Dataset — Pebl v1.0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '1.0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Pebl v1.0.1 documentation" href="index.html" />
<link rel="up" title="API Reference" href="apiref.html" />
<link rel="next" title="discretizer – Discretization algorithms" href="discretizer.html" />
<link rel="prev" title="cpd – Conditional probability distributions" href="cpd.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="discretizer.html" title="discretizer – Discretization algorithms"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="cpd.html" title="cpd – Conditional probability distributions"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Pebl v1.0.1 documentation</a> »</li>
<li><a href="apiref.html" accesskey="U">API Reference</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-pebl.data">
<span id="data-pebl-dataset"></span><h1><tt class="xref py py-mod docutils literal"><span class="pre">data</span></tt> – Pebl Dataset<a class="headerlink" href="#module-pebl.data" title="Permalink to this headline">¶</a></h1>
<p>This module provides classes and functions for working with datasets.</p>
<div class="section" id="configuration-parameters">
<h2>Configuration Parameters<a class="headerlink" href="#configuration-parameters" title="Permalink to this headline">¶</a></h2>
<dl class="confparam">
<dt id="confparam-data.discretize">
<tt class="descname">data.discretize</tt><a class="headerlink" href="#confparam-data.discretize" title="Permalink to this definition">¶</a></dt>
<dd><p>Number of bins used to discretize data. Specify 0 to indicate that data should not be discretized.
default=0</p>
</dd></dl>
<dl class="confparam">
<dt id="confparam-data.filename">
<tt class="descname">data.filename</tt><a class="headerlink" href="#confparam-data.filename" title="Permalink to this definition">¶</a></dt>
<dd><p>File to read data from.
default=None</p>
</dd></dl>
<dl class="confparam">
<dt id="confparam-data.text">
<tt class="descname">data.text</tt><a class="headerlink" href="#confparam-data.text" title="Permalink to this definition">¶</a></dt>
<dd><p>The text of a dataset included in config file.
default=’‘</p>
</dd></dl>
</div>
<div class="section" id="dataset-class">
<h2>Dataset class<a class="headerlink" href="#dataset-class" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="pebl.data.Dataset">
<em class="property">class </em><tt class="descclassname">pebl.data.</tt><tt class="descname">Dataset</tt><big>(</big><em>observations</em>, <em>missing=None</em>, <em>interventions=None</em>, <em>variables=None</em>, <em>samples=None</em>, <em>skip_stats=False</em><big>)</big><a class="headerlink" href="#pebl.data.Dataset" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a pebl Dataset instance.</p>
<p>A Dataset consists of the following data structures which are all
numpy.ndarray instances:</p>
<ul>
<li><dl class="first docutils">
<dt>observations: a 2D matrix of observed values. </dt>
<dd><ul class="first last simple">
<li>dimension 1 is over samples, dimension 2 is over variables.</li>
<li>observations[i,j] is the observed value for jth variable in the ith
sample.</li>
</ul>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>missing: a 2D binary mask for missing values</dt>
<dd><ul class="first last simple">
<li>missing[i,j] = 1 IFF observation[i,j] is missing</li>
</ul>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>interventions: a 2D binary mask for interventions</dt>
<dd><ul class="first last simple">
<li>interventions[i,j] = 1 IFF the jth variable was intervened upon in
the ith sample.</li>
</ul>
</dd>
</dl>
</li>
<li><p class="first">variables,samples: 1D array of variable or sample annotations</p>
</li>
</ul>
<p>This class provides a few public methods to manipulate datasets; one can
also use numpy functions/methods directly.</p>
<p>Required/Default values:</p>
<blockquote>
<div><ul class="simple">
<li>The only required argument is observations (a 2D numpy array).</li>
<li>If missing or interventions are not specified, they are assumed to
be all zeros (no missing values and no interventions).</li>
<li>If variables or samples are not specified, appropriate Variable or
Sample annotations are created with only the name attribute.</li>
</ul>
</div></blockquote>
<dl class="docutils">
<dt>Note:</dt>
<dd>If you alter Dataset.interventions or Dataset.missing, you must
call Dataset._calc_stats(). This is a terrible hack but it speeds
up pebl when used with datasets without interventions or missing
values (a common case).</dd>
</dl>
<dl class="method">
<dt id="pebl.data.Dataset.check_arities">
<tt class="descname">check_arities</tt><big>(</big><big>)</big><a class="headerlink" href="#pebl.data.Dataset.check_arities" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks whether the specified airty >= number of unique observations.</p>
<p>The check is only performed for discrete variables.</p>
<p>If this check fails, the CPT and other data structures would fail.
So, we should raise error while loading the data. Fail Early and Explicitly!</p>
</dd></dl>
<dl class="method">
<dt id="pebl.data.Dataset.discretize">
<tt class="descname">discretize</tt><big>(</big><em>includevars=None</em>, <em>excludevars=</em><span class="optional">[</span><span class="optional">]</span>, <em>numbins=3</em><big>)</big><a class="headerlink" href="#pebl.data.Dataset.discretize" title="Permalink to this definition">¶</a></dt>
<dd><p>Discretize (or bin) the data in-place.</p>
<p>This method is just an alias for pebl.discretizer.maximum_entropy_discretizer()
See the module documentation for pebl.discretizer for more information.</p>
</dd></dl>
<dl class="attribute">
<dt id="pebl.data.Dataset.has_interventions">
<tt class="descname">has_interventions</tt><a class="headerlink" href="#pebl.data.Dataset.has_interventions" title="Permalink to this definition">¶</a></dt>
<dd><p>Whether the dataset has any interventions.</p>
</dd></dl>
<dl class="attribute">
<dt id="pebl.data.Dataset.has_missing">
<tt class="descname">has_missing</tt><a class="headerlink" href="#pebl.data.Dataset.has_missing" title="Permalink to this definition">¶</a></dt>
<dd><p>Whether the dataset has any missing values.</p>
</dd></dl>
<dl class="attribute">
<dt id="pebl.data.Dataset.shape">
<tt class="descname">shape</tt><a class="headerlink" href="#pebl.data.Dataset.shape" title="Permalink to this definition">¶</a></dt>
<dd><p>The shape of the dataset as (number of samples, number of variables).</p>
</dd></dl>
<dl class="method">
<dt id="pebl.data.Dataset.subset">
<tt class="descname">subset</tt><big>(</big><em>variables=None</em>, <em>samples=None</em><big>)</big><a class="headerlink" href="#pebl.data.Dataset.subset" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a subset of the dataset (and metadata).</p>
<p>Specify the variables and samples for creating a subset of the data.
variables and samples should be a list of ids. If not specified, it is
assumed to be all variables or samples.</p>
<p>Some examples:</p>
<blockquote>
<div><ul class="simple">
<li>d.subset([3], [4])</li>
<li>d.subset([3,1,2])</li>
<li>d.subset(samples=[5,2,7,1])</li>
</ul>
</div></blockquote>
<p>Note: order matters! d.subset([3,1,2]) != d.subset([1,2,3])</p>
</dd></dl>
<dl class="method">
<dt id="pebl.data.Dataset.subset_byname">
<tt class="descname">subset_byname</tt><big>(</big><em>variables=None</em>, <em>samples=None</em><big>)</big><a class="headerlink" href="#pebl.data.Dataset.subset_byname" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a subset of the dataset (and metadata).</p>
<p>Same as Dataset.subset() except that variables and samples can be
specified by their names.</p>
<p>Some examples:</p>
<blockquote>
<div><ul class="simple">
<li>d.subset(variables=[‘shh’, ‘genex’])</li>
<li>s.subset(samples=[“control%d” % i for i in xrange(10)])</li>
</ul>
</div></blockquote>
</dd></dl>
<dl class="method">
<dt id="pebl.data.Dataset.tofile">
<tt class="descname">tofile</tt><big>(</big><em>filename</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#pebl.data.Dataset.tofile" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the data and metadata to file in a tab-delimited format.</p>
</dd></dl>
<dl class="method">
<dt id="pebl.data.Dataset.tostring">
<tt class="descname">tostring</tt><big>(</big><em>linesep='n'</em>, <em>variable_header=True</em>, <em>sample_header=True</em><big>)</big><a class="headerlink" href="#pebl.data.Dataset.tostring" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the data and metadata as a string in a tab-delimited format.</p>
<p>If variable_header is True, include variable names and type.
If sample_header is True, include sample names.
Both are True by default.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="functions">
<h2>Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="pebl.data.fromstring">
<tt class="descclassname">pebl.data.</tt><tt class="descname">fromstring</tt><big>(</big><em>stringrep</em>, <em>fieldsep='\t'</em><big>)</big><a class="headerlink" href="#pebl.data.fromstring" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse the string representation of a dataset and return a Dataset instance.</p>
<p>See the documentation for fromfile() for information about file format.</p>
</dd></dl>
<dl class="function">
<dt id="pebl.data.fromfile">
<tt class="descclassname">pebl.data.</tt><tt class="descname">fromfile</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#pebl.data.fromfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse file and return a Dataset instance.</p>
<p>The data file is expected to conform to the following format</p>
<blockquote>
<div><ul class="simple">
<li>comment lines begin with ‘#’ and are ignored.</li>
<li>The first non-comment line <em>must</em> specify variable annotations
separated by tab characters.</li>
<li>data lines specify the data values separated by tab characters.</li>
<li>data lines <em>can</em> include sample names</li>
</ul>
</div></blockquote>
<p>A data value specifies the observed numeric value, whether it’s missing and
whether it represents an intervention:</p>
<blockquote>
<div><ul class="simple">
<li>An ‘x’ or ‘X’ indicate that the value is missing</li>
<li>A ‘!’ before or after the numeric value indicates an intervention</li>
</ul>
</div></blockquote>
<p>Variable annotations specify the name of the variable and, <em>optionally</em>,
the data type.</p>
<p>Examples include:</p>
<blockquote>
<div><ul>
<li><p class="first">Foo : just variable name</p>
</li>
<li><p class="first">Foo,continuous : Foo is a continuous variable</p>
</li>
<li><p class="first">Foo,discrete(3) : Foo is a discrete variable with arity of 3</p>
</li>
<li><dl class="first docutils">
<dt>Foo,class(normal,cancer): Foo is a class variable with arity of 2 and</dt>
<dd><p class="first last">values of either normal or cancer.</p>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
</dd></dl>
<dl class="function">
<dt id="pebl.data.fromconfig">
<tt class="descclassname">pebl.data.</tt><tt class="descname">fromconfig</tt><big>(</big><big>)</big><a class="headerlink" href="#pebl.data.fromconfig" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a Dataset from the configuration information.</p>
<p>Loads data and discretizes (if requested) based on configuration
parameters.</p>
</dd></dl>
<dl class="function">
<dt id="pebl.data.merge">
<tt class="descclassname">pebl.data.</tt><tt class="descname">merge</tt><big>(</big><em>datasets</em>, <em>axis=None</em><big>)</big><a class="headerlink" href="#pebl.data.merge" title="Permalink to this definition">¶</a></dt>
<dd><p>Merges multiple datasets.</p>
<p>datasets should be a list of Dataset objects.
axis should be either ‘variables’ or ‘samples’ and determines how the
datasets are merged.</p>
</dd></dl>
</div>
<div class="section" id="variable-and-sample-annotations">
<h2>Variable and sample annotations<a class="headerlink" href="#variable-and-sample-annotations" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="pebl.data.Variable">
<em class="property">class </em><tt class="descclassname">pebl.data.</tt><tt class="descname">Variable</tt><big>(</big><em>name</em>, <em>*args</em><big>)</big><a class="headerlink" href="#pebl.data.Variable" title="Permalink to this definition">¶</a></dt>
<dd><p>Additional information about a variable.</p>
</dd></dl>
<dl class="class">
<dt id="pebl.data.DiscreteVariable">
<em class="property">class </em><tt class="descclassname">pebl.data.</tt><tt class="descname">DiscreteVariable</tt><big>(</big><em>name</em>, <em>param</em><big>)</big><a class="headerlink" href="#pebl.data.DiscreteVariable" title="Permalink to this definition">¶</a></dt>
<dd><p>A variable from a discrete domain.</p>
</dd></dl>
<dl class="class">
<dt id="pebl.data.ContinuousVariable">
<em class="property">class </em><tt class="descclassname">pebl.data.</tt><tt class="descname">ContinuousVariable</tt><big>(</big><em>name</em>, <em>param</em><big>)</big><a class="headerlink" href="#pebl.data.ContinuousVariable" title="Permalink to this definition">¶</a></dt>
<dd><p>A variable from a continuous domain.</p>
</dd></dl>
<dl class="class">
<dt id="pebl.data.ClassVariable">
<em class="property">class </em><tt class="descclassname">pebl.data.</tt><tt class="descname">ClassVariable</tt><big>(</big><em>name</em>, <em>param</em><big>)</big><a class="headerlink" href="#pebl.data.ClassVariable" title="Permalink to this definition">¶</a></dt>
<dd><p>A labeled, discrete variable.</p>
</dd></dl>
<dl class="class">
<dt id="pebl.data.Sample">
<em class="property">class </em><tt class="descclassname">pebl.data.</tt><tt class="descname">Sample</tt><big>(</big><em>name</em>, <em>*args</em><big>)</big><a class="headerlink" href="#pebl.data.Sample" title="Permalink to this definition">¶</a></dt>
<dd><p>Additional information about a sample.</p>
</dd></dl>
</div>
<div class="section" id="exceptions">
<h2>Exceptions<a class="headerlink" href="#exceptions" title="Permalink to this headline">¶</a></h2>
<dl class="exception">
<dt id="pebl.data.ParsingError">
<em class="property">exception </em><tt class="descclassname">pebl.data.</tt><tt class="descname">ParsingError</tt><a class="headerlink" href="#pebl.data.ParsingError" title="Permalink to this definition">¶</a></dt>
<dd><p>Error encountered while parsing an ill-formed datafile.</p>
</dd></dl>
<dl class="exception">
<dt id="pebl.data.IncorrectArityError">
<em class="property">exception </em><tt class="descclassname">pebl.data.</tt><tt class="descname">IncorrectArityError</tt><big>(</big><em>errors</em><big>)</big><a class="headerlink" href="#pebl.data.IncorrectArityError" title="Permalink to this definition">¶</a></dt>
<dd><p>Error encountered when the datafile speifies an incorrect variable arity.</p>
<p>If variable arity is specified, it should be greater than the number of
unique observation values for the variable.</p>
</dd></dl>
<dl class="exception">
<dt id="pebl.data.ClassVariableError">
<em class="property">exception </em><tt class="descclassname">pebl.data.</tt><tt class="descname">ClassVariableError</tt><a class="headerlink" href="#pebl.data.ClassVariableError" title="Permalink to this definition">¶</a></dt>
<dd><p>Error with a class variable.</p>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><tt class="docutils literal"><span class="pre">data</span></tt> – Pebl Dataset</a><ul>
<li><a class="reference internal" href="#configuration-parameters">Configuration Parameters</a></li>
<li><a class="reference internal" href="#dataset-class">Dataset class</a></li>
<li><a class="reference internal" href="#functions">Functions</a></li>
<li><a class="reference internal" href="#variable-and-sample-annotations">Variable and sample annotations</a></li>
<li><a class="reference internal" href="#exceptions">Exceptions</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="cpd.html"
title="previous chapter"><tt class="docutils literal docutils literal docutils literal"><span class="pre">cpd</span></tt> – Conditional probability distributions</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="discretizer.html"
title="next chapter"><tt class="docutils literal"><span class="pre">discretizer</span></tt> – Discretization algorithms</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/data.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="discretizer.html" title="discretizer – Discretization algorithms"
>next</a> |</li>
<li class="right" >
<a href="cpd.html" title="cpd – Conditional probability distributions"
>previous</a> |</li>
<li><a href="index.html">Pebl v1.0.1 documentation</a> »</li>
<li><a href="apiref.html" >API Reference</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2008, Abhik Shah.
Last updated on Apr 29, 2011.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
</div>
</body>
</html>
|