Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Fed-BioMed Fed-BioMed
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 130
    • Issues 130
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Fed-BioMedFed-BioMed
  • Fed-BioMedFed-BioMed
  • Merge requests
  • !192

Polish 'Model' API and backend code.

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged ANDREY Paul requested to merge feature/472-bis-polish-model into develop Mar 07, 2023
  • Overview 47
  • Commits 11
  • Pipelines 7
  • Changes 6

This MR is an extension to MR !188 (merged), that addressed issue #472 (closed) about implementing a new 'Model' abstraction layer and refactoring framework-specific code from the current 'TrainingPlan' classes into it and its framework- or model-specific subclasses.

This MR implements the following changes:

  • Disambiguate class attributes from instance attributes in 'Model' and its subclasses.
    • Declare instance attributes as part of __init__ methods and class attributes at the proper scope.
    • Use the ClassVar type-hint to further highlight that some attributes are defined at class level.
  • Add Model._model_type private class attribute and use it for init-type type-checking.
    • This class attribute enables specifying what classes of models may be wrapped.
    • It was used to refactor type-checking code into the shared parent Model.__init__.
  • Revise 'Model.get_weights' and 'Model.get_gradients' signatures.
    • Replace the generic return_type attribute with as_vector: bool = False.
    • This was done in accordance with @scansiz, with issue #481 (closed) in mind.
  • Revise BaseSkLearnModel.train backend and remove superfluous private attributes.
  • Revise TorchModel.init_params.
    • Previously, the signature and actual type of this attribute did not match.
  • Perform an overall cleaning of import statements' ordering, type hints and code formatting.
  • Rename scikit-learn backend Models dict to SKLEARN_MODELS out of PEP-8 compliance.
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: feature/472-bis-polish-model