def parseLines(feats, group): lines = [] collectedFeats = model.collectPerfFeats(feats) # names = "group\t" + "\t".join(collectedFeats.keys()) # lines.append(names) valueLines = zip(*collectedFeats.values()) # [(feat1, feat2), (feat1, feat2)] for line in valueLines: lineStr = map(str, list(line)) # lines.append('\t'.join(lineStr) + "\n") lines.append(group + "\t" + "\t".join(lineStr)) return lines
def parseLines(feats, group): lines = [] collectedFeats = model.collectPerfFeats(feats) #names = "group\t" + "\t".join(collectedFeats.keys()) #lines.append(names) valueLines = zip( *collectedFeats.values()) #[(feat1, feat2), (feat1, feat2)] for line in valueLines: lineStr = map(str, list(line)) #lines.append('\t'.join(lineStr) + "\n") lines.append(group + '\t' + '\t'.join(lineStr)) return lines
def parseColNames(feats): collectedFeats = model.collectPerfFeats(feats) return ["group\t" + "\t".join(collectedFeats.keys()) ] # each line is a vector
import model import config import featureManager trainFeats = featureManager.loadJson(config.defaultTrainFeatsFilename) print(model.collectScoreFeats(trainFeats)) print(model.collectPerfFeats(trainFeats)) model = model.trainMultiLinearRegress(trainFeats, config.defaultModelFilename) print(model) def dummyFunc(): print("this is a function for type(dummyFunc) comparison") #for mode in ['train', 'gen']: # print(model.getModelFunc(mode)) # assert type(model.getModelFunc(mode)) == type(dummyFunc), 'getModelFunc() returned a non-function object' #
def parseColNames(feats): collectedFeats = model.collectPerfFeats(feats) return ["group\t" + "\t".join(collectedFeats.keys())] # each line is a vector