Skip to content

ITransformer should derive from ICanSaveModel and we should explicitly implement ICanSaveModel #2336

Closed
@artidoro

Description

@artidoro

In our code base we make the implicit assumption that all classes implementing ITransformer also implement ICanSaveModel. ITransformer is the abstraction that transforms the data and both single and chained components in a pipeline are made into an ITransformer once they are trained. Since this is the abstraction that contains trained models and data transformations, it should also be savable to a file. The standard scenario is that after training, one saves trained models, or ITransformer, for later use for scoring/transforming new data.

The above highlights that this is an important assumption and that we should capture it in code by making ITransformer derive from ICanSaveModel. Especially going forward as we think about allowing custom components, we should make it explicit that new transformers also implement ICanSaveModel.

Furthermore, we should explicitly implement in the transformers the Save method of the ICanSaveModel interface. This would make it less visible to the users. The reasons for doing so are twofold:

  1. ModelSaveContext only has internal constructors, so a user cannot instantiate it.
  2. We only use the Save method internally, and we don't want the user to call it directly.

/cc @TomFinley @sfilipi

Metadata

Metadata

Assignees

Labels

APIIssues pertaining the friendly API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions