51#ifndef DOXYGEN_SHOULD_SKIP_THIS
65 Prior* new_prior = from.prior_->clone();
66 RecordCounter new_counter = from.counter_;
67 ScoringCache new_cache = from.cache_;
73 cache_ = std::move(new_cache);
83 std::swap(
prior_, from.prior_);
86 cache_ = std::move(from.cache_);
99 void Score::setRanges(
const std::vector< std::pair< std::size_t, std::size_t > >& new_ranges) {
100 std::vector< std::pair< std::size_t, std::size_t > > old_ranges =
ranges();
107 std::vector< std::pair< std::size_t, std::size_t > > old_ranges =
ranges();
118 const std::vector< double >& N_xyz)
const {
121 const auto& nodeId2cols = this->
counter_.nodeId2Columns();
123 const std::size_t X_size
124 =
database.domainSize(nodeId2cols.empty() ? X_id : nodeId2cols.second(X_id));
127 std::size_t out_size = N_xyz.size() / X_size;
130 std::vector< double > res(out_size, 0.0);
133 std::size_t xyz = std::size_t(0);
134 for (std::size_t z = std::size_t(0); z < out_size; ++z) {
135 for (std::size_t x = std::size_t(0); x < X_size; ++x, ++xyz) {
136 res[z] += N_xyz[xyz];
The base class for all the scores used for learning (BIC, BDeu, etc).
Prior * prior_
the expert knowledge a priorwe add to the score
void clearRanges()
reset the ranges to the one range corresponding to the whole database
const std::vector< std::pair< std::size_t, std::size_t > > & ranges() const
returns the current ranges
void clear()
clears all the data structures from memory, including the cache
const DatabaseTable & database() const
return the database used by the score
Score & operator=(const Score &from)
copy operator
RecordCounter counter_
the record counter used for the counts over discrete variables
void setRanges(const std::vector< std::pair< std::size_t, std::size_t > > &new_ranges)
sets new ranges to perform the counts used by the score
std::vector< double > marginalize_(const NodeId X_id, const std::vector< double > &N_xyz) const
returns a counting vector where variables are marginalized from N_xyz
bool use_cache_
a Boolean indicating whether we wish to use the cache
ScoringCache cache_
the scoring cache
Size NodeId
Type for node ids.
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities
the base class for all the scores used for learning (BIC, BDeu, etc)
the base class for all the scores used for learning (BIC, BDeu, etc)