def read_matrix(f): """ read matrix from file, to globalD, globalH """ content = f.readline().split("\t") globalD = content[1].strip("\n") globalH = content[2].strip("\n") globalD = generate_array(globalD, element_type=np.float64) globalH = generate_array(globalH, element_type=np.float64) return (globalD, globalH)
def load_models(self): """ load models from the file """ f = open(self.params["models_filename"]) content = f.readlines() content = content[0].strip('\n').split('\t') self.w_suffix_matrix = generate_array(content[2], element_type=np.float64) self.w_matrix = generate_array(content[4], element_type=np.float64) self.w_matrix = np.transpose(self.w_matrix) f.close()