Skip to content

Conversation

@apphp
Copy link

@apphp apphp commented Oct 13, 2025

No description provided.

@apphp apphp self-assigned this Oct 13, 2025
Copy link
Member

@andrewdalpino andrewdalpino left a 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;
Copy link
Member

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?

Copy link
Author

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.

* @param NDArray $target
* @throws InvalidArgumentException
*/
protected function validateShapes(NDArray $output, NDArray $target) : void
Copy link
Member

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.

Copy link
Author

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"

Copy link
Author

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

@apphp apphp merged commit 6a09905 into RubixML:3.0 Oct 28, 2025
0 of 3 checks passed
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.

3 participants