def run_single(run_id): ''' Given an input dictionary containing a single paramater set run mcmc in matlab using bs_macros.run_matlab. ''' input_dict = butils.load_data(run_id,'input') return bsm.runmat('run_mcmc', input_dict, run_id)
def compute_embedding(affinities, aff_type = 'pairs', do_mve = False, ss_multiplier = None): mve_dict = dict(k = 4, similarities = affinities, do_mve = False if aff_type == 'easy' else False) embedding= bsm.runmat('mve_frompy', mve_dict, 'subopt_mve') mve_vecs = embedding['Y'].T pca_vecs = embedding['YPCA'].T return pca_vecs, mve_vecs
def test_bsubfun(run_id): """ A sample function to demonstrate the calling of a matlab script (here, ap_frompy) from within python. Taking an input dictionary and a run_id, this script is designed to be called using the 'eyeball' class from utils/bsub.py. inputs: input_dict: {similarities: a similarity matrix for the input points, self_similarity: a single value for the self similarity of datapoints. Control cluster size. outputs: outpt_dict: {indexes: cluster exemplar indices.} """ input_dict = butils.load_data(run_id, "input") return bsm.runmat("ap_frompy", input_dict, run_id)
def test_bsubfun(run_id): ''' A sample function to demonstrate the calling of a matlab script (here, ap_frompy) from within python. Taking an input dictionary and a run_id, this script is designed to be called using the 'eyeball' class from utils/bsub.py. inputs: input_dict: {similarities: a similarity matrix for the input points, self_similarity: a single value for the self similarity of datapoints. Control cluster size. outputs: outpt_dict: {indexes: cluster exemplar indices.} ''' input_dict = butils.load_data(run_id, 'input') return bsm.runmat('ap_frompy', input_dict, run_id)
def bic_clustering(run_id): """ A matlab/bsub process to compute the BIC maximal clustering for an input dictionary containing a similarity matrix. inputs: input_dict: {similarities: a similarity matrix} outputs: output_dict: {inds:cluster exemplar indices, (MAX BIC) self_similarity:float, self similarity (MAX BIC) inds_[#]: (same as above, ALL BIC) self_similarity_[#}: (...) bic_[#]: (...) } """ input_dict = butils.load_data(run_id, "input") return bsm.runmat("ap_max_bic", input_dict, run_id)
def bic_clustering(run_id): ''' A matlab/bsub process to compute the BIC maximal clustering for an input dictionary containing a similarity matrix. inputs: input_dict: {similarities: a similarity matrix} outputs: output_dict: {inds:cluster exemplar indices, (MAX BIC) self_similarity:float, self similarity (MAX BIC) inds_[#]: (same as above, ALL BIC) self_similarity_[#}: (...) bic_[#]: (...) } ''' input_dict = butils.load_data(run_id, 'input') return bsm.runmat('ap_max_bic', input_dict, run_id)
def compute_clusters(affinities, ss): cluster_dict = dict(similarities=affinities, self_similarity = ss) clusters = bsm.runmat('ap_frompy', cluster_dict, 'subopt_clusters') return squeeze(clusters['inds'])