public override IEnumerable <RowData> List() { //Console.WriteLine("Enumerating pairs"); foreach (int nullIndex in _nullIndexRange.Elements) { foreach ( KeyValuePair <Pair <string, Dictionary <string, SufficientStatistics> >, Pair <string, Dictionary <string, SufficientStatistics> > > predictorAndTarget in SpecialFunctions.EnumerateTwo(_predictorNameAndCaseIdToNonMissingValueEnumeration, _targetNameAndCaseIdToNonMissingValueEnumeration)) { Pair <string, Dictionary <string, SufficientStatistics> > predictorNameAndCaseIdToNonMissingValue = predictorAndTarget.Key; Pair <string, Dictionary <string, SufficientStatistics> > targetNameAndCaseIdToNonMissingValue = predictorAndTarget.Value; string targetVariable = targetNameAndCaseIdToNonMissingValue.First; string predictorVariable = predictorNameAndCaseIdToNonMissingValue.First; Dictionary <string, string> row = new Dictionary <string, string>(); row.Add(Tabulate.PredictorVariableColumnName, predictorVariable); row.Add(Tabulate.TargetVariableColumnName, targetVariable); row.Add(Tabulate.NullIndexColumnName, nullIndex.ToString()); if (_keepTest.Test(row)) { //RowAndTargetData rowAndTargetData = RowAndTargetData.GetInstance(row, targetNameAndCaseIdToNonMissingValue.Second); RowData rowData = RowData.GetInstance( row, delegate() { return(_nullDataCollection.GetCaseIdToNonMissingValueForNullIndexAndPredictorVariableOrReal( nullIndex, predictorVariable, predictorNameAndCaseIdToNonMissingValue.Second)); }, delegate() { return(_nullDataCollection.GetCaseIdToNonMissingValueForNullIndexAndTargetVariableOrReal( nullIndex, targetVariable, targetNameAndCaseIdToNonMissingValue.Second)); }); yield return(rowData); } } _keepTest.Reset(); // some KeepTests need to be reset before they run through the set again. } }
// iterates over all possible targets, predictors and nullIndex values. That is, performs // an exhaustive combination analysis. public virtual IEnumerable <RowData> List() { //int index = -1; foreach (Pair <string, Dictionary <string, SufficientStatistics> > targetNameAndCaseIdToNonMissingValue in _targetNameAndCaseIdToNonMissingValueEnumeration) { string targetVariable = targetNameAndCaseIdToNonMissingValue.First; foreach (int nullIndex in _nullIndexRange.Elements) { foreach (Pair <string, Dictionary <string, SufficientStatistics> > predictorNameAndCaseIdToNonMissingValue in _predictorNameAndCaseIdToNonMissingValueEnumeration) //foreach (string predictorVariable in _predictorVariableToCaseIdToNonMissingValue.Keys) { //++index; string predictorVariable = predictorNameAndCaseIdToNonMissingValue.First; Dictionary <string, string> row = new Dictionary <string, string>(); row.Add(Tabulate.PredictorVariableColumnName, predictorVariable); row.Add(Tabulate.TargetVariableColumnName, targetVariable); row.Add(Tabulate.NullIndexColumnName, nullIndex.ToString()); if (_keepTest.Test(row)) { //RowAndTargetData rowAndTargetData = RowAndTargetData.GetInstance(row, targetNameAndCaseIdToNonMissingValue.Second); RowData rowData = RowData.GetInstance( row, delegate() { return(_nullDataCollection.GetCaseIdToNonMissingValueForNullIndexAndPredictorVariableOrReal( nullIndex, predictorVariable, predictorNameAndCaseIdToNonMissingValue.Second)); }, delegate() { return(_nullDataCollection.GetCaseIdToNonMissingValueForNullIndexAndTargetVariableOrReal( nullIndex, targetVariable, targetNameAndCaseIdToNonMissingValue.Second)); }); yield return(rowData); } } } } _keepTest.Reset(); // some KeepTests need to be reset before they run through the set again. }