Ejemplo n.º 1
0
weightsdc = []
for n in range(0, plsr.x_weights_.shape[1]):
    lvd = pd.DataFrame(plsr.x_weights_[:, n:n + 1].T)
    lvd.columns = input_data.columns

    vars()['LV%d' % (n + 1)] = spectra(lvd, styles=styles)

    #weightsdl.append("Weights on LV %s" % (n+1))
    weightsdc.append("LV %s" % (n + 1))

weights.index = weightsdc

# Build scores plots for all combinations up to n
score_combinations = set([(a, b) for a in range(0, n)
                          for b in range(a + 1, n + 1)])

if config['plot_sample_numbers']:
    label_index = 'Sample'
else:
    label_index = None

for sc in score_combinations:
    vars()['Scores %dv%d' % (sc[0] + 1, sc[1] + 1)] = scatterplot(
        scores.iloc[:, sc], styles=styles, label_index=label_index)

weightsd = None
# Clean up
lvd = None
# Clean up
Ejemplo n.º 2
0
dso_pc = {}
weightsi = []

# Generate simple result figure (using pathomx libs)
from pathomx.figures import spectra, scatterplot

for n in range(0, pca.components_.shape[0]):
    pcd = pd.DataFrame(weights.values[n:n + 1, :])

    pcd.columns = input_data.columns
    vars()['PC%d' % (n + 1)] = spectra(pcd, styles=styles)

    weightsi.append("PC %d" % (n + 1))

weights.index = weightsi


if config['plot_sample_numbers']:
    label_index = 'Sample'
else:
    label_index = None

# Build scores plots for all combinations up to n
score_combinations = set([ (a,b) for a in range(0,n) for b in range(a+1, n+1)])

for sc in score_combinations:
     vars()['Scores %dv%d' % (sc[0]+1, sc[1]+1)] = scatterplot(scores.iloc[:,sc], styles=styles, label_index=label_index)

pcd = None
# Clean up
Ejemplo n.º 3
0
    scoresl.append( 'Latent Variable %d' % (n+1) ) #, plsr.y_weights_[0][n]) 
scores.columns = scoresl
    

weights = pd.DataFrame( plsr.x_weights_.T )
weights.columns = input_data.columns

dso_lv = {}


# Generate simple result figure (using pathomx libs)
from pathomx.figures import spectra, scatterplot

weightsdc=[]
for n in range(0, plsr.x_weights_.shape[1] ):
    lvd =  pd.DataFrame( plsr.x_weights_[:,n:n+1].T )
    lvd.columns = input_data.columns
    
    vars()['LV%d' % (n+1)]  = spectra(lvd, styles=styles)
    
    #weightsdl.append("Weights on LV %s" % (n+1))
    weightsdc.append("LV %s" % (n+1))

weights.index = weightsdc

Scores = scatterplot(scores, styles=styles)

weightsd = None; # Clean up
lvd = None; # Clean up

Scores
Ejemplo n.º 4
0
    ry = y.values.astype(np.float)

    # Skip if zeros or containing nans
    try:
        slope, intercept, r_value, p_value, std_err = sp.stats.linregress(rx, ry)
    except:
        # Skip any that fail
        pass
    else:
        correlations["R%d" % (n+1)] = {
            'data': do,
            'fit': fit,
            'label': u'r²=%0.2f, p=%0.2f' % (r_value**2, p_value)
        }
        
    progress(float(n)/total_n)
        
do = None;

# Generate simple result figure (using pathomx libs)
from pathomx.figures import scatterplot

for k,c in correlations.items():
    x_data = np.linspace(np.min(c['data'].iloc[:,0]), np.max(c['data'].iloc[:,0]), 50)
    lines = [
        (x_data, np.polyval(c['fit'], x_data), c['label'])
    ]

    vars()[k] = scatterplot(c['data'], lines=lines, styles=styles);