code: def test_sax():
      unfitted_sax = SymbolicAggregateApproximation(
          n_segments=3, alphabet_size_avg=2
      )
      data = [
          [-1.0, 2.0, 0.1, -1.0, 1.0, -1.0],
          [1.0, 3.2, -1.0, -3.0, 1.0, -1.0],
      ]
      np.testing.assert_raises(
          NotFittedError, unfitted_sax.distance, data[0], data[1]
      )
  
      sax_est_no_scale = unfitted_sax
      sax_est_scale = clone(sax_est_no_scale)
      sax_est_scale.set_params(scale=True)
      n, sz, d = 2, 10, 3
      rng = np.random.RandomState(0)
      X = rng.randn(n, sz, d)
      for sax_est in [sax_est_no_scale, sax_est_scale]:
          sax_repr = sax_est.fit_transform(X)
          np.testing.assert_allclose(
              sax_est.distance(X[0], X[1]),
              sax_est.distance_sax(sax_repr[0], sax_repr[1]),
          )
  
file_path: tslearn/tslearn/tests/test_piecewise.py
imports: import numpy
  from tslearn.piecewise import OneD_SymbolicAggregateApproximation, SymbolicAggregateApproximation, PiecewiseAggregateApproximation
  from tslearn.neighbors import KNeighborsTimeSeriesClassifier
  from sklearn.exceptions import NotFittedError
  from sklearn.base import clone
label_desc: Use image node_id 2 for calling a global function with example usage: test_sax() without return types