Skip to content

Define the interface for Model.py #9

Description

@MarcCote

We should discuss the interface of Model, what method should be mandatory for subclasses.

Definitions (to be added in a wiki)

  • Model:

Some questions

  • Should we have a method Initialize in the model. If so, what should it took as input?

Suggestions

  • [ ]

Activity

  1. ASalvail commented on Jul 28, 2015

    @ASalvail
    Member

    Model interface :

    class Model(object):
        def get_model_output(self, inputs: theano.Varable) -> theano.Variable
    
        @abstractproperty
        def parameters(self) -> Iterable[theano.SharedVariable]
    
        @abstractmethod
        def save(self, path)
    
        @abstractclassmethod
        def load(self, path)
    
        @abstractmethod
        def initialize(self, rng)
          # A random number generator (instead of a seed) to generate the model with default initializers
    
        def use_regression(self, X: theano.Variable) -> theano.Variable
          return self._use_regression(self.generate_model_output(X))
    
        def use_classification(self, X: theano.Variable) -> theano.Variable
          return self._use_classification(self.generate_model_output(X))
    
        @abstractmethod
        def _use_regression(self, out: theano.Variable) -> theano.Variable
    
        @abstractmethod
        def _use_classification(self, out: theano.Variable) -> theano.Variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions