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

is the mse layer really divide by the number of size ? #2246

Closed
pengwangucla opened this issue May 24, 2017 · 0 comments · Fixed by #3845
Closed

is the mse layer really divide by the number of size ? #2246

pengwangucla opened this issue May 24, 2017 · 0 comments · Fixed by #3845

Comments

@pengwangucla
Copy link
Collaborator

In the mse_cost in Layers.py. We see the description is $\frac{1}{N}\sum_{i=1}^N(t _i- y_i)^2$, I think N is the size of each item

However, when I check the implementation it calls sumofsquarediff, which does not do a normalization of layer size N. I think it is a wrong description of the mse_cost layer ?

@wrap_name_default()
@layer_support()
def mse_cost(input, label, weight=None, name=None, layer_attr=None):
    """
    mean squared error cost:

    ..  math::
       $\frac{1}{N}\sum_{i=1}^N(t _i- y_i)^2$

    :param name: layer name.
    :type name: basestring
    :param input: Network prediction.
    :type input: LayerOutput
    :param label: Data label.
    :type label: LayerOutput
    :param weight: The weight affects the cost, namely the scale of cost.
                   It is an optional argument.
    :type weight: LayerOutput
    :param layer_attr: layer's extra attribute.
    :type layer_attr: ExtraLayerAttribute
    :return: LayerOutput object.
    :rtype: LayerOutput
    """
    ipts, parents = __cost_input__(input, label, weight)

    Layer(
        inputs=ipts,
        type="square_error",
        name=name,
        **ExtraLayerAttribute.to_kwargs(layer_attr))
    return LayerOutput(name, LayerType.COST, parents=parents, size=1)
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 a pull request may close this issue.

1 participant