Checks on the data sets array dimensions#82
Open
E-Urzua wants to merge 1 commit into
Open
Conversation
Added a few lines of code to the Sklearn.py and regression.py files both found within the task subfolder. I had noticed some weird and unexpected behavior while using the sklearn interface for the dso library when the function argument y for the fit function was not a one dimensional numpy array (See the recently closed issue made by myself tilted Different Learning Equations with Different Numpy Array shape). So fix this issue, within the sklearn.py file I have added a few lines of code to check that the function arguments (X,y) to the fit are first numpy ndarray class objects then if X and y have exactly 2 and 1 array dimensional respectively. A type error is through when the arguments are not numpy arrays and a value error is raised when the number of array dimensions for X or y is incorrect. Additionally, within the regression.py file of the dso library I have added similar error checking within the initialization method of the RegressionTask class but only for the y_train and y_test arrays of the RegressionTask (that they are single dimensional arrays) only after the have been created through either of 4 possible supported use cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a few lines of code to the Sklearn.py and regression.py files both found within the task subfolder. I had noticed some weird and unexpected behavior while using the sklearn interface for the dso library when the function argument y for the fit function was not a one dimensional numpy array (See the recently closed issue made by myself tilted Different Learning Equations with Different Numpy Array shape). So fix this issue, within the sklearn.py file I have added a few lines of code to check that the function arguments (X,y) to the fit are first numpy ndarray class objects then if X and y have exactly 2 and 1 array dimensional respectively. A type error is through when the arguments are not numpy arrays and a value error is raised when the number of array dimensions for X or y is incorrect. Additionally, within the regression.py file of the dso library I have added similar error checking within the initialization method of the RegressionTask class but only for the y_train and y_test arrays of the RegressionTask (that they are single dimensional arrays) only after the have been created through either of 4 possible supported use cases.