private bool TryGetGroupSummaryMetrics(Dictionary <string, IDataView>[] metrics, out IDataView gs) { Host.AssertNonEmpty(metrics); if (metrics.Length == 1) { return(metrics[0].TryGetValue(RankingEvaluator.GroupSummary, out gs)); } gs = null; var gsList = new List <IDataView>(); for (int i = 0; i < metrics.Length; i++) { IDataView idv; if (!metrics[i].TryGetValue(RankingEvaluator.GroupSummary, out idv)) { return(false); } idv = EvaluateUtils.AddFoldIndex(Host, idv, i, metrics.Length); gsList.Add(idv); } gs = AppendRowsDataView.Create(Host, gsList[0].Schema, gsList.ToArray()); return(true); }
public RandCursor(AppendRowsDataView parent, Func <int, bool> needCol, Random rand, int[] counts) : base(parent) { Ch.AssertValue(needCol); Ch.AssertValue(rand); _rand = rand; Ch.AssertValue(counts); Ch.Assert(Sources.Length == counts.Length); _cursorSet = new RowCursor[counts.Length]; for (int i = 0; i < counts.Length; i++) { Ch.Assert(counts[i] >= 0); _cursorSet[i] = parent._sources[i].GetRowCursor(needCol, RandomUtils.Create(_rand)); } _sampler = new MultinomialWithoutReplacementSampler(Ch, counts, rand); _currentSourceIndex = -1; for (int c = 0; c < Getters.Length; c++) { if (needCol(c)) { Getters[c] = CreateGetter(c); } } }
public CursorBase(AppendRowsDataView parent) : base(parent._host) { Sources = parent._sources; Ch.AssertNonEmpty(Sources); Schema = parent._schema; Getters = new Delegate[Schema.Count]; }
public Cursor(AppendRowsDataView parent, IEnumerable <Schema.Column> columnsNeeded) : base(parent) { _currentSourceIndex = 0; _currentCursor = Sources[_currentSourceIndex].GetRowCursor(columnsNeeded); _currentIdGetter = _currentCursor.GetIdGetter(); foreach (var col in columnsNeeded) { Getters[col.Index] = CreateGetter(col.Index); } }
public Cursor(AppendRowsDataView parent, Func <int, bool> needCol) : base(parent) { Ch.AssertValue(needCol); _currentSourceIndex = 0; _currentCursor = Sources[_currentSourceIndex].GetRowCursor(needCol); _currentIdGetter = _currentCursor.GetIdGetter(); for (int c = 0; c < Getters.Length; c++) { if (needCol(c)) { Getters[c] = CreateGetter(c); } } }
public RandCursor(AppendRowsDataView parent, IEnumerable <Schema.Column> columnsNeeded, Random rand, int[] counts) : base(parent) { Ch.AssertValue(rand); _rand = rand; Ch.AssertValue(counts); Ch.Assert(Sources.Length == counts.Length); _cursorSet = new RowCursor[counts.Length]; for (int i = 0; i < counts.Length; i++) { Ch.Assert(counts[i] >= 0); _cursorSet[i] = parent._sources[i].GetRowCursor(columnsNeeded, RandomUtils.Create(_rand)); } _sampler = new MultinomialWithoutReplacementSampler(Ch, counts, rand); _currentSourceIndex = -1; foreach (var col in columnsNeeded) { Getters[col.Index] = CreateGetter(col.Index); } }