code: def test_linucb_model_update_equations(self):
      # make sure that the model parameters match hand-computed values
      scorer = LinearRegressionUCB(self.x_dim)
      policy = Policy(scorer=scorer, sampler=GreedyActionSampler())
      trainer = LinUCBTrainer(policy)
      trainer.training_step(self.batch, 0)
      trainer.on_train_epoch_end()
      # the feature matrix (computed by hand)
      x = add_chosen_arm_features(
          self.batch
      ).features_of_chosen_arm.numpy()
  
      npt.assert_allclose(
          scorer.avg_A.numpy(), x.T @ x / len(self.batch), rtol=1e-4
      )
      npt.assert_allclose(
          scorer.avg_b.numpy(),
          x.T @ self.batch.reward.squeeze().numpy() / len(self.batch),
          rtol=1e-4,
      )
  
      scorer._calculate_coefs()
      npt.assert_equal(
          scorer.avg_A.numpy(), scorer.coefs_valid_for_avg_A.numpy()
      )
  
      npt.assert_allclose(
          (
              np.eye(self.x_dim) * scorer.l2_reg_lambda
              + (scorer.avg_A * scorer.sum_weight).numpy()
          )
          @ (scorer.inv_avg_A / scorer.sum_weight).numpy(),
          np.eye(self.x_dim),
          atol=1e-3,
      )
  
imports: import copy
  import unittest
  import numpy
  import numpy.testing
  import torch
  from libfb.py.collections import AttrDict
  from pytorch_lightning.loggers import TensorBoardLogger
  from reagent.core.types import CBInput
  from reagent.gym.policies.policy import Policy
  from reagent.gym.policies.samplers.discrete_sampler import GreedyActionSampler
  from reagent.models.linear_regression import LinearRegressionUCB
  from reagent.training.cb.linucb_trainer import LinUCBTrainer
  from reagent.training.cb.utils import add_chosen_arm_features
  from reagent.training.parameters import LinUCBTrainerParameters
  from torchrec.fb.metrics.meta_config import DefaultTaskInfo, MetricsConfig, QPSDef, RecMetricDef, RecMetricEnum
  from torchrec.fb.metrics.meta_metrics import generate_metric_module, RecMetricModule
label_desc: Use image node_id 5 for calling the TestLinUCB obj's underlying member method code with example usage: obj.test_linucb_model_update_equations() without return types