class_docstr: A time series differencer.
  
  References
  ----------
  [^1]: [Stationarity and differencing](https://otexts.com/fpp2/stationarity.html)
  [^2]: [Backshift notation](https://otexts.com/fpp2/backshift.html)
class_docstr_tok: ["A","time","series","differencer",".","References","--","--","--","--","--","[","^1","]",":","[","Stationarity","and","differencing","]","(","https",":","\/\/otexts.com\/fpp2\/stationarity.html",")","[","^2","]",":","[","Backshift","notation","]","(","https",":","\/\/otexts.com\/fpp2\/backshift.html",")"]
code: def __init__(self, d, m=1):
      self.d = d
      self.m = m
  
      def n_choose_k(n, k):
          f = math.factorial
          return f(n) // f(k) // f(n - k)
  
      self.coeffs = {0: 1}
      for k in range(1, d + 1):
          t = k * m
          coeff = (-1 if k % 2 else 1) * n_choose_k(n=d, k=k)
          self.coeffs[t] = coeff
  
file_path: river/river/time_series/snarimax.py
imports: from __future__ import annotations
  import collections
  import itertools
  import math
  from river import base, linear_model, preprocessing, time_series
label_desc: Use image node_id 1 to create a new Differencer object  with example: obj = Differencer(d, m)