Skip to content

Comments

Add warning when predict has a type mismatch#761

Closed
ivanhigueram wants to merge 0 commit intopy-econometrics:masterfrom
ivanhigueram:master
Closed

Add warning when predict has a type mismatch#761
ivanhigueram wants to merge 0 commit intopy-econometrics:masterfrom
ivanhigueram:master

Conversation

@ivanhigueram
Copy link

As discussed in (#731), when predict's newdata has a different dtype in the FEs, the function will yield missing values only, this because predict relies on a dictionary of FEs where keys are transformed to strings and will fail to get the correct value (i.e. 10 vs "10.0").

This commit adds a warning in the predict method and a simple unit test that checks for this case for the user.

Copy link
Member

@s3alfisc s3alfisc left a comment

Choose a reason for hiding this comment

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

This looks great, thank you @ivanhigueram!

@all-contributors please add @ivanhigueram for code =)

@s3alfisc
Copy link
Member

pre-commit.ci autofix

@s3alfisc s3alfisc linked an issue Dec 26, 2024 that may be closed by this pull request
@s3alfisc
Copy link
Member

We get new mypy errors - I just fixed those in my local branch of #758 =D Will push a patch!

@codecov
Copy link

codecov bot commented Dec 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Flag Coverage Δ
core-tests 78.12% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pyfixest/estimation/feols_.py 83.72% <100.00%> (+0.08%) ⬆️
pyfixest/estimation/model_matrix_fixest_.py 85.08% <100.00%> (ø)

@s3alfisc
Copy link
Member

pre-commit.ci autofix

@s3alfisc
Copy link
Member

s3alfisc commented Dec 26, 2024

@all-contributors please add @ivanhigueram for code

@s3alfisc
Copy link
Member

Oh wow changes are clearly not working, I'll tackle this tomorrow

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.

predict bug with mismatched data types

2 participants