def fit_low_diligence_model_final(
  filteredRatings: pd.DataFrame,
  noteInitStateDiligence: pd.DataFrame,
  raterInitStateDiligence: pd.DataFrame,
  globalInterceptDiligence: c.ReputationGlobalIntercept,
  ratingsPerNoteLossRatio: Optional[float] = None,
  ratingsPerUserLossRatio: Optional[float] = None,
  device=torch.device("cpu"),
) -> Tuple[pd.DataFrame, pd.DataFrame]:
  """
  Args:
    filteredRatings: DataFrame containing ratings data
    noteInitStateDiligence: DataFrame containing initial state for notes (expects diligence prefixes e.g. lowDiligenceNoteIntercept)
    raterInitStateDiligence: DataFrame containing initial state for raters (expects diligence prefixes, not internal prefixes)
    globalInterceptDiligence: float
    device: torch.device to use for training
  """
  dataset, hParams = _setup_dataset_and_hparams(
    filteredRatings, device, ratingsPerNoteLossRatio, ratingsPerUserLossRatio
  )
  noteInitStateInternal, raterInitStateInternal = _prepare_diligence_init_state(
    noteInitStateDiligence, raterInitStateDiligence
  )

  model, loss_final = train_model_final(
    hParams=hParams,
    dataset=dataset,
    noteInitState=noteInitStateInternal,
    raterInitState=raterInitStateInternal,
    globalInterceptInit=globalInterceptDiligence,
    device=device,
  )
  logger.info(f"Low diligence final loss: {loss_final:.4f}")

  noteStats = pd.DataFrame(
    {
      c.noteIdKey: dataset.notes,
      c.lowDiligenceNoteInterceptKey: model.noteBias.weight.cpu().flatten().detach().numpy(),
      c.lowDiligenceNoteFactor1Key: model.noteEmbedding.weight.cpu().flatten().detach().numpy(),
    }
  )
  raterStats = pd.DataFrame(
    {
      c.raterParticipantIdKey: dataset.raters,
      c.lowDiligenceRaterInterceptKey: model.raterBias.weight.cpu().flatten().detach().numpy(),
      c.lowDiligenceRaterReputationKey: model.raterReputation.weight.cpu()
      .flatten()
      .detach()
      .numpy(),
      c.lowDiligenceRaterFactor1Key: model.raterEmbedding.weight.cpu().flatten().detach().numpy(),
    }
  )
  return noteStats, raterStats

  Args:
    filteredRatings: DataFrame containing ratings data
    noteInitStateDiligence: DataFrame containing initial state for notes (expects diligence prefixes e.g. lowDiligenceNoteIntercept)
    raterInitStateDiligence: DataFrame containing initial state for raters (expects diligence prefixes, not internal prefixes)
    globalInterceptDiligence: float
    device: torch.device to use for training
  
sourcecode/scoring/reputation_matrix_factorization/diligence_model.py