docs: def get_dataset():
      """Create a dataset for machine learning of segmentations.
  
      Returns
      -------
      tuple :
          (X, y) where X is a list of tuples. Each tuple is a feature. y
          is a list of labels (0 for 'not in one symbol' and 1 for 'in symbol')
      """
      seg_data = "segmentation-X.npy"
      seg_labels = "segmentation-y.npy"
      # seg_ids = "segmentation-ids.npy"
      if os.path.isfile(seg_data) and os.path.isfile(seg_labels):
          X = numpy.load(seg_data)
          y = numpy.load(seg_labels)
  
          with open('datasets.pickle', 'rb') as f:
              datasets = pickle.load(f)
          return (X, y, datasets)
      datasets = get_segmented_raw_data()
      X, y = [], []
      for i, data in enumerate(datasets):
          if i % 10 == 0:
              logging.info("[Create Dataset] i=%i/%i", i, len(datasets))
          segmentation = json.loads(data['segmentation'])
          recording = json.loads(data['data'])
          X_symbol = [get_median_stroke_distance(recording)]
          if len([p for s in recording for p in s if p['time'] is None]) > 0:
              continue
          combis = itertools.combinations(list(range(len(recording))), 2)
          for strokeid1, strokeid2 in combis:
              stroke1 = recording[strokeid1]
              stroke2 = recording[strokeid2]
              if len(stroke1) == 0 or len(stroke2) == 0:
                  logging.debug("stroke len 0. Skip.")
                  continue
              X.append(get_stroke_features(recording, strokeid1, strokeid2) +
                       X_symbol)
              same_symbol = (_get_symbol_index(strokeid1, segmentation) ==
                             _get_symbol_index(strokeid2, segmentation))
              y.append(int(same_symbol))
      X = numpy.array(X, dtype=numpy.float32)
      y = numpy.array(y, dtype=numpy.int32)
      numpy.save(seg_data, X)
      numpy.save(seg_labels, y)
      datasets = filter_recordings(datasets)
      with open('datasets.pickle', 'wb') as f:
          pickle.dump(datasets, f, protocol=pickle.HIGHEST_PROTOCOL)
      return (X, y, datasets)