<commit_before>#ifndef GUARD_componentmodel_h
#define GUARD_componentmodel_h

#define _USE_CMATH_DEFINES
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include "utils.h"

class ComponentModel {
 public:
  //
  // getters
  std::map<std::string, double> get_hypers() const;
  int get_count() const;
  std::map<std::string, double> get_suffstats() const;
  //
  // calculators
  virtual double calc_marginal_logp() const = 0;
  virtual double calc_element_predictive_logp(double element) const = 0;
  virtual std::vector<double> calc_hyper_conditionals(std::string which_hyper,
						      std::vector<double> hyper_grid) const = 0;
  //
  // mutators
  virtual double insert_element(double element) = 0;
  virtual double remove_element(double element) = 0;
  virtual double incorporate_hyper_update() = 0;
  //
  // helpers
  friend std::ostream& operator<<(std::ostream& os, const ComponentModel &cm);
 protected:
  int count;
  std::map<std::string, double> *p_hypers;
  std::map<std::string, double> suffstats;
  double log_Z_0;
  double score;
  //
  // helpers
  virtual void set_log_Z_0() = 0;
  virtual void init_suffstats() = 0;
 private:
};<commit_msg>move p_hypers to public for testing<commit_after>#ifndef GUARD_componentmodel_h
#define GUARD_componentmodel_h

#define _USE_CMATH_DEFINES
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include "utils.h"

class ComponentModel {
 public:
  //
  // getters
  std::map<std::string, double> get_hypers() const;
  int get_count() const;
  std::map<std::string, double> get_suffstats() const;
  //
  // calculators
  virtual double calc_marginal_logp() const = 0;
  virtual double calc_element_predictive_logp(double element) const = 0;
  virtual std::vector<double> calc_hyper_conditionals(std::string which_hyper,
						      std::vector<double> hyper_grid) const = 0;
  //
  // mutators
  virtual double insert_element(double element) = 0;
  virtual double remove_element(double element) = 0;
  virtual double incorporate_hyper_update() = 0;
  //
  // helpers
  friend std::ostream& operator<<(std::ostream& os, const ComponentModel &cm);
  // make protected later
  std::map<std::string, double> *p_hypers;
 protected:
  int count;
  std::map<std::string, double> suffstats;
  double log_Z_0;
  double score;
  //
  // helpers
  virtual void set_log_Z_0() = 0;
  virtual void init_suffstats() = 0;
 private:
};
{'fraction_non_alphanumeric': 0.1231647634584013, 'fraction_numerical': 0.008156606851549755, 'mean_word_length': 4.652073732718894, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2866313', 'n_tokens_mistral': 862, 'n_tokens_neox': 822, 'n_words': 206}