claf.model package

Submodules

class claf.model.base.ModelBase[source]

Bases: torch.nn.modules.module.Module

Model Base Class

Args:

token_embedder: (claf.tokens.token_embedder.base) TokenEmbedder

property config
property dataset
forward(inputs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

is_ready()[source]
property log_dir
make_metrics(predictions)[source]
make_predictions(features)[source]

for Metrics

property metrics
predict(features)[source]

Inference

print_examples(params)[source]

Print evaluation examples

property train_counter
property vocabs
write_predictions(predictions, file_path=None, is_dict=True)[source]
class claf.model.base.ModelWithTokenEmbedder(token_embedder)[source]

Bases: claf.model.base.ModelBase

class claf.model.base.ModelWithoutTokenEmbedder(token_makers)[source]

Bases: claf.model.base.ModelBase

claf.model.cls_utils.get_tag_dict(sequence, tag_texts)[source]
claf.model.cls_utils.write_confusion_matrix_to_csv(file_path, pycm_obj)[source]

Module contents