Created
June 10, 2015 16:52
-
-
Save chrisalbon/8cf29ee1a0d9222d0767 to your computer and use it in GitHub Desktop.
Hardcoded Rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
x = ['Family Practice', 'Internal Medicine', 'Family Practice', 'Family Practice'] | |
y = [0,0,0,1] | |
score = 0 | |
def hardcoded_rules(x,y,score): | |
if len(x) < 3 and max(y) < 3: | |
score = -1 | |
elif np.unique(y)[0] == 1: | |
score = -1 | |
elif sum(np.isnan(y))/len(y) > .5: | |
score = -1 | |
elif np.all(np.unique(y) == [0, 1]) and y.count(1) == 1: | |
score = -1 | |
return x, y, score | |
hardcoded_rules(x,y,score) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment