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

Fix/linear shapes #288

Merged
merged 33 commits into from
Jul 30, 2024
Merged

Conversation

JoaquinIglesiasTurina
Copy link
Contributor

Implemented the changes proposed here
Please note the changes to test/scholar/linear/bayesian_ridge_regression_test.exs to fully understand the scope of the changes.

On the above comment, I defended models being equal when fitting single column vectors and one dimensional vectors.
However, I've just thought a drawback to this approach.
If the output of .predict is the same on both input cases, this means that prediction and target shapes may be different. This can cause some inconveniences.
I still think this is the better approach, but I want to make clear that the change is significant.

@josevalim josevalim requested a review from msluszniak July 11, 2024 16:27
Copy link
Contributor

@msluszniak msluszniak left a comment

Choose a reason for hiding this comment

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

I think it looks great :). Additionally, I would indicate somewhere information that the different input and target shapes may be different in specific case.

@JoaquinIglesiasTurina
Copy link
Contributor Author

I think it looks great :). Additionally, I would indicate somewhere information that the different input and target shapes may be different in specific case.

Great, I'll update the docs

@@ -428,6 +428,8 @@ defmodule Scholar.Linear.BayesianRidgeRegression do

@doc """
Makes predictions with the given `model` on input `x`.
Output predictions have shape {n_samples} when train target is shaped either {n_samples} or {n_samples, 1}.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should start a new paragraph, because the first paragraph should always be a short summary. And use backticks around code, can you please apply similar changes below? :)

Suggested change
Output predictions have shape {n_samples} when train target is shaped either {n_samples} or {n_samples, 1}.
Output predictions have shape `{n_samples}` when train target
is shaped either `{n_samples}` or `{n_samples, 1}`.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing. Thank you for your comments.

@msluszniak msluszniak merged commit e8a45a3 into elixir-nx:main Jul 30, 2024
2 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