(ty, pv)
return (ACC, MSE, SCC)
evaluations(ty, pv) -> (ACC, MSE, SCC)

	Calculate accuracy, mean squared error and squared correlation coefficient
	using the true values (ty) and predicted values (pv).
evaluations(ty, pv) -> (ACC, MSE, SCC)
evaluations ( ty pv ) - > ( ACC MSE SCC )
def evaluations(ty, pv):
	"""
	evaluations(ty, pv) -> (ACC, MSE, SCC)

	Calculate accuracy, mean squared error and squared correlation coefficient
	using the true values (ty) and predicted values (pv).
	"""
	if len(ty) != len(pv):
		raise ValueError("len(ty) must equal to len(pv)")
	total_correct = total_error = 0
	sumv = sumy = sumvv = sumyy = sumvy = 0
	for v, y in zip(pv, ty):
		if y == v: 
			total_correct += 1
		total_error += (v-y)*(v-y)
		sumv += v
		sumy += y
		sumvv += v*v
		sumyy += y*y
		sumvy += v*y 
	l = len(ty)
	ACC = 100.0*total_correct/l
	MSE = total_error/l
	try:
		SCC = ((l*sumvy-sumv*sumy)*(l*sumvy-sumv*sumy))/((l*sumvv-sumv*sumv)*(l*sumyy-sumy*sumy))
	except:
		SCC = float('nan')
	return (ACC, MSE, SCC)
def evaluations ( ty , pv ) : if len ( ty ) != len ( pv ) : raise ValueError ( "len(ty) must equal to len(pv)" ) total_correct = total_error = 0 sumv = sumy = sumvv = sumyy = sumvy = 0 for v , y in zip ( pv , ty ) : if y == v : total_correct += 1 total_error += ( v - y ) * ( v - y ) sumv += v sumy += y sumvv += v * v sumyy += y * y sumvy += v * y l = len ( ty ) ACC = 100.0 * total_correct / l MSE = total_error / l try : SCC = ( ( l * sumvy - sumv * sumy ) * ( l * sumvy - sumv * sumy ) ) / ( ( l * sumvv - sumv * sumv ) * ( l * sumyy - sumy * sumy ) ) except : SCC = float ( 'nan' ) return ( ACC , MSE , SCC )