Skip to content

417 convert classifiers to numpower - #418

Merged
apphp merged 11 commits into
RubixML:3.0from
apphp:417-convert-classifiers-to-numpower
Aug 13, 2026
Merged

417 convert classifiers to numpower#418
apphp merged 11 commits into
RubixML:3.0from
apphp:417-convert-classifiers-to-numpower

Conversation

@apphp

@apphp apphp commented Jul 25, 2026

Copy link
Copy Markdown

No description provided.

@apphp apphp self-assigned this Jul 25, 2026
@apphp
apphp requested a review from andrewdalpino July 25, 2026 13:47

@andrewdalpino andrewdalpino left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @samuel-akopyan nice work as usual. I a have a couple questions and things that stood out to me.

}

return NumPower::array($result);
$max = NumPower::reshape(NumPower::array($maxima), [1, $columns]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we forget to implement this during the Activation Functions sprint? Was it intentional to leave out due to the NumPower max() API limitation?

@apphp apphp Aug 12, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was Intentional. Softmax was rewritten to NumPower with stable max-subtraction, because NumPower::max() has no axis (stubs: scalar-only). Once NumPower adds max(..., axis:), we can drop the PHP loop.

$expected = [];

foreach ($labels as $label) {
$dist = [];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the purpose of this change?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dense outputs [classes, batch], but the old one-hot was [batch, classes]. That shape mismatch broke SoftmaxClassifier training. This change should build the targets in the same layout as the network output.

@apphp
apphp requested a review from andrewdalpino August 12, 2026 20:41

@andrewdalpino andrewdalpino left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @apphp!

@apphp
apphp merged commit 76b400a into RubixML:3.0 Aug 13, 2026
1 check failed
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