class_docstr: Applies "naive pooled" conformalization to the model, where critical nonconformity scores
  are computed on the quantiles of absolute forecast residuals, which are "pooled" across the
  prediction horizon. The forecasts are then generated by adding corresponding offsets with
  critical nonconformity scores to the original mean forecast.
  
  This implementation uses the ``ceil((1 - alpha) * (n + 1)) / n`` quantile of nonconformity scores
  as the critical value. By definition, it follows that for small alpha and small n, this may result
  in "infinite" forecast intervals. In this case, the absolute residual quantiles are clipped to the
  sample maximum. This is why this method can be expected to undercover when the calibration window
  is short and the required alpha is small (forecasts for very low or high quantiles are required).
class_docstr_tok: ["Applies","``","naive","pooled","''","conformalization","to","the","model",",","where","critical","nonconformity","scores","are","computed","on","the","quantiles","of","absolute","forecast","residuals",",","which","are","``","pooled","''","across","the","prediction","horizon",".","The","forecasts","are","then","generated","by","adding","corresponding","offsets","with","critical","nonconformity","scores","to","the","original","mean","forecast",".","This","implementation","uses","the","``","ceil","(","(","1","-","alpha",")","*","(","n","+","1",")",")","\/","n","``","quantile","of","nonconformity","scores","as","the","critical","value",".","By","definition",",","it","follows","that","for","small","alpha","and","small","n",",","this","may","result","in","``","infinite","''","forecast","intervals",".","In","this","case",",","the","absolute","residual","quantiles","are","clipped","to","the","sample","maximum",".","This","is","why","this","method","can","be","expected","to","undercover","when","the","calibration","window","is","short","and","the","required","alpha","is","small","(","forecasts","for","very","low","or","high","quantiles","are","required",")","."]
code: def _get_nonconformity_scores(
      self,
      time_series: pd.Series,
      local_model_args: Dict,
  ) -> np.ndarray:
      h = self.prediction_length
      y = time_series.values.ravel()
  
      if len(y) <= h:
          # if there is only prediction_length many time steps in sample, we fall back to
          # the naive-1 forecaster to compute residuals for as many time steps as possible
          nonconf_scores = np.abs(y - y[0])
          if len(y) > 1:
              # discard the first residual (0 by definition)
              nonconf_scores = np.full((h,), y[-1])
              nonconf_scores[: (len(y) - 1)] = y[1:]
          return nonconf_scores.reshape(1, -1)
  
      test_length = min(
          len(y) - 1, h * self.max_num_conformalization_windows
      )
      cutoffs = list(range(-h, -test_length - 1, -h))
  
      nonconf_scores = np.full((len(cutoffs), h), np.nan)
      for i, cutoff in enumerate(cutoffs, start=0):
          forecast = self._get_point_forecast(
              pd.Series(y[:cutoff]), local_model_args
          )
          forecast_horizon = (
              y[cutoff:] if cutoff + h == 0 else y[cutoff : cutoff + h]
          )
          nonconf_scores[i] = np.abs(forecast - forecast_horizon)
  
      return nonconf_scores
  
imports: import logging
  from typing import Any, Dict, Type
  import numpy
  import pandas
  from .abstract_local_model import AbstractLocalModel
label_desc: Use image node_id 1 for calling the AbstractConformalizedStatsForecastModel obj's underlying member method code with example usage: obj._get_nonconformity_scores(time_series, local_model_args) and returns: nonconf_scores, nonconf_scores