code: def _get_lm_predictor(xs_train, ys_train, deg):
      import statsmodels.api as sm
  
      X_train = xs_train.reshape(-1, 1)
      transform = _poly_transform(deg)
      model = sm.OLS(ys_train, transform(X_train)).fit()
  
      return lambda xs: model.predict(transform(xs.reshape(-1, 1)))
  
file_path: lets-plot/python-package/lets_plot/bistro/residual.py
imports: from ..plot.core import PlotSpec, aes
  from ..plot.geom import geom_hline
  from ..plot.label import ylab
  from ..plot.theme_ import *
  from ._plot2d_common import _get_bin_params_2d, _get_geom2d_layer, _get_marginal_layers
label_desc: Use image node_id 3 for calling a global function with example usage: _get_lm_predictor(xs_train, ys_train, deg) and returns: function