Skip to content

The cost function code return opposite sign #76

@SendToSpace

Description

@SendToSpace

#Take the error when label=1
class1_cost = -labels*np.log(predictions)

#Take the error when label=0
class2_cost = (1-labels)*np.log(1-predictions)

#Take the sum of both costs
cost = class1_cost + class2_cost

In this code, it seem like class1 return positive cost and class2 return negative cost, wouldn't they cancel when added?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions