{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Model","type":"basic","slug":"basics-model","excerpt":"","body":"The third component necessary for building a deep learning model. Models perform some computation given their input variables. Models have three necessary functions to operate at the basic level:\n\n* get_inputs(): returns the input or list of inputs to the model (theano variables or expressions).\n* get_outputs(): returns the output or list of outputs of the model computation (theano expression).\n* get_params(): returns the dictionary of {string_name: theano variable} representing the model's internal parameters.\n\nPlease see the [full documentation](http://opendeep.readthedocs.org/en/latest/opendeep.models.html#module-opendeep.models.model) for all the other methods possible in a Model class.\n\n## Connecting models together\nGenerally, you can connect Models in three ways:\n\n* inputs: use the inputs= parameter to set the input for the model's computation. Inputs must be a tuple (or list of tuples) that include the shape monad and the input expression. See [Variables](doc:basics-variables) to learn about the shape monad.\n* hiddens: use the hiddens= parameter to replace the hidden representation for the model (if applicable). This is most often used for generative models where the outputs come from a hidden representation.\n* params: use the params= parameter to replace some or all of the internal model parameters. The parameters will be replaced based on the string key from the input dictionary.\n\n## Containers\nWe have a basic [Prototype](http://opendeep.readthedocs.org/en/latest/opendeep.models.container.html#module-opendeep.models.container.prototype) container to let you easily hook up models sequentially (similar to Torch's Sequential construct). With a Prototype, you can `.add(model_class_type, **kwargs)` to instantiate a Model with the given class and automatically set its inputs to the previous model's outputs. All of the models are kept in the internal `models` attribute as a list. Please refer to the documentation linked above to learn more about the Prototype container.","updates":[],"order":2,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5654da6cdd82540d00278ae4","createdAt":"2015-11-24T21:45:16.546Z","user":"5503e897e508a017002013bd","githubsync":"","project":"5503ea178c5e913700362c70","version":{"version":"0.0.9","version_clean":"0.0.9","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["563fc7641594380d009c1a5d","563fc7641594380d009c1a5e","563fc7641594380d009c1a5f","5654ff257b89070d00f96386"],"_id":"563fc7631594380d009c1a5c","project":"5503ea178c5e913700362c70","__v":2,"createdAt":"2015-11-08T22:06:27.279Z","releaseDate":"2015-11-08T22:06:27.278Z"},"__v":6,"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Core Concepts","slug":"core-concepts","order":1,"from_sync":false,"reference":false,"_id":"5654ff257b89070d00f96386","version":"563fc7631594380d009c1a5c","__v":0,"project":"5503ea178c5e913700362c70","createdAt":"2015-11-25T00:21:57.507Z"}}
The third component necessary for building a deep learning model. Models perform some computation given their input variables. Models have three necessary functions to operate at the basic level: * get_inputs(): returns the input or list of inputs to the model (theano variables or expressions). * get_outputs(): returns the output or list of outputs of the model computation (theano expression). * get_params(): returns the dictionary of {string_name: theano variable} representing the model's internal parameters. Please see the [full documentation](http://opendeep.readthedocs.org/en/latest/opendeep.models.html#module-opendeep.models.model) for all the other methods possible in a Model class. ## Connecting models together Generally, you can connect Models in three ways: * inputs: use the inputs= parameter to set the input for the model's computation. Inputs must be a tuple (or list of tuples) that include the shape monad and the input expression. See [Variables](doc:basics-variables) to learn about the shape monad. * hiddens: use the hiddens= parameter to replace the hidden representation for the model (if applicable). This is most often used for generative models where the outputs come from a hidden representation. * params: use the params= parameter to replace some or all of the internal model parameters. The parameters will be replaced based on the string key from the input dictionary. ## Containers We have a basic [Prototype](http://opendeep.readthedocs.org/en/latest/opendeep.models.container.html#module-opendeep.models.container.prototype) container to let you easily hook up models sequentially (similar to Torch's Sequential construct). With a Prototype, you can `.add(model_class_type, **kwargs)` to instantiate a Model with the given class and automatically set its inputs to the previous model's outputs. All of the models are kept in the internal `models` attribute as a list. Please refer to the documentation linked above to learn more about the Prototype container.