def create_sorted_dict(self, offline=False): if offline: # Offline c*k zaman aliyor, gerek yok gibi bir sey. #TODO Try-except koymak lazim, dosyalar yok belki self.cf_simsorted_dict = load_data(PKL + 'cf_simsorted.pkl') self.cb_simsorted_dict = load_data(PKL + 'cb_simsorted.pkl') else: if self.cb_prox is None or self.cf_prox is None: self.create_proximity_matrices() self.cb_simsorted_dict = utils.sortSparseMatrix(self.cb_prox) print "cb dict has been calculated" self.cf_simsorted_dict = utils.sortSparseMatrix(self.cf_prox)
def create_approach_matrix(self): if self.sim_dict is None: if self.approach == 'cf': self.create_proximity_matrices(ptype='cf') self.sim_dict = utils.sortSparseMatrix(self.cf_prox) print "Similarity dict has been created for %s" % self.approach elif self.approach == 'cb': self.create_proximity_matrices(ptype='cb') self.sim_dict = utils.sortSparseMatrix(self.cb_prox) print "Similarity dict has been created for %s" % self.approach else: print "There is no approach: %s" % self.approach print "Please pick <cf> or <cb>" exit(-1)