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

Replace 'loss' parameter by 'objective' which has a more interesting interface. #50

Merged
merged 2 commits into from
Mar 27, 2015

Conversation

dnouri
Copy link
Owner

@dnouri dnouri commented Feb 25, 2015

Adds a more interesting interface for specifying losses. The loss parameter is now deprecated, and one should use objective instead. Here's an example of an 'Objective' implementation from nolearn.lasagne itself.

class LossObjective(object):
    def __init__(self, loss_function):
        self.loss_function = loss_function

    def __call__(self, layers, X, y, deterministic=False):
        output_layer = layers['output']
        return self.loss_function(
            output_layer.get_output(X, deterministic=deterministic), y)

@cancan101 Let me know if this makes sense to you, and if it would fix #14.

@cancan101
Copy link
Contributor

Looks good to me.

@pengpaiSH
Copy link

@dnouri , @cancan101, I am still confused why we could introduce e.g. L2 regularization by such LossObject class.

@cancan101
Copy link
Contributor

The current signature for loss is not rich enough to calculate the penalty on the weights.

…s.Objective.

Also, do a little refactoring around self.layers_ and instantiate layers with
their names.
dnouri added a commit that referenced this pull request Mar 27, 2015
Replace 'loss' parameter by 'objective' which has a more interesting interface.
@dnouri dnouri merged commit f36760c into master Mar 27, 2015
@dnouri dnouri deleted the more-flexible-loss branch March 27, 2015 15:27
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

Successfully merging this pull request may close these issues.

Weight Decay
3 participants