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

PC algo only working with int data inputs #69

Open
robertness opened this issue Dec 9, 2022 · 1 comment
Open

PC algo only working with int data inputs #69

robertness opened this issue Dec 9, 2022 · 1 comment

Comments

@robertness
Copy link
Collaborator

robertness commented Dec 9, 2022

Right now, the PC algorithm I believe requires discrete variables to be integers instead of characters.
I tried running PC on this data:

A S T L B E X D
no yes no no yes no no yes
no yes no no no no no no
no no yes no no yes yes yes
no no no no yes no no yes
no no no no no no no yes

But it threw an error. To get it to work I had to convert the values to ints.

def convert_to_int(df):
    for var in df.columns:
        data[var] = [1 if x == "yes" else 0 for x in data[var]]
    return df
data_mod = convert_to_int(data)

pc.fit(data_mod, context)

Calling this a bug. pc.fit(data, context) should work.

@adam2392
Copy link
Collaborator

adam2392 commented Dec 9, 2022

Could the user just call an Encoder preprocessing function from scikit-learn? Or should we add that step for them? Either way good catch, we should document this accordingly for any categorical/discrete tests.

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

No branches or pull requests

2 participants