def LSTD_PI_policy(fMap, Ts, R, discountFactor, initpolicy=None, maxIters=20):
 def veval(T):
  return LSTD_values(T, R, fMap, discountFactor)
 return policyIteration(Ts, R, discountFactor, VEvaluator=veval, initpolicy=initpolicy, maxIters=maxIters)

def LSTD_PI_policy ( fMap , Ts , R , discountFactor , initpolicy = None , maxIters = 20 ) : def veval ( T ) : return LSTD_values ( T , R , fMap , discountFactor ) return policyIteration ( Ts , R , discountFactor , VEvaluator = veval , initpolicy = initpolicy , maxIters = maxIters )
alternative version of lspi using value functions instead of state-action values as intermediate .