mirror of
https://github.com/boostorg/histogram.git
synced 2026-01-30 20:02:13 +00:00
93 lines
5.8 KiB
HTML
93 lines
5.8 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
|
<title>Introduction</title>
|
|
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
|
<link rel="home" href="../index.html" title="Chapter 1. Boost.Histogram">
|
|
<link rel="up" href="../index.html" title="Chapter 1. Boost.Histogram">
|
|
<link rel="prev" href="motivation.html" title="Motivation">
|
|
<link rel="next" href="tutorial.html" title="Tutorial">
|
|
</head>
|
|
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
|
<table cellpadding="2" width="100%"><tr>
|
|
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
|
<td align="center"><a href="../../../../../index.html">Home</a></td>
|
|
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
|
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="motivation.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
|
<a name="boost_histogram.introduction"></a><a class="link" href="introduction.html" title="Introduction">Introduction</a>
|
|
</h2></div></div></div>
|
|
<p>
|
|
Histograms are a basic tool in every statistical analysis. They compactly represent
|
|
a data set of one or several random variables with acceptable loss of information.
|
|
It is often more convenient to work with a histogram of a data distribution,
|
|
instead of the original distribution which may consume a lot of memory or disc
|
|
space. Interesting quantities like the mean, variance, or mode may be extracted
|
|
from the histogram instead of the original data set.
|
|
</p>
|
|
<p>
|
|
This library implements a single histogram class with a simple interface, which
|
|
can be used with 1, 2, 3 or N-dimensional data sets (the internal limit is
|
|
set to 16 dimensions). It supports normal counting and weighted counting, and
|
|
its provides a data-driven variance estimate for the sum of the counts in either
|
|
case. The histogram was written so that it <span class="bold"><strong>just works</strong></span>,
|
|
to be efficient and safe to use in its application domain, completely hiding
|
|
the implementation details on how it does its counting (<span class="bold"><strong>you</strong></span>,
|
|
the user, have more important things to worry about).
|
|
</p>
|
|
<p>
|
|
The histogram is implemented in C++ and has Python-bindings. It passes the
|
|
language barrier without copying its internal (possibly large) data buffer.
|
|
The language transparency allows users who do data analysis in Python to create
|
|
an empty histogram instance in Python, pass it over to a complex C++ code for
|
|
filling, then analyse the results::
|
|
</p>
|
|
<p>
|
|
</p>
|
|
<pre class="programlisting"><span class="keyword">import</span> <span class="identifier">histogram</span> <span class="keyword">as</span> <span class="identifier">hg</span>
|
|
<span class="keyword">import</span> <span class="identifier">complex_cpp_module</span>
|
|
|
|
<span class="identifier">h</span> <span class="special">=</span> <span class="identifier">hg</span><span class="special">.</span><span class="identifier">histogram</span><span class="special">(</span><span class="identifier">hg</span><span class="special">.</span><span class="identifier">regular_axis</span><span class="special">(</span><span class="number">100</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">))</span>
|
|
|
|
<span class="identifier">complex_cpp_module</span><span class="special">.</span><span class="identifier">run_filling</span><span class="special">(</span><span class="identifier">h</span><span class="special">)</span>
|
|
|
|
<span class="comment"># h is now filled with data,</span>
|
|
<span class="comment"># continue with statistical analysis of h</span>
|
|
</pre>
|
|
<p>
|
|
</p>
|
|
<p>
|
|
Histograms can be added if they have the same signature. This is convenient
|
|
if histograms are filled in parallel on a cluster and then merged (added).
|
|
</p>
|
|
<p>
|
|
The histogram can be serialized to disk for persistent storage from C++ and
|
|
pickled in Python. It comes with Numpy support, too. The histogram can be fast-filled
|
|
with Numpy arrays for maximum performance, and viewed as a Numpy array without
|
|
copying its memory buffer.
|
|
</p>
|
|
</div>
|
|
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
|
<td align="left"></td>
|
|
<td align="right"><div class="copyright-footer">Copyright © 2016 Hand Dembinski<p>
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
</p>
|
|
</div></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="motivation.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
</body>
|
|
</html>
|