-
Notifications
You must be signed in to change notification settings - Fork 60
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
Fix: fit_surrogate CSV handling issues in DeepHyper #187
base: develop
Are you sure you want to change the base?
Conversation
Hello @evvaletov, Thanks for submitting the PR! I started commenting on some minor aspects. I think it would be great to complement the tests, to check for the different cases you mentioned in #186, see tests here. Also, it can help us provide better documentation. My biggest concern is the |
Hi @Deathn0t, It sounds good about complementing the tests. The reason I added the However, it also makes sense and would be more convenient for the user to get the variable types from As a third possibility, |
Yes, I think the best option is to use |
Hi @evvaletov, let me know if this is good for you or if you need help. Here is an example code using the |
Hi @Deathn0t , this does sound good to me, but I am at a conference at the moment and will have to catch up on other things when I return before returning to this pull request. |
raise ValueError("Provided object is not a pandas DataFrame") | ||
|
||
# Check if objective columns exist | ||
if "objective" not in df.columns and not any( |
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.
Since python 3.8, this could be simplified as
if not (objective_columns := df.filter(regex=r"^objective(?:_\d+)?$").columns):
raise ValueError(...)
raise ValueError("Objective column(s) missing from DataFrame") | ||
|
||
# Convert objective columns to numeric if they're not | ||
if "objective" in df.columns: |
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.
Can get rid of the if else here using
for column in objective_columns:
df[column] = ...
This pull request addresses issues described in bug #186 related to the
fit_surrogate
method in DeepHyper. The specific issues addressed include:fit_surrogate
as an optional argument.With these fixes, users can expect
fit_surrogate
to correctly interpret and handle their CSV files, thereby improving the reliability and accuracy of the method.Please review the changes and let me know if there are any questions or concerns.
Resolves #186