-
-
Notifications
You must be signed in to change notification settings - Fork 194
Ml 385 convert cost functions to num power #387
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
Ml 385 convert cost functions to num power #387
Conversation
andrewdalpino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @apphp! I left a couple comments one on function naming and the other just to clarify our temporary namespacing. Other than that, I think it's good to go. I really liked the additional context you provided by the comments ... I'm generally against comments unless they bring outsized value and you hit it just right with the addition of the mathematical formulas.
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Rubix\ML\NeuralNet\CostFunctions\CrossEntropy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you are carving out this namespace to hold the new classes temporarily until we can get the whole Neural Net subsystem converted to NumPower?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly - like it was done by @SkibidiProduction for activation functions.
src/Traits/ValidatesShapes.php
Outdated
| * @param NDArray $target | ||
| * @throws InvalidArgumentException | ||
| */ | ||
| protected function validateShapes(NDArray $output, NDArray $target) : void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me, this function name does not describe what the function really does. I would recommend something like "validateShapesAreEqual()" or better yet, this should be a method on the NDArray object. Something to consider implementing in NumPower @SkibidiProduction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, agree. Renamed into "assertSameShape"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we add this method to NDArray object, then we can remove this trait
No description provided.