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

Better error message when predict() is called with a Table that already contains the target #9

Closed
SmiteDeluxe opened this issue Jan 27, 2023 · 1 comment · Fixed by #145
Assignees
Labels
enhancement 💡 New feature or request released Included in a release

Comments

@SmiteDeluxe
Copy link
Contributor

SmiteDeluxe commented Jan 27, 2023

Is your feature request related to a problem? Please describe

It often occurs that a predict() call returns following error:
PredictionError: Error occurred while predicting: X has 12 features, but RandomForestRegressor is expecting 11 features as input.
whenever you forget to drop the column that is to be predicted in the Table you're trying to predict on.

Desired solution

Catch that error and return a custom msg for the PredictionError in case it really is this particular column.

@SmiteDeluxe SmiteDeluxe added the enhancement 💡 New feature or request label Jan 27, 2023
@lars-reimann lars-reimann transferred this issue from Safe-DS/DSL Mar 4, 2023
lars-reimann added a commit that referenced this issue Mar 24, 2023
### Summary of Changes

This can also be accomplished by renaming columns in the returned table.
If the input table already contains the column we want to predict, it's
an indicator for #9, so we shouldn't just let people change the name
here.

---------

Co-authored-by: lars-reimann <[email protected]>
lars-reimann pushed a commit that referenced this issue Mar 26, 2023
## [0.4.0](v0.3.0...v0.4.0) (2023-03-26)

### Features

* better names for properties of `TaggedTable` ([#74](#74)) ([fee398b](fee398b))
* change the name of a `Column` ([#76](#76)) ([ec539eb](ec539eb))
* metrics as methods of models ([#77](#77)) ([bc63693](bc63693)), closes [#64](#64)
* optionally pass type to column ([#79](#79)) ([64aa429](64aa429)), closes [#78](#78)
* remove `target_name` parameter of `predict` ([#70](#70)) ([b513454](b513454)), closes [#9](#9)
* rename `tagged_table` parameter of `fit` to `training_set` ([#71](#71)) ([8655521](8655521))
* return `TaggedTable` from `predict` ([#73](#73)) ([5d5f5a6](5d5f5a6))
@lars-reimann lars-reimann changed the title Easy to make error of not dropping to be predicted column before predict() Better error message when predict() is called with a Table that already contains the target Mar 29, 2023
@lars-reimann lars-reimann added the good first issue Good for newcomers label Mar 29, 2023
@lars-reimann lars-reimann self-assigned this Apr 2, 2023
@lars-reimann lars-reimann linked a pull request Apr 2, 2023 that will close this issue
@lars-reimann lars-reimann removed the good first issue Good for newcomers label Apr 2, 2023
lars-reimann added a commit that referenced this issue Apr 2, 2023
Closes #9.

### Summary of Changes

* Use appropriate exception types.
* Improve messages of raised exception.
* Improve documentation.
lars-reimann pushed a commit that referenced this issue Apr 4, 2023
## [0.9.0](v0.8.0...v0.9.0) (2023-04-04)

### Features

* container for images ([#159](#159)) ([ed7ae34](ed7ae34)), closes [#158](#158)
* improve error handling for `predict` ([#145](#145)) ([a5ff11c](a5ff11c)), closes [#9](#9)
* move `ImputerStrategy` to `safeds.data.tabular.typing` ([#174](#174)) ([205c8e2](205c8e2))
* rename `n_neighbors` to `number_of_neighbors` ([#162](#162)) ([526b96e](526b96e))

### Bug Fixes

* export `TableTransformer` and `InvertibleTableTransformer` ([#135](#135)) ([81c3695](81c3695))
@lars-reimann
Copy link
Member

🎉 This issue has been resolved in version 0.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lars-reimann lars-reimann added the released Included in a release label Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 💡 New feature or request released Included in a release
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants