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 for Issue #3655: Update Linear Regression Sample in Python Bindings #224

Merged
merged 3 commits into from
Apr 29, 2024

Conversation

MarkFischinger
Copy link
Contributor

This PR addresses issue #3655 reported by tunglinwood. The issue came from changes in the Linear Regression, Ridge Regression and Bayesian Linear Regression python bindings, which you can see in the mlpack documentation. The sample code provided earlier does not function as expected under these new changes.

Modifications

  • Modified the correlation matrix calculation to focus only on numerical columns.
  • Updated the Linear Regression & Ridge Regression & Bayesian Linear Regression model setup using the new constructor.

Copy link

mlpack-bot bot commented Apr 7, 2024

Thanks for opening your first pull request in this repository! Someone will review it when they have a chance. In the mean time, please be sure that you've handled the following things, to make the review process quicker and easier:

  • All code should follow the style guide
  • Documentation added for any new functionality
  • Tests added for any new functionality
  • Tests that are added follow the testing guide
  • Headers and license information added to the top of any new code files
  • HISTORY.md updated if the changes are big or user-facing
  • All CI checks should be passing

Thank you again for your contributions! 👍

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link

github-actions bot commented Apr 7, 2024

Binder 👈 Launch a binder notebook on branch MarkFischinger/examples/fix/module_3655

@@ -991,7 +991,7 @@
"outputs": [
Copy link
Member

@rcurtin rcurtin Apr 8, 2024

Choose a reason for hiding this comment

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

Line #1.    model = mlpack.LinearRegression(check_input_matrices=False, copy_all_inputs=False, lambda_=0.0, verbose=False)

Aren't these all the default parameters? If so I would omit them just for the sake of cleanliness. Users can find more details on options in the documentation, there's no need to add them all here (it could seem overwhelming).


Reply via ReviewNB

@@ -991,7 +991,7 @@
"outputs": [
Copy link
Member

@rcurtin rcurtin Apr 8, 2024

Choose a reason for hiding this comment

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

Line #31.    print(f"Mean Absoulte Error: {np.mean(mae_score):.2f}")

I know this isn't what you intended to fix, but can you fix the typo on this line while you're at it? :)


Reply via ReviewNB

@@ -991,7 +991,7 @@
"outputs": [
Copy link
Member

@rcurtin rcurtin Apr 8, 2024

Choose a reason for hiding this comment

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

Line #1.    model = mlpack.LinearRegression(check_input_matrices=False, copy_all_inputs=False, lambda_=0.1, verbose=False)

Same comments on this cell about default parameters (and also the 'absoulte' typo :)).


Reply via ReviewNB

@rcurtin
Copy link
Member

rcurtin commented Apr 8, 2024

Thanks @MarkFischinger for looking into this! The fixes look good to me, just some minor comments. 👍

@MarkFischinger
Copy link
Contributor Author

Hi @rcurtin,
cleaned up the typos and simplified the initialization of the LinearRegression model. Also, I've updated the df.corr() part for better clarity :)
Initially, I thought it might be smart to include the default parameters, so the user knows what to expect from this class, but your point on the readability and simplicity outweighs.

Copy link
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

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

Thanks, the fixes are much appreciated!

Copy link

@mlpack-bot mlpack-bot bot left a comment

Choose a reason for hiding this comment

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

Second approval provided automatically after 24 hours. 👍

@rcurtin rcurtin merged commit 91a927f into mlpack:master Apr 29, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants