|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59193 - in sandbox/statistics/non_parametric: boost/statistics/detail/non_parametric/empirical_distribution boost/statistics/detail/non_parametric/kolmogorov_smirnov libs/statistics/detail/non_parametric/example
From: erwann.rogard_at_[hidden]
Date: 2010-01-21 08:07:14
Author: e_r
Date: 2010-01-21 08:07:13 EST (Thu, 21 Jan 2010)
New Revision: 59193
URL: http://svn.boost.org/trac/boost/changeset/59193
Log:
m
Text files modified:
sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/count.hpp | 9 ++++-----
sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/frequency.hpp | 2 +-
sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/ordered_sample.hpp | 3 ++-
sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/check_convergence.hpp | 2 ++
sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp | 11 ++++-------
sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.cpp | 8 +-------
6 files changed, 14 insertions(+), 21 deletions(-)
Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/count.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/count.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/count.hpp 2010-01-21 08:07:13 EST (Thu, 21 Jan 2010)
@@ -35,11 +35,10 @@
namespace impl{
- // Count of occurences matching (or less equal than) a given value
- //
- // Warning : If Cum == true boost::is_float<T> affects the implementa-
- // tion. For example, if say the samples are generated from a Poisson
- // [Normal] distribution, T must be an integral [a float] type.
+ // Count of occurences matching (Cum = false) a given value or less or equal
+ // to that value (Cum = true).
+ //
+ // T can be an integer or a float
template<typename T,bool Cum,typename Comp = std::less<T> >
class count : public boost::accumulators::accumulator_base{
typedef Comp comp_;
Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/frequency.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/frequency.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/frequency.hpp 2010-01-21 08:07:13 EST (Thu, 21 Jan 2010)
@@ -32,7 +32,7 @@
namespace impl{
- // Same as count but expressed as a percentage (type T1) of the sample size
+ // Frequency as percentage of the sample size
//
// Warning : See empirical_distribution::impl::count.
template<typename T,bool Cum,typename T1>
Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/ordered_sample.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/ordered_sample.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/ordered_sample.hpp 2010-01-21 08:07:13 EST (Thu, 21 Jan 2010)
@@ -27,7 +27,8 @@
namespace impl{
- // Associates sample values (type T) with their number of occurences in the sample
+ // Associates sample values (type T) with their number of occurences in
+ // the sample
template<typename T>
class ordered_sample
: public boost::accumulators::accumulator_base{
Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/check_convergence.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/check_convergence.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/check_convergence.hpp 2010-01-21 08:07:13 EST (Thu, 21 Jan 2010)
@@ -28,6 +28,8 @@
namespace detail{
namespace kolmogorov_smirnov{
+ // Generates kolmogorov-smirnov statistics for each of a sequence of
+ // sample sizes, given a random generator and a reference distribution
template<
typename T1 = double,
typename MoreFeatures = boost::accumulators::stats<>
Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp 2010-01-21 08:07:13 EST (Thu, 21 Jan 2010)
@@ -7,8 +7,6 @@
///////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_STATISTICS_DETAIL_KOLMOGOROV_SMIRNOV_STATISTIC_HPP_ER_2010
#define BOOST_STATISTICS_DETAIL_KOLMOGOROV_SMIRNOV_STATISTIC_HPP_ER_2010
-#include <iostream> // tmp
-
#include <boost/type_traits.hpp>
#include <boost/range.hpp>
@@ -24,7 +22,7 @@
#include <boost/accumulators/framework/parameters/sample.hpp>
#include <boost/accumulators/framework/parameters/accumulator.hpp>
#include <boost/accumulators/framework/depends_on.hpp>
-#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/count.hpp>
#include <boost/statistics/detail/non_parametric/empirical_distribution/count.hpp>
@@ -37,10 +35,8 @@
namespace impl{
- // Usage :
- // Let acc denote an accumulator with feature kolmogorov::tag::statistic,
- // T1 result = extract::statistic(acc,dist);
- //
+ // Computes the kolmogorov-statistic for a given reference distribution
+ //
// Warning : See empirical_distribution::impl::count
template<typename T,typename T1>
class statistic : public boost::accumulators::accumulator_base{
@@ -144,6 +140,7 @@
namespace extract
{
+ // Usage : statistic<T1>(acc,dist)
template<typename T1,typename AccSet,typename D>
typename boost::statistics::detail::kolmogorov_smirnov
::result_of::template statistic<T1,AccSet>::type
Modified: sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.cpp
==============================================================================
--- sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.cpp (original)
+++ sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.cpp 2010-01-21 08:07:13 EST (Thu, 21 Jan 2010)
@@ -17,7 +17,6 @@
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/statistics/detail/non_parametric/empirical_distribution/frequency.hpp>
-#include <boost/statistics/detail/non_parametric/kolmogorov_smirnov/frequency_adaptor.hpp>
#include <libs/statistics/detail/non_parametric/example/frequency_int.h>
void example_frequency_int(std::ostream& os)
@@ -55,20 +54,15 @@
acc_()
);
-// TODO boost::format runtime bug
-// os << (boost::format("empirical {(pdf,cdf):i=1,...,%1%} : ")%n) << std::endl;
- os << "empirical {(pdf,cdf):i=1,...,n} : " << std::endl;
+ os << (boost::format("empirical {(pdf,cdf):i=1,...,%1%} : ")%n).str() << std::endl;
int sum = 0;
for(int i = 0; i<n; i++){
BOOST_ASSERT( ed::extract::count<false>(acc,i+1) == i+1);
sum += i+1;
BOOST_ASSERT( ed::extract::count<true>(acc,i+1) == sum);
- //boost::format f("(%1%,%2%)");
val_ freq = ed::extract::frequency<false,val_>(acc,i+1);
val_ cum_freq = ed::extract::frequency<true,val_>(acc,i+1);
- //f % freq % cum_freq;
- //os << f << std::endl;
os << '(' << freq << ',' << cum_freq << ')' << std::endl;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk