Esempio n. 1
0
def select(globalSPLVars, w, params):
	logging.debug("Fraction %f" % globalSPLVars.fraction)
	labels, violations= zip(*CommonApp.accessExamples(params,w, findYAndViolation, None))
	cutoffDict = findCutoffs(violations, labels, params.numYLabels,globalSPLVars.fraction)
	trueYAndSelections = CommonApp.accessExamples(params, (w, cutoffDict,globalSPLVars.fraction), updateSelectionSPL, None)	

	for label in range(params.numYLabels):
		total = 0
		totalOn = 0
		for trueYandSelection in trueYAndSelections:
			if trueYandSelection[0]==label:
				totalOn += trueYandSelection[1]
				total+=1
		logging.debug("For label %d totalOn %f and total %f" %( label, totalOn, total))
Esempio n. 2
0
def dumpCurrentLatentVariables(params, lvFile):
	idLVpairs = CommonApp.accessExamples(params, None, grabLatentVariables, None)
	fh = open(lvFile,'w')
	idLVpairs.sort( lambda x,y: int(x[0])-int(y[0]))

	for id,LV in idLVpairs:
		fh.write("%s %d %d %d %d\n" % (id, LV.x_min, LV.x_max, LV.y_min, LV.y_max))

	fh.close()
Esempio n. 3
0
def impute(optState, params):
	logging.debug("Imputing H")
	CommonApp.accessExamples(params, optState, imputeSingle, None)
Esempio n. 4
0
def setupSPL(params):
	CommonApp.accessExamples(params, None, setupSPLEachExample, None)