code: def get_y(data):
      """Return dependent variable y"""
      y = data.Close.pct_change(48).shift(
          -48
      )  # Returns after roughly two days
      y[
          y.between(-0.004, 0.004)
      ] = 0  # Devalue returns smaller than 0.4%
      y[y > 0] = 1
      y[y < 0] = -1
      return y
  
file_path: backtesting.py/doc/examples/Trading with Machine Learning.py
imports: from backtesting.test import EURUSD, SMA
  import numpy
  import pandas
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.model_selection import train_test_split
  from backtesting import Backtest, Strategy
label_desc: Use image node_id 3 for calling a global function with example usage: get_y(data) and returns: y