<commit_before>#include "ExperimentEnvironment.h"
#include "OnlineExperiment.h"


void ExperimentEnvironment::set_parameters(OnlineExperimentParameters* params){
  top_k_ = params->top_k;
  evaluation_start_time_ = params->evaluation_start_time;
  experiment_termination_time_ = params->experiment_termination_time;
  exclude_known_ = params->exclude_known;
  initialize_all_ = params->initialize_all;
  max_user_ = params->max_user;
  max_item_ = params->max_item;
}
void ExperimentEnvironment::update(RecDat* rec_dat){
  int item = rec_dat->item;
  int user = rec_dat->user;
  double score = rec_dat->score; 

  if (!GET_VECTORMAP(item_map_,item,false)){
    new_item_=true;
    PUT_VECTORMAP(item_map_,item,true);
    items_.push_back(item);
  } else {
    new_item_=false;
  }
  if (!GET_VECTORMAP(user_map_,user,false)){
    new_user_=true;<commit_msg>ExpEnv: fill at the beginning users_ and items_ if initall<commit_after>#include "ExperimentEnvironment.h"
#include "OnlineExperiment.h"


void ExperimentEnvironment::set_parameters(OnlineExperimentParameters* params){
  top_k_ = params->top_k;
  evaluation_start_time_ = params->evaluation_start_time;
  experiment_termination_time_ = params->experiment_termination_time;
  exclude_known_ = params->exclude_known;
  initialize_all_ = params->initialize_all;
  max_user_ = params->max_user;
  max_item_ = params->max_item;
  if (initialize_all_ && max_user_>0){
    for(int i=0;i<=max_user_;i++) users_.push_back(i);
  }
  if (initialize_all_ && max_item_>0){
    for(int i=0;i<=max_item_;i++) items_.push_back(i);
  }
}
void ExperimentEnvironment::update(RecDat* rec_dat){
  int item = rec_dat->item;
  int user = rec_dat->user;
  double score = rec_dat->score; 

  if (!GET_VECTORMAP(item_map_,item,false)){
    new_item_=true;
    PUT_VECTORMAP(item_map_,item,true);
    if (!initialize_all_) items_.push_back(item);
  } else {
    new_item_=false;
  }
  if (!GET_VECTORMAP(user_map_,user,false)){
    first_occurrence_of_user_=true;
{'fraction_non_alphanumeric': 0.12042147516307075, 'fraction_numerical': 0.002007024586051179, 'mean_word_length': 5.923611111111111, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6268553', 'n_tokens_mistral': 719, 'n_tokens_neox': 702, 'n_words': 108}