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

Checks on the data sets array dimensions #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

E-Urzua
Copy link

@E-Urzua E-Urzua commented Jul 3, 2023

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.

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.
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.

1 participant