Skip to content

[BUG] value error in matching #155

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

Open
6 tasks
tikhomirovd opened this issue Mar 6, 2025 · 0 comments
Open
6 tasks

[BUG] value error in matching #155

tikhomirovd opened this issue Mar 6, 2025 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@tikhomirovd
Copy link
Collaborator

tikhomirovd commented Mar 6, 2025

🐛 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

  1. Create a Dataset object with specific roles.
  2. Pass the dataset to the Matching model.
  3. Execute mtchng_mdl.execute(data=hypex_df).
  4. 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

  • I have described the bug in detail
  • I have provided steps to reproduce
  • I have provided the expected behavior
  • I have provided screenshots (if applicable)
  • I have provided my environment details
  • I have suggested a possible solution (if applicable)
@tikhomirovd tikhomirovd added the bug Something isn't working label Mar 6, 2025
@tikhomirovd tikhomirovd added this to the 1.0.1 milestone Mar 6, 2025
@tikhomirovd tikhomirovd changed the title [BUG] [BUG] value error in matching Mar 13, 2025
@tikhomirovd tikhomirovd modified the milestones: 1.0.1, 1.0.2 Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants