Example #1
0
def preprocess_tuples(tuples, preprocessor):
  try:
    tuples = np.column_stack([preprocessor(tuples[:, i])[:, np.newaxis] for
                              i in range(tuples.shape[1])])
  except Exception as e:
    raise PreprocessorError(e)
  return tuples
Example #2
0
def preprocess_points(points, preprocessor):
    """form points if there is a preprocessor else keep them as such (assumes
  that check_points has already been called)"""
    try:
        points = preprocessor(points)
    except Exception as e:
        raise PreprocessorError(e)
    return points