oneHot function

List<int> oneHot(
  1. Object? value,
  2. List<Object?> categories
)

One-hot: value in categories -> list of 0/1 of length categories.

Implementation

List<int> oneHot(Object? value, List<Object?> categories) {
  return categories.map((Object? c) => c == value ? 1 : 0).toList();
}