Skip to content

Conversation

@rabah-khalek
Copy link
Contributor

the example is attached on the linear card.

@rabah-khalek rabah-khalek added enhancement New feature or request Python Pull requests that update Python code labels Sep 7, 2023
@rabah-khalek rabah-khalek requested a review from mattbit September 7, 2023 10:26
@rabah-khalek rabah-khalek self-assigned this Sep 7, 2023
@linear
Copy link

linear bot commented Sep 7, 2023

GSK-1700 Single feature issue

problem.ipynb

if the dataframe contains only one column, this will cause problems:

def prediction_function(df: pd.DataFrame) -> np.ndarray:
    return model.predict_proba(df)

even if the feature is indicated in the feature_names of the model.

this is due to the fact that an sklearn model expects 1D data to be a pd.Series instead of pd.DataFrame.

return self.data_preprocessing_function(data)

# In the case where a dataframe has one column, most sklearn models require a Series instead of a DataFrame.
# We check also the case of PredictionFunctionModel to be extra inclusive.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rabah-khalek could you add a unit test for it please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@andreybavt andreybavt merged commit 84f15eb into main Sep 14, 2023
@andreybavt andreybavt deleted the GSK-1700-single-feature-case branch September 14, 2023 12:06
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Python Pull requests that update Python code

Development

Successfully merging this pull request may close these issues.

3 participants