Example #1
0
def optimize(w, globalSPLVars, params, iter):
	if params.splParams.splMode == 'CCCP' or iter <= params.splParams.splInitIters:
		wOptstateBundle= SSVM.cuttingPlaneOptimize(w, params, iter)
	else:
		assert(0) # I don't understand
		globalSPLVars.fraction = 1
		SPLSelector.select(globalSPLVars, w, params)
		wOptstateBundle  = SSVM.cuttingPlaneOptimize(w, params, iter)



	return wOptstateBundle
Example #2
0
def main():
	try:
		params = UserInput.getUserInput('train')	
		ExampleLoader.loadExamples(params)
		CommonApp.setExampleCosts(params)
		w = None
		if params.initialModelFile:
			w = CacheObj.loadObject(params.initialModelFile)
		else:
			w = CommonApp.PsiObject(params,False)

		globalSPLVars = SPLSelector.SPLVar()
		
		if params.splParams.splMode != 'CCCP':
			SPLSelector.setupSPL(params)
	
		w = LSSVM.optimize(w, globalSPLVars, params)
		CacheObj.cacheObject(params.modelFile,w)
		Performance.printStrongAndWeakTrainError(params, w)
	except Exception, e :
		import traceback
		traceback.print_exc(file=sys.stdout)