Skip to content

Instantly share code, notes, and snippets.

@chrisalbon
Created June 10, 2015 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisalbon/8cf29ee1a0d9222d0767 to your computer and use it in GitHub Desktop.
Save chrisalbon/8cf29ee1a0d9222d0767 to your computer and use it in GitHub Desktop.
Hardcoded Rules
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