コード例 #1
0
            public Func <int, bool> GetDependencies(Func <int, bool> predicate)
            {
                Contracts.AssertValue(predicate);

                var active = new bool[Input.Count];

                for (int col = 0; col < ColumnCount; col++)
                {
                    if (!predicate(col))
                    {
                        continue;
                    }

                    bool isSrc;
                    int  index = MapColumnIndex(out isSrc, col);
                    if (isSrc)
                    {
                        active[index] = true;
                    }
                    else
                    {
                        _parent.ActivateSourceColumns(index, active);
                    }
                }

                return(col => 0 <= col && col < active.Length && active[col]);
            }
コード例 #2
0
ファイル: TransformBase.cs プロジェクト: artemiusgreat/ML-NET
            /// <summary>
            /// Given a set of columns, return the input columns that are needed to generate those output columns.
            /// </summary>
            public IEnumerable <DataViewSchema.Column> GetDependencies(IEnumerable <DataViewSchema.Column> columns)
            {
                Contracts.AssertValue(columns);

                var active = new bool[Input.Count];

                foreach (var col in columns)
                {
                    bool isSrc;
                    int  index = MapColumnIndex(out isSrc, col.Index);
                    if (isSrc)
                    {
                        active[index] = true;
                    }
                    else
                    {
                        _parent.ActivateSourceColumns(index, active);
                    }
                }

                return(Input.Where(col => col.Index < active.Length && active[col.Index]));
            }