Exemplo n.º 1
0
    def constructLikelihoodDiff(self, high_pickle_fn, low_pickle_fn):
        """
        calculate difference of the conditional prob of whole data set given low and high class
        """
        condi_dist_h = nb.loadCondiDistribution(high_pickle_fn)
        condi_dist_l = nb.loadCondiDistribution(low_pickle_fn)

        high_pdf = nb.buildPdf(condi_dist_h)
        low_pdf = nb.buildPdf(condi_dist_l)
        
        ener = self.all_set[:, 1:]
        log_condi_predicted_high = nb.calculateConditionalProb(ener, high_pdf)
        log_condi_predicted_low = nb.calculateConditionalProb(ener, low_pdf)
        self.likelihood_diff = log_condi_predicted_low - log_condi_predicted_high
Exemplo n.º 2
0
def calculateLikelihoodDiff():
    h5_path = 'all_decoy.h5'
    sub_path = 'noncentralized_path/low_decoy'
    ener_matx = loadEnerMatx(h5_path, sub_path)

    condi_dist_fn = 'low.dist'
    low_pdf = nb.loadCondiDistribution(condi_dist_fn)
    low_pdf = nb.buildPdf(low_pdf)
    condi_dist_fn = 'high.dist'
    high_pdf = nb.loadCondiDistribution(condi_dist_fn)
    high_pdf = nb.buildPdf(high_pdf)
    
    likelihood_low_diff = nb.getLikelihoodDiff(ener_matx, high_pdf, low_pdf)
    
    sub_path = 'noncentralized_path/high_decoy'
    ener_matx = loadEnerMatx(h5_path, sub_path)

    likelihood_high_diff = nb.getLikelihoodDiff(ener_matx, high_pdf, low_pdf)
    
    return likelihood_high_diff, likelihood_low_diff
Exemplo n.º 3
0
# h = np.loadtxt('06ff_high_decoy.mat', delimiter=' ')

h5_path = 'all_decoy.h5'
sub_path = 'noncentralized_path/low_decoy'
condi_dist_fn = 'low.dist'

f = h5py.File(h5_path)
dset = f[sub_path][()]
ener_matx = dset[:, 1:]

condi_dist_h = nb.loadCondiDistribution(condi_dist_fn)
h = ener_matx

total_samples = 1000

high_pdf = nb.buildPdf(condi_dist_h)

for i in range(h.shape[1]):
    high0_pdf, fitting_para = high_pdf[i]
    print high0_pdf, fitting_para

    h0 = h[:,i]

    max_val = h0.max()
    min_val = h0.min()
    
    step = (max_val - min_val) / float(total_samples) 

    samples = np.arange(min_val, max_val, step)
    if len(fitting_para) == 3:
        arr = high0_pdf(samples, fitting_para[0], loc=fitting_para[1], scale=fitting_para[2])