Kaggle competition: Rainforest Connection Species Audio Detection
<categorify><EOS> 
MODE = 1
FUDGE = 2.0
FILE = '.. /input/rfcx-minimal/submission.csv'
df = pd.read_csv(FILE)
 for k in range(24):
df.iloc[:,1+k] -= df.iloc[:,1+k].min()
df.iloc[:,1+k] /= df.iloc[:,1+k].max()
def scale(probs, factor):
probs = probs.copy()
idx = np.where(probs!=1)[0]
odds = factor * probs[idx] /(1-probs[idx])
 probs[idx] = odds/(1+odds)
 return probs
d1 = df.iloc[:,1:].mean().values
d2 = np.array([113,204,44,923,53,41,3,213,44,23,26,149,255,14,123,222,46,6,474,4,17,18,23,72])/1000.
 for k in range(24):
if MODE==1: d = FUDGE
if MODE==2: d = d1[k]/(1-d1[k])
 if MODE==3: s = d2[k] / d1[k]
else: s =(d2[k]/(1-d2[k])) /d
df.iloc[:,k+1] = scale(df.iloc[:,k+1].values,s)
 df.to_csv('submission_with_pp.csv',index=False )