// Bayes likelihood for four condition values and one action value // For each possible action value, call this with a specific set of four // condition values, and pick the action that returns the highest // likelihood as the most likely action to take, given the conditions. double CalcBayes(int[] contValues, int[] discValues, bool outcome) { int doIt = outcome ? 0 : 1; double like = 1.0; for (int i = 0; i < discreteConditions.Length; i++) { double[,] props = discreteConditions[i].GetProportions(); //Debug.Log( "Props: " + props ); like *= props[discValues[i], doIt]; //Debug.Log( "Like: " + like ); } for (int i = 0; i < continuousConditions.Length; i++) { double mean = continuousConditions[i].GetMean(doIt); double stdDev = continuousConditions[i].GetStdDev(doIt); //Debug.Log( "Mean: " + mean ); //Debug.Log( "StdDev: " + stdDev ); like *= GauProb(mean, stdDev, contValues[i]); //Debug.Log( "Like: " + like ); } //Debug.Log( "Outcome: " + outcomeAction.GetProportion( doIt ) ); like *= outcomeAction.GetProportion(doIt); //Debug.Log( "Like: " + like ); return(like); }