-
-
Notifications
You must be signed in to change notification settings - Fork 46.7k
Local Weighted Learning #5615
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
Local Weighted Learning #5615
Conversation
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
machine_learning/local_weighted_learning/local_weighted_learning.py
Outdated
Show resolved
Hide resolved
@poyea @dhruvmanila How do you folks feel about our requirements? We currently have a list of 20 and it takes time and space to install all these requirements when we test both locally and in our GitHub Actions. For this reason, I have been trying to limit our requirements to PyPI modules that help build great algorithms. I struggle when someone wants to add new requirements like this PR that wants to add For this PR, I would recommend that seaborn not be imported at global scope. This is because seaborn is used for data display, not calculations. There could be plotting functions that would import seaborn at local scope but these would not be run in our CI or tests. In CONTRIBUTING.md and in my pull request reviews, I have been trying to emphasize the differences algorithmic functions that do not print() or plot vs. helper functions that display the results calculated from those algorithmic functions. Please let me know if you agree with this approach or not. |
I try to run further tests without plots and display results based in
algorithm
Thanks Class for your suggestions
…On Tue, 26 Oct, 2021, 11:12 pm Christian Clauss, ***@***.***> wrote:
@poyea <https://github.com/poyea> @dhruvmanila
<https://github.com/dhruvmanila> How do you folks feel about our
requirements
<https://github.com/TheAlgorithms/Python/blob/master/requirements.txt>?
We currently have a list of 20 and it takes time and space to install all
these requirements when we test both locally and in our GitHub Actions. For
this reason, I have been trying to limit our requirements to PyPI modules
that help build great algorithms.
I struggle when someone wants to add new requirements like this PR that
wants to add seaborn.
For this PR, I would *recommend that seaborn not be imported at global
scope.* This is because seaborn is used for data display, not
calculations. There could be plotting functions that would import seaborn
at local scope but these would not be run in our CI or tests. In
CONTRIBUTING.md and in my pull request reviews, I have been trying to
emphasize the differences *algorithmic functions* that do not print() or
plot vs. helper functions that display the results calculated from those
algorithmic functions. Please let me know if you agree with this approach
or not.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5615 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APKUHXG3576W3VSLUHYE6ILUI3Y7TANCNFSM5GYI22BA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
machine_learning/local_weighted_learning/local_weighted_learning.py
Outdated
Show resolved
Hide resolved
I agree. Algorithms like this rely heavily on display (like images, graphs, lines, etc.). I suggest we review those existing ones and make it clear later. Should we allow |
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
machine_learning/local_weighted_learning/local_weighted_learning.py
Outdated
Show resolved
Hide resolved
Hi @ClausS even after the import change it was not able to pass test cases
and im unable to merge it here by I'm attaching my file here once please
have a look and suggest me what else I can do
…On Tue, 26 Oct 2021 at 23:31, Christian Clauss ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In machine_learning/local_weighted_learning/local_weighted_learning.py
<#5615 (comment)>:
> @@ -0,0 +1,116 @@
+# Required imports to run this file
+import matplotlib.pyplot as plt
+import numpy as np
+import seaborn as sns
⬇️ Suggested change
-import seaborn as sns
------------------------------
In machine_learning/local_weighted_learning/local_weighted_learning.py
<#5615 (comment)>:
> + m, n = np.shape(training_data_x)
+ ypred = np.zeros(m)
+
+ for i, item in enumerate(training_data_x):
+ ypred[i] = item * local_weight(
+ item, training_data_x, training_data_y, bandwidth
+ )
+
+ return ypred
+
+
+def load_data(dataset_name: str, cola_name: str, colb_name: str) -> np.mat:
+ """
+ Function used for loading data from the seaborn splitting into x and y points
+ """
+ data = sns.load_dataset(dataset_name)
⬇️ Suggested change
- data = sns.load_dataset(dataset_name)
+ import seaborn as sns
+
+ data = sns.load_dataset(dataset_name)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5615 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APKUHXF5ENIHSOEYFTF7CELUI33IBANCNFSM5GYI22BA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
machine_learning/local_weighted_learning/local_weighted_learning.py
Outdated
Show resolved
Hide resolved
machine_learning/local_weighted_learning/local_weighted_learning.py
Outdated
Show resolved
Hide resolved
machine_learning/local_weighted_learning/local_weighted_learning.py
Outdated
Show resolved
Hide resolved
machine_learning/local_weighted_learning/local_weighted_learning.py
Outdated
Show resolved
Hide resolved
machine_learning/local_weighted_learning/local_weighted_learning.py
Outdated
Show resolved
Hide resolved
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
Hi clauss as requested by you changes has been made and pull requested review and approve |
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.
Awesome work! Thanks for your persistance.
Hi clauss this is why I have added backslash in doctests because of it the
run got failed and pr didn't merged to repo
…On Sun, 31 Oct, 2021, 2:55 am Christian Clauss, ***@***.***> wrote:
***@***.**** approved this pull request.
Awesome work! Thanks for your persistance.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5615 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APKUHXCKVUSBOECEXFOH4YTUJRWGDANCNFSM5GYI22BA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
But great bow and thanks to you for consistently helping me for this pr
…On Sun, 31 Oct, 2021, 2:55 am Christian Clauss, ***@***.***> wrote:
***@***.**** approved this pull request.
Awesome work! Thanks for your persistance.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5615 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APKUHXCKVUSBOECEXFOH4YTUJRWGDANCNFSM5GYI22BA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
>>> weighted_matrix(np.array([1., 1.]),np.mat([[16.99, 10.34], [21.01,23.68], | ||
[24.59,25.69]]), 0.6) |
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.
You just need to use the ...
to show doctest that we are continuing the previous line.
>>> weighted_matrix(np.array([1., 1.]),np.mat([[16.99, 10.34], [21.01,23.68], | |
[24.59,25.69]]), 0.6) | |
>>> weighted_matrix(np.array([1., 1.]),np.mat([[16.99, 10.34], [21.01,23.68], | |
... [24.59,25.69]]), 0.6) |
>>> local_weight(np.array([1., 1.]),np.mat([[16.99, 10.34], [21.01,23.68], | ||
[24.59,25.69]]),np.mat([[1.01, 1.66, 3.5]]), 0.6) |
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.
>>> local_weight(np.array([1., 1.]),np.mat([[16.99, 10.34], [21.01,23.68], | |
[24.59,25.69]]),np.mat([[1.01, 1.66, 3.5]]), 0.6) | |
>>> local_weight(np.array([1., 1.]),np.mat([[16.99, 10.34], [21.01,23.68], | |
... [24.59,25.69]]),np.mat([[1.01, 1.66, 3.5]]), 0.6) |
>>> local_weight_regression(np.mat([[16.99, 10.34], [21.01,23.68], | ||
[24.59,25.69]]),np.mat([[1.01, 1.66, 3.5]]), 0.6) |
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.
>>> local_weight_regression(np.mat([[16.99, 10.34], [21.01,23.68], | |
[24.59,25.69]]),np.mat([[1.01, 1.66, 3.5]]), 0.6) | |
>>> local_weight_regression(np.mat([[16.99, 10.34], [21.01,23.68], | |
... [24.59,25.69]]),np.mat([[1.01, 1.66, 3.5]]), 0.6) |
def load_data(dataset_name: str, cola_name: str, colb_name: str) -> np.mat: | ||
""" | ||
Function used for loading data from the seaborn splitting into x and y points | ||
""" |
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.
Let's silence @algorithms-keeper
""" | |
>>> pass # This function has no doctest. | |
""" |
) -> plt.plot: | ||
""" | ||
This function used to plot predictions and display the graph | ||
""" |
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.
""" | |
>>> pass # This function has no doctest. | |
""" |
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.