Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define the interface for Model.py #9

Open
2 tasks
MarcCote opened this issue May 22, 2015 · 1 comment
Open
2 tasks

Define the interface for Model.py #9

MarcCote opened this issue May 22, 2015 · 1 comment

Comments

@MarcCote
Copy link
Member

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

  • [ ]
@ASalvail
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants