Closed mzargham closed 9 years ago
Yes, at the moment you need to do this by creating a new subclass for your model. For example, to create a regression model that uses mean absolute error:
class MaeRegressor(theanets.Regressor):
@property
def cost(self):
err = self.outputs[-1] - self.targets
return TT.mean(abs(err).sum(axis=1))
I've been thinking of making several mixin classes to simplify this sort of task, but mixins can be annoying at times. I haven't really hit upon the "right" way to do this, so for now creating subclasses is it.
Also, I'm still working on the docs for extending theanets; I'll go ahead and put this in as an example.
Thanks!
On Jan 9, 2015, at 11:58 AM, Leif Johnson notifications@github.com wrote:
Yes, at the moment you need to do this by creating a new subclass for your model. For example, to create a regression model that uses mean absolute error:
class MaeRegressor(theanets.Regressor): @property def cost(self): err = self.outputs[-1] - self.targets return TT.mean(abs(err).sum(axis=1)) I've been thinking of making several mixin classes to simplify this sort of task, but mixins can be annoying at times. I haven't really hit upon the "right" way to do this, so for now creating subclasses is it.
Also, I'm still working on the docs for extending theanets; I'll go ahead and put this in as an example.
— Reply to this email directly or view it on GitHub.
I had been writing neural nets code without Theano and recently converted to specifying the experiments using theanets because i want to use Theano to experiment with different cost functions at the output.
I am running a regression model with 96 output variables where Euclidean Distance (~Mean Square Error) is not a very good measure of estimatation accuracy. Since you are built on top of Theano it seems like this cost function should be parameterizeable, but I don't see anything about this in the documentation.
Can you tell me where I can specify the cost function as a Theano function?