pKaTool/stab_fit/myfitter.py
def crossValidate(x,y, frac=0.2, num=None):
    """Random sub-sampling removal of points to test effects on 
       fit parameters"""
    l=len(x)
    if num==None:
        num = int(l*(1-frac))
    print 'using %s out of %s points..' %(num,l)
    fig=plt.figure(figsize=(8,8))
    c=0
    pkas=[]
    for n in range(20):
        n1 = random.sample(range(l), num)
        x1 = [x[i] for i in range(l) if i in n1]
        y1 = [y[i] for i in range(l) if i in n1]
        F=fitter(hh1pka,[5,2,0],x1,y1)
        F.fit()
        pka = round(F.params[0],3); pkas.append(pka)
        ax=fig.add_subplot(4,5,c)
        F.plot(ax)
        ax.set_title(pka)
        c+=1
    print 'stdev:', np.std(pkas)    
    return
Random sub-sampling removal of points to test effects on 
       fit parameters
Random sub-sampling removal of points to test effects on
fit parameters
Random sub - sampling removal of points to test effects on fit parameters
def crossValidate(x,y, frac=0.2, num=None):
    l=len(x)
    if num==None:
        num = int(l*(1-frac))
    print 'using %s out of %s points..' %(num,l)
    fig=plt.figure(figsize=(8,8))
    c=0
    pkas=[]
    for n in range(20):
        n1 = random.sample(range(l), num)
        x1 = [x[i] for i in range(l) if i in n1]
        y1 = [y[i] for i in range(l) if i in n1]
        F=fitter(hh1pka,[5,2,0],x1,y1)
        F.fit()
        pka = round(F.params[0],3); pkas.append(pka)
        ax=fig.add_subplot(4,5,c)
        F.plot(ax)
        ax.set_title(pka)
        c+=1
    print 'stdev:', np.std(pkas)    
    return
def crossValidate ( x , y , frac = 0.2 , num = None ) : l = len ( x ) if num == None : num = int ( l * ( 1 - frac ) ) print 'using %s out of %s points..' % ( num , l ) fig = plt . figure ( figsize = ( 8 , 8 ) ) c = 0 pkas = [ ] for n in range ( 20 ) : n1 = random . sample ( range ( l ) , num ) x1 = [ x [ i ] for i in range ( l ) if i in n1 ] y1 = [ y [ i ] for i in range ( l ) if i in n1 ] F = fitter ( hh1pka , [ 5 , 2 , 0 ] , x1 , y1 ) F . fit ( ) pka = round ( F . params [ 0 ] , 3 ) ; pkas . append ( pka ) ax = fig . add_subplot ( 4 , 5 , c ) F . plot ( ax ) ax . set_title ( pka ) c += 1 print 'stdev:' , np . std ( pkas ) return
Random sub-sampling removal of points to test effects on
fit parameters
Random sub - sampling removal of points to test effects on fit parameters
"""Random sub-sampling removal of points to test effects on 
       fit parameters"""
x
y
frac
num