AIMA.Probability.Bayes.Impl.CPT.getFactorFor C# (CSharp) Method

getFactorFor() public method

public getFactorFor ( ) : Factor
return AIMA.Probability.Factor
	public Factor getFactorFor(params AssignmentProposition[] evidence) {
		Set<RandomVariable> fofVars = new Set<RandomVariable>(
				table.getFor());
		foreach (AssignmentProposition ap in evidence) {
			fofVars.Remove(ap.getTermVariable());
		}
		 ProbabilityTable fof = new ProbabilityTable(new List<RandomVariable>(fofVars));
		// Otherwise need to iterate through the table for the
		// non evidence variables.
		 Object[] termValues = new Object[fofVars.Count];
        //ProbabilityTable.Iterator di = new ProbabilityTable.Iterator() {
        //    public void iterate(Map<RandomVariable, Object> possibleWorld,
        //            double probability) {
        //        if (0 == termValues.length) {
        //            fof.getValues()[0] += probability;
        //        } else {
        //            int i = 0;
        //            for (RandomVariable rv : fof.getFor()) {
        //                termValues[i] = possibleWorld.get(rv);
        //                i++;
        //            }
        //            fof.getValues()[fof.getIndex(termValues)] += probability;
        //        }
        //    }
        //};
		//table.iterateOverTable(di, evidence);
        // TODO: another screwed up iterator
		return fof;
	}