class_docstr: RaCT is a collaborative filtering model which uses methods based on actor-critic reinforcement learning for training.
  
  We implement the RaCT model with only user dataloader.
class_docstr_tok: ["RaCT","is","a","collaborative","filtering","model","which","uses","methods","based","on","actor-critic","reinforcement","learning","for","training",".","We","implement","the","RaCT","model","with","only","user","dataloader","."]
code: def __init__(self, config, dataset):
      super(RaCT, self).__init__(config, dataset)
  
      self.layers = config["mlp_hidden_size"]
      self.lat_dim = config["latent_dimension"]
      self.drop_out = config["dropout_prob"]
      self.anneal_cap = config["anneal_cap"]
      self.total_anneal_steps = config["total_anneal_steps"]
  
      self.build_histroy_items(dataset)
  
      self.update = 0
  
      self.encode_layer_dims = (
          [self.n_items] + self.layers + [self.lat_dim]
      )
      self.decode_layer_dims = [
          int(self.lat_dim / 2)
      ] + self.encode_layer_dims[::-1][1:]
  
      self.encoder = self.mlp_layers(self.encode_layer_dims)
      self.decoder = self.mlp_layers(self.decode_layer_dims)
  
      self.critic_layers = config["critic_layers"]
      self.metrics_k = config["metrics_k"]
      self.number_of_seen_items = 0
      self.number_of_unseen_items = 0
      self.critic_layer_dims = [3] + self.critic_layers + [1]
  
      self.input_matrix = None
      self.predict_matrix = None
      self.true_matrix = None
      self.critic_net = self.construct_critic_layers(
          self.critic_layer_dims
      )
  
      self.train_stage = config["train_stage"]
      self.pre_model_path = config["pre_model_path"]
  
      # parameters initialization
      assert self.train_stage in [
          "actor_pretrain",
          "critic_pretrain",
          "finetune",
      ]
      if self.train_stage == "actor_pretrain":
          self.apply(xavier_normal_initialization)
          for p in self.critic_net.parameters():
              p.requires_grad = False
      elif self.train_stage == "critic_pretrain":
          # load pretrained model for finetune
          pretrained = torch.load(self.pre_model_path)
          self.logger.info(
              "Load pretrained model from", self.pre_model_path
          )
          self.load_state_dict(pretrained["state_dict"])
          for p in self.encoder.parameters():
              p.requires_grad = False
          for p in self.decoder.parameters():
              p.requires_grad = False
      else:
          # load pretrained model for finetune
          pretrained = torch.load(self.pre_model_path)
          self.logger.info(
              "Load pretrained model from", self.pre_model_path
          )
          self.load_state_dict(pretrained["state_dict"])
          for p in self.critic_net.parameters():
              p.requires_grad = False
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  import numpy
  from recbole.model.abstract_recommender import AutoEncoderMixin, GeneralRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.utils import InputType
label_desc: Use image node_id 1 to create a new RaCT object from inherited base classes: GeneralRecommender, AutoEncoderMixin with example: obj = RaCT(config, dataset)