Skip to content

Checks on the data sets array dimensions#82

Open
E-Urzua wants to merge 1 commit into
dso-org:masterfrom
E-Urzua:master
Open

Checks on the data sets array dimensions#82
E-Urzua wants to merge 1 commit into
dso-org:masterfrom
E-Urzua:master

Conversation

@E-Urzua

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

Copy link
Copy Markdown

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