Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-01-30 12:55:25

Niitsuma Hirotaka wrote:
> Boost.Accumulators is quit useful library.
> Until I find this library, I had used Torch
> Torch also provides general framework for various statistical and
> machine-learning methods.
> Boost.Accumulators is more general framework.
> And also we can easily describe various statistical methods.
> In this framework, the statistical methods become readable components.
> (Torch's components are not readable)
> But, in order to add a component requires covarite input, we need to
> modify statistics_fwd.hpp.
> (When I described join_histgram component, I need to modify
> statistics_fwd.hpp and depended other components density.hpp and so on .)
> I think this is not good.
> If possible, just add a file which describes a statistical method, and
> include the file, is better.

I'm not sure I understand. Why did you have to modify
statistics_fwd.hpp? You shouldn't have to.

> It is seem to similar framework can be given by boost::signal
> boost::signal1<void, double> sig;
> sig.connect( &mean );
> sig.connect( &variant );
> sig.connect( &sum );
> for_each(vec.begin(),vec.end(),boost::bind<void>( boost::ref(sig ),_1) );
> In this case, we can add new components by just adding file.
> But Boost.Accumulators is better than boost::signal in many points.
> can describe dependency among components
> can divide incremental part and final part.

This is all dynamically bound (slow) and doesn't not ensure that
accumulators are updated in an order that corresponds to the dependency

> Document is good.
> …
> I will switch Torch to Boost.Accumulators.
> Request:
> I can not find way bind covarite1.
> Plz give example for bind covarite1
> The following code has compile error.
> double d=0.0;
> accumulators::accumulator_set<double, accumulators::stats<
> accumulators::tag::covariance<double , accumulators::tag::covariate1> > >
> acc(accumulators::sample = d,accumulators::covariate1 = d);
> std::for_each(
> boost::make_zip_iterator(
> boost::make_tuple(beg1, beg2)
> ),
> boost::make_zip_iterator(
> boost::make_tuple(end1, end2)
> ),
> boost::bind<void>( boost::ref(acc),(_1, accumulators::covariate1 = _2 ) )
> );

Boost.Bind is a wonderful library, but due to limitations in the
language, there are some things it just doesn't handle well. Rather than
tell you how to write the bind expression (it involves taking the
address of the operator= of the covariate1 named parameter, yuk!), I'll
suggest you write a plain for loop.

Eric Niebler
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at