class_docstr: Implementations for DRL algorithms
  
  Attributes
  ----------
      env: gym environment class
          user-defined class
      price_array: numpy array
          OHLC data
      tech_array: numpy array
          techical data
      turbulence_array: numpy array
          turbulence/risk data
  Methods
  -------
      get_model()
          setup DRL algorithms
      train_model()
          train DRL algorithms in a train dataset
          and output the trained model
      DRL_prediction()
          make a prediction in a test dataset and get results
class_docstr_tok: ["Implementations","for","DRL","algorithms","Attributes","--","--","--","--","--","env",":","gym","environment","class","user-defined","class","price_array",":","numpy","array","OHLC","data","tech_array",":","numpy","array","techical","data","turbulence_array",":","numpy","array","turbulence\/risk","data","Methods","--","--","--","-","get_model","(",")","setup","DRL","algorithms","train_model","(",")","train","DRL","algorithms","in","a","train","dataset","and","output","the","trained","model","DRL_prediction","(",")","make","a","prediction","in","a","test","dataset","and","get","results"]
code: def train_model(
      self,
      model,
      model_name,
      model_config,
      total_episodes=100,
      init_ray=True,
  ):
      if model_name not in MODELS:
          raise NotImplementedError("NotImplementedError")
      if init_ray:
          ray.init(
              ignore_reinit_error=True
          )  # Other Ray APIs will not work until `ray.init()` is called.
  
      if model_name == "ppo":
          trainer = model.PPOTrainer(env=self.env, config=model_config)
      elif model_name == "a2c":
          trainer = model.A2CTrainer(env=self.env, config=model_config)
      elif model_name == "ddpg":
          trainer = model.DDPGTrainer(env=self.env, config=model_config)
      elif model_name == "td3":
          trainer = model.TD3Trainer(env=self.env, config=model_config)
      elif model_name == "sac":
          trainer = model.SACTrainer(env=self.env, config=model_config)
  
      for _ in range(total_episodes):
          trainer.train()
  
      ray.shutdown()
  
      # save the trained model
      cwd = "./test_" + str(model_name)
      trainer.save(cwd)
  
      return trainer
  
file_path: FinRL/finrl/agents/rllib/models.py
imports: from __future__ import annotations
  import ray
  from ray.rllib.algorithms.a2c import a2c
  from ray.rllib.algorithms.ddpg import ddpg
  from ray.rllib.algorithms.ppo import ppo
  from ray.rllib.algorithms.sac import sac
  from ray.rllib.algorithms.td3 import td3
label_desc: Use image node_id 3 for calling the DRLAgent obj's underlying member method code with example usage: obj.train_model(model, model_name, model_config, total_episodes, init_ray) and returns: trainer