<commit_before>#ifndef MACAU_H
#define MACAU_H

#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <unsupported/Eigen/SparseExtra>
#include <memory>

#include "result.h"
#include "model.h"
#include "Data.h"

namespace smurff {

class ILatentPrior;

class BaseSession  {
   public:
      virtual ~BaseSession() {}

   public:
      //-- data members
      Model                                       model;
      Result                                      pred;
      Data &                                      data() { assert(data_ptr); return *data_ptr; }
      std::vector< std::unique_ptr<ILatentPrior>> priors;

      //-- add priors
      template<class Prior>
      inline Prior& addPrior();

      virtual void step();

      virtual std::ostream &info(std::ostream &, std::string indent);
      void save(std::string prefix, std::string suffix);
      void restore(std::string prefix, std::string suffix);

      std::string name;

   protected:
      bool is_init = false;
      std::unique_ptr<Data> data_ptr;
};

class Session : public BaseSession {
  public:
      Config      config;
      int         iter = -1;

      // c'tor
      Session() { name = "MacauSession"; }

      //-- set params
      void setFromConfig(const Config &);

      // execution of the sampler
      void init();
      void run();
      void step() override;

      std::ostream &info(std::ostream &, std::string indent) override;

   private:
      void save(int isample);
      void printStatus(double elapsedi);
};

class CmdSession :  public Session {
    public:
        void setFromArgs(int argc, char** argv);
};

class MPISession : public CmdSession {
  public:
    MPISession() { name = "MPISession"; }

    void run();
    std::ostream &info(std::ostream &os, std::string indent) override;<commit_msg>ENH: macau -> smurff<commit_after>#ifndef MACAU_H
#define MACAU_H

#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <unsupported/Eigen/SparseExtra>
#include <memory>

#include "result.h"
#include "model.h"
#include "Data.h"

namespace smurff {

class ILatentPrior;

class BaseSession  {
   public:
      virtual ~BaseSession() {}

   public:
      //-- data members
      Model                                       model;
      Result                                      pred;
      Data &                                      data() { assert(data_ptr); return *data_ptr; }
      std::vector< std::unique_ptr<ILatentPrior>> priors;

      //-- add priors
      template<class Prior>
      inline Prior& addPrior();

      virtual void step();

      virtual std::ostream &info(std::ostream &, std::string indent);
      void save(std::string prefix, std::string suffix);
      void restore(std::string prefix, std::string suffix);

      std::string name;

   protected:
      bool is_init = false;
      std::unique_ptr<Data> data_ptr;
};

class Session : public BaseSession {
  public:
      Config      config;
      int         iter = -1;

      // c'tor
      Session() { name = "Session"; }

      //-- set params
      void setFromConfig(const Config &);

      // execution of the sampler
      void init();
      void run();
      void step() override;

      std::ostream &info(std::ostream &, std::string indent) override;

   private:
      void save(int isample);
      void printStatus(double elapsedi);
};

class CmdSession :  public Session {
    public:
        void setFromArgs(int argc, char** argv);
};

class MPISession : public CmdSession {
  public:
    MPISession() { name = "MPISession"; }

    void run();
    std::ostream &info(std::ostream &os, std::string indent) override;
{'fraction_non_alphanumeric': 0.12071823204419889, 'fraction_numerical': 0.0005524861878453039, 'mean_word_length': 2.230151650312221, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1517850', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1049, 'n_words': 287}