19 #ifndef MCMCDA_PRIOR_H_INCLUDED
20 #define MCMCDA_PRIOR_H_INCLUDED
79 double kappa()
const {
return kappa_; }
82 double theta()
const {
return theta_; }
117 template<
class Track>
132 double N_t_fac = 0.0;
133 double e_t_fac = 0.0;
134 double n_t_fac = 0.0;
135 double a_it_fac = 0.0;
136 for(
size_t t = 1; t <= T; t++)
138 size_t N_t = w.
get_data()[t - 1].size();
141 BOOST_FOREACH(
const Track& track, w)
143 if(track.get_start_time() == t) e_t++;
145 size_t a_it = track.count(t);
146 a_it_fac += lgamma(a_it + 1);
151 size_t n_t = N_t - a_t;
153 N_t_fac += lgamma(N_t + 1);
154 e_t_fac += lgamma(e_t + 1);
155 n_t_fac += lgamma(n_t + 1);
159 double p = m * (log(kappa_) - lambda_A_);
160 p += (e + d) * log(theta_);
161 p += n * log(lambda_N_);
162 p += a * log(lambda_A_);
163 p += -(kappa_ + (T - 1)*kappa_*theta_ + l*theta_ + T*lambda_N_);
191 template<
class Track>
192 std::pair<std::vector<Track>, std::vector<size_t> >
sample
199 const typename Track::Element* null = 0;
208 std::vector<Track> tracks;
209 std::vector<size_t> false_alarms(T);
210 for(
size_t t = 1; t <= T; t++)
214 for(
size_t r = 1;
r <= e_t;
r++)
221 track.insert(std::make_pair(t, null));
222 track.insert(std::make_pair(
std::min(t + l_r, T), null));
225 tracks.push_back(track);
229 BOOST_FOREACH(Track& track, tracks)
234 if(track.get_start_time() == t || track.get_end_time() == t)
236 if(a_rt != 0) a_rt--;
239 for(
size_t i = 1;
i <= a_rt;
i++)
241 track.insert(std::make_pair(t, null));
247 false_alarms[t - 1] = n_t;
250 return std::make_pair(tracks, false_alarms);
262 template<
class Track>
264 std::pair<std::vector<Track>, std::vector<size_t> >
sample
271 return sample(prior, T, def_track);
Definition of various standard probability distributions.
boost::math::poisson Poisson_distribution
Definition: prob_distribution.h:69
r
Definition: APPgetLargeConnectedEdges.m:127
Computes the prior of an MCMCDA association.
Definition: mcmcda_prior.h:38
double kappa() const
Get average number of before start of video.
Definition: mcmcda_prior.h:79
A class that represents a MCMCDA association.
Definition: mcmcda_association.h:66
void set_kappa(double kappa)
Set average number of tracks per time.
Definition: mcmcda_prior.h:98
double lambda_N() const
Get false detection rate.
Definition: mcmcda_prior.h:85
Vector sample(const MV_gaussian_distribution &dist)
Sample from a multivariate normal distribution.
Definition: prob_sample.cpp:42
#define IFT(a, ex, msg)
Definition: l_exception.h:101
Prior(double kappa, double theta, double lambda_N, double lambda_A)
Constructs a MCMCDA prior functor.
Definition: mcmcda_prior.h:58
void set_lambda_A(double lambda_A)
Set detection rate.
Definition: mcmcda_prior.h:107
const Data< Element > & get_data() const
Returns data set const-ref.
Definition: mcmcda_association.h:126
std::pair< std::vector< Track >, std::vector< size_t > > sample(const Prior< Track > &prior, size_t T, const Track &def)
Sample an association from the prior.
Definition: mcmcda_prior.h:193
double operator()(const Association< Track > &w) const
Apply this functor to an association.
Definition: mcmcda_prior.h:118
double theta() const
Get average track length.
Definition: mcmcda_prior.h:82
Int_matrix::Value_type min(const Int_matrix &mat)
Return the minimum value in this matrix.
Definition: l_int_matrix.h:1385
void get_association_totals(const Association< Track > &w, size_t &m, size_t &e, size_t &d, size_t &a, size_t &n, size_t &l)
Get total tracks, entrances, exits, true detections, noisy detections, and track lengths of a given a...
Definition: mcmcda_association.h:605
Sampling functionality for the different distributions defined in "prob_distributions.h".
void set_lambda_N(double lambda_N)
Set false detection rate.
Definition: mcmcda_prior.h:104
Object thrown when an argument to a function is not acceptable.
Definition: l_exception.h:377
double lambda_O() const
Get occluded detection rate.
Definition: mcmcda_prior.h:91
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
for m
Definition: APPgetLargeConnectedEdges.m:64
void set_lambda_O(double lambda_O)
Set occluded detection rate.
Definition: mcmcda_prior.h:110
double lambda_A() const
Get detection rate.
Definition: mcmcda_prior.h:88
void set_theta(double theta)
Set average track length.
Definition: mcmcda_prior.h:101