Uh oh!
There was an error while loading. Please reload this page.
Dimensionality reduction - #8590
Conversation
There was a problem hiding this comment.
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 reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto 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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
for more information, see https://pre-commit.ci
Uh oh!
There was an error while loading. Please reload this page.
@Diegomangasco , run |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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 reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto 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.
Uh oh!
There was an error while loading. Please reload this page.
| return covariance_sum / features.shape[1] | ||
| def covariance_between_classes( |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file machine_learning/dimensionality_reduction.py, please provide doctest for the function covariance_between_classes
There was a problem hiding this comment.
"""
features = np.array([[1, 2, 3], [4, 5, 6]])
labels = np.array([0, 1, 0])
covariance_between_classes(features, labels, 2)
output : array([[-1.5, -1.5],[-1.5, -1.5]])
"""
There was a problem hiding this comment.
Pytest discovery is not finding/running these
See the GitHub Actions output.
machine_learning/data_transformations.py .. [ 54%]
machine_learning/decision_tree.py . [ 54%]
machine_learning/k_means_clust.py . [ 54%]
machine_learning/k_nearest_neighbours.py .. [ 55%]
machine_learning/linear_discriminant_analysis.py ....... [ 55%]
machine_learning/multilayer_perceptron_classifier.py . [ 55%]
machine_learning/scoring_functions.py ..... [ 56%]
machine_learning/self_organizing_map.py .. [ 56%]
machine_learning/similarity_search.py ... [ 56%]
machine_learning/support_vector_machines.py ... [ 56%]
machine_learning/word_frequency_functions.py .... [ 57%]
machine_learning/xgboost_classifier.py .. [ 57%]
machine_learning/xgboost_regressor.py ... [ 57%]
machine_learning/forecasting/run.py ..... [ 57%]
machine_learning/local_weighted_learning/local_weighted_learning.py .... [ 58%]
There was a problem hiding this comment.
why it is not running these???
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
for more information, see https://pre-commit.ci
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Diegomangasco
commented
Apr 1, 2023
@rohan472000@cclauss@chriso345
This can be helpful. |
rohan472000
commented
Apr 1, 2023
@Diegomangasco , I also tried but getting -ve sign and some different outputs everytime. AssertionError: Expected [[ 6.92820323 8.66025404 10.39230485] |
Diegomangasco
commented
Apr 1, 2023
Yes because the projection could be done in whatever direction (plus or minus sign), the important things are the values. |
Diegomangasco
commented
Apr 1, 2023
I think that the round errors may due to machine rounding. |
rohan472000
commented
Apr 1, 2023
yes but values that we are getting are also different. |
Diegomangasco
commented
Apr 1, 2023
Can you provide me the input you gave? |
deftest_pca():
features=np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
dimensions=2expected_output=np.array([[6.92820323, 8.66025404, 10.39230485], [3., 3., 3.]])
output=principal_component_analysis(features, dimensions)
assertnp.allclose(expected_output, output), f"Expected {expected_output}, but got {output}"test_pca()error AssertionError: Expected [[ 6.92820323 8.66025404 10.39230485] |
Diegomangasco
commented
Apr 2, 2023
@rohan472000@cclauss It seems to be deterministic, maybe there are some problems with doctests (?) |
Diegomangasco
commented
Apr 2, 2023
@rohan472000@cclauss |
rohan472000
left a comment
There was a problem hiding this comment.
I'm not sure about using different function to test the various cases comes under a good practice or not for this repo, other than that everything looks fine to me.
| return covariance_sum / features.shape[1] | ||
| def covariance_between_classes( |
There was a problem hiding this comment.
"""
features = np.array([[1, 2, 3], [4, 5, 6]])
labels = np.array([0, 1, 0])
covariance_between_classes(features, labels, 2)
output : array([[-1.5, -1.5],[-1.5, -1.5]])
"""
Uh oh!
There was an error while loading. Please reload this page.
| return covariance_sum / features.shape[1] | ||
| def covariance_between_classes( |
There was a problem hiding this comment.
why it is not running these???
Shaquum
commented
Apr 13, 2023
**_> projected_data = linear_discriminant_analysis(features, labels, classes, 3)
|
There was a problem hiding this comment.
projected_data = linear_discriminant_analysis(features, labels, classes, 3)
except AssertionError:
pass
else:
raise AssertionError("Did not raise AssertionError for dimensions > features")
def test_principal_component_analysis() -> None:
features = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
dimensions = 2
expected_output = np.array([[6.92820323, 8.66025404, 10.39230485], [3.0, 3.0, 3.0]])
output = principal_component_analysis(features, labels)
assert np.allclose(
expected_output, output
), f"Expected {expected_output}." {output}"
if name ==dismissed "main":
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
for more information, see https://pre-commit.ci

Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.