distanceTypeToJson function

String distanceTypeToJson(
  1. Distance distance
)

Implementation

String distanceTypeToJson(Distance distance) {
  switch (distance) {
    case Distance.cosine:
      return cosineDistanceTypeEncodedValue;

    case Distance.hamming:
      return hammingDistanceTypeEncodedValue;

    case Distance.euclidean:
      return euclideanDistanceTypeEncodedValue;

    case Distance.manhattan:
      return manhattanDistanceTypeEncodedValue;

    default:
      throw UnsupportedError('Unsupported distance type $distance');
  }
}