loadFromModel method
Loads encoder configuration from an EncoderModel.
Implementation
void loadFromModel(EncoderModel model) {
if (model.type != 'onehot') {
throw ArgumentError('Incompatible model type: ${model.type}');
}
_categoryToIndex = model.labelToIndex;
_categories = List.filled(_categoryToIndex.length, '');
for (var entry in _categoryToIndex.entries) {
_categories[entry.value] = entry.key;
}
if (handleUnknown && unknownVector.isEmpty) {
unknownVector.addAll(List.filled(_categories.length, 0));
}
_isFitted = true;
}