stickeritis / sticker

Succeeded by SyntaxDot: https://github.com/tensordot/syntaxdot
Other
25 stars 2 forks source link

Change SentenceEncoder::encode to take &self immutably #158

Closed danieldk closed 4 years ago

danieldk commented 4 years ago

This requires changes accross the board, since CategoricalEncoder used a numberer immutably. This change adds a type parameter to the CategoricalEncoder trait that should implement the Mutability trait. There are two crate-private data structures that implement this trait:

Two corresponding type aliases are introduced: ImmutableCategoricalEncoder and MutableCategoricalEncoder. The ImmutableCategoricalEncoder returns the special value 0 when an encoding is unknown.

Throughout sticker we now only use ImmutableCategoricalEncoder, so it should always return a known number, thereby also fixing #28.

Fixes #155


Currently a draft PR, since this still needs testing.

danieldk commented 4 years ago

Doing a test run now, at least there are validation losses :).

danieldk commented 4 years ago

Doing a test run now, at least there are validation losses :).

Works as it did before, so I converted this into a proper non-review PR. I will also test it with an existing model, just to be 100% certain that nothing breaks.