HealthCatalyst / healthcareai-py

Python tools for healthcare machine learning
http://healthcare.ai
MIT License
316 stars 188 forks source link

Method for changing a Y/N column to 1/0 should be made generic #456

Open danwellisch1 opened 6 years ago

danwellisch1 commented 6 years ago

The below method, currently in transformers.py should take 2 more parameters, e.g. positiveValue and negativeValue such that in the positiveValue = ''Y" and negativeValue = "N" in one case. I think this might be what the TODO is saying, but formalizing into an issue. When I ran the Wisconsin Cancer data set, I had to duplicate this method as a quick fix and hard code M for the positive value and B for the negative value. We need to have one method to do this so it can handle any specified positive or negative value for the prediction column.

class DataFrameConvertTargetToBinary(TransformerMixin):

TODO Note that this makes healthcareai only handle N/Y in pred column

"""
        # Replace 'Y'/'N' with 1/0
        X[self.target_column].replace(['Y', 'N'], [1, 0], inplace=True)

. . .