當前位置: 首頁>>代碼示例>>Python>>正文


Python Parallel.sort方法代碼示例

本文整理匯總了Python中joblib.Parallel.sort方法的典型用法代碼示例。如果您正苦於以下問題:Python Parallel.sort方法的具體用法?Python Parallel.sort怎麽用?Python Parallel.sort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在joblib.Parallel的用法示例。


在下文中一共展示了Parallel.sort方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: best_classifier

# 需要導入模塊: from joblib import Parallel [as 別名]
# 或者: from joblib.Parallel import sort [as 別名]
def best_classifier(X,Y,Xvs,Yvs):
    parameters = {'C':[3,13,67,330,1636,8103]}
    pg = ParameterGrid(parameters)
    clas = Parallel(n_jobs=4)(delayed(pfit)(p,X,Y,Xvs,Yvs) for p in pg)
    clas.sort(reverse=True)
    (sc,cla) = clas[0]
    print '-'*20
    print 'best is ',cla,sc
    print '-'*20
    return cla,sc
開發者ID:KenHollandWHY,項目名稱:kaggle,代碼行數:12,代碼來源:cv_stage3.py

示例2: find_TADs

# 需要導入模塊: from joblib import Parallel [as 別名]
# 或者: from joblib.Parallel import sort [as 別名]
 def find_TADs(self, data, gammalist=range(10, 110, 10), segmentation='potts',
               minlen=3, drop_gamma=False, n_jobs='auto'):
     '''
     Finds TADs in data with a list of gammas. Returns a pandas DataFrame
     with columns 'Start', 'End' and 'Gamma'. Use genome_intervals_to_chr on
     the returned object to get coordinates in bed-style format and not in
     coordinates of concatenated genome.
     If *drop_gamma*, drops the 'Gamma' column (useful when using 1 gamma)
     '''
     raise DeprecationWarning('Will be deprecated or rewritten to use'\
                             'lavaburst: github.com/nezar-compbio/lavaburst')
     if n_jobs is 'auto': #Empirical values on my computer; with >8 Gb memory try increasing n_jobs
         if segmentation == 'potts':
             n_jobs = 3
         elif segmentation == 'armatus':
             n_jobs = 6
     if ~np.isfinite(data).any():
         print 'Non-finite values in data, substituting them with zeroes'
         data[~np.isfinite(data)] = 0
     Wcomm, Wnull, pass_mask, length = _precalculate_TADs_in_array(data)
     f = _calculate_TADs
     if n_jobs >= 1:
         from joblib import Parallel, delayed
         domains = Parallel(n_jobs=n_jobs, max_nbytes=1e6)(
                           delayed(f)(Wcomm, Wnull, pass_mask, length, g, segmentation)
                                                                    for g in gammalist)
     elif n_jobs is None or n_jobs == False or n_jobs == 0:
         domains = []
         for g in gammalist:
             domains_g = f(Wcomm, Wnull, pass_mask, length, g, segmentation)
             domains.append(domains_g)
     domains = pd.concat(domains, ignore_index=True)
     domains = domains.query('End-Start>='+str(minlen)).copy()
     domains = domains.sort(columns=['Gamma', 'Start', 'End'])
     domains.reset_index(drop=True, inplace=True)
     domains[['Start', 'End']] = domains[['Start', 'End']].astype(int)
     domains[['Start', 'End']] *= self.resolution
     domains = domains[['Start', 'End', 'Score', 'Gamma']]
     if drop_gamma:
         domains.drop('Gamma', axis=1, inplace=True)
     domains = self.genome_intervals_to_chr(domains).reset_index(drop=True)
     return domains
開發者ID:Phlya,項目名稱:hicplotlib,代碼行數:44,代碼來源:GenomicIntervals.py


注:本文中的joblib.Parallel.sort方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。