🐛 Bug Description
A ValueError occurs when executing the Matching model with a Dataset object in HypEx. The error message indicates a length mismatch in the expected vs. new index values.
Steps To Reproduce
- Create a
Dataset object with specific roles.
- Pass the dataset to the
Matching model.
- Execute
mtchng_mdl.execute(data=hypex_df).
- Observe the
ValueError.
Expected Behavior
The Matching model should execute without errors, correctly handling dataset indexing.
Environment
- HypEx Version: [e.g. 1.0.0]
- Python Version: [e.g. 3.8]
- Operating System: [e.g. iOS, Windows, Linux]
Additional Context
Full traceback:
ValueError: Length mismatch: Expected axis has 712395 elements, new values have 373945 elements
Possible Solution
Potential issues:
- Mismatch in indexing when concatenating treatment and control groups.
- Ensure
index values align correctly between merged datasets.
- Investigate dataset manipulation within
Bias.execute().
Code Sample
import hypex
from hypex.dataset import Dataset, InfoRole, TreatmentRole, TargetRole, FeatureRole
hypex_df = Dataset(
roles={
"epk_id": InfoRole(str),
"treatment_flag": TreatmentRole(int),
"fake_target": TargetRole(int)
},
data=hypex_mtchng_df,
default_role=FeatureRole()
)
mtchng_mdl = hypex.Matching(
group_match=False,
distance="mahalanobis",
bias_estimation=True,
quality_tests="auto"
)
results = mtchng_mdl.execute(data=hypex_df)
Checklist
🐛 Bug Description
A
ValueErroroccurs when executing theMatchingmodel with aDatasetobject in HypEx. The error message indicates a length mismatch in the expected vs. new index values.Steps To Reproduce
Datasetobject with specific roles.Matchingmodel.mtchng_mdl.execute(data=hypex_df).ValueError.Expected Behavior
The
Matchingmodel should execute without errors, correctly handling dataset indexing.Environment
Additional Context
Full traceback:
Possible Solution
Potential issues:
indexvalues align correctly between merged datasets.Bias.execute().Code Sample
Checklist