public Cursor(IChannelProvider provider, DataView view, Func <int, bool> predicate, Random rand)
                    : base(provider)
                {
                    Ch.AssertValue(view);
                    Ch.AssertValueOrNull(rand);
                    Ch.Assert(view.Schema.Count >= 0);

                    _view   = view;
                    _active = new BitArray(view.Schema.Count);
                    if (predicate == null)
                    {
                        _active.SetAll(true);
                    }
                    else
                    {
                        for (int i = 0; i < view.Schema.Count; ++i)
                        {
                            _active[i] = predicate(i);
                        }
                    }
                    if (rand != null)
                    {
                        _indices = Utils.GetRandomPermutation(rand, view._rowCount);
                    }
                }
Exemple #2
0
 public Cursor(IHostEnvironment env, string name, ListDataView <TRow> dataView,
               Func <int, bool> predicate, Random rand)
     : base(env, dataView, predicate)
 {
     Ch.AssertValueOrNull(rand);
     _data = dataView._data;
     if (rand != null)
     {
         _permutation = Utils.GetRandomPermutation(rand, dataView._data.Count);
     }
 }
 public Cursor(IChannelProvider provider, string name, ListDataView <TRow> dataView,
               Func <int, bool> predicate, IRandom rand)
     : base(provider, dataView, predicate)
 {
     Ch.AssertValueOrNull(rand);
     _data = dataView._data;
     if (rand != null)
     {
         _permutation = Utils.GetRandomPermutation(rand, dataView._data.Count);
     }
 }
Exemple #4
0
            public RowCursor(NgramHashTransform parent, IRowCursor input, bool[] active, FinderDecorator decorator = null)
                : base(parent.Host, input)
            {
                Ch.AssertValue(parent);
                Ch.Assert(active == null || active.Length == parent._bindings.ColumnCount);
                Ch.AssertValueOrNull(decorator);

                _bindings = parent._bindings;
                _active   = active;

                _getters = new Delegate[_bindings.Infos.Length];
                for (int iinfo = 0; iinfo < _bindings.Infos.Length; iinfo++)
                {
                    if (IsIndexActive(iinfo))
                    {
                        _getters[iinfo] = parent.MakeGetter(Ch, Input, iinfo, decorator);
                    }
                }
            }
            public Cursor(IChannelProvider provider, IDataTransform view, Bindings bindings, Func <int, bool> predicate, Random rand)
                : base(provider)
            {
                Ch.AssertValue(view);
                Ch.AssertValueOrNull(rand);
                Ch.Assert(view.Schema.Count >= 0);

                _view     = view;
                _bindings = bindings;
                _cursor   = view.Source.GetRowCursorForAllColumns();
                _active   = new BitArray(view.Schema.Count);

                if (predicate == null)
                {
                    _active.SetAll(true);
                }
                else
                {
                    for (int i = 0; i < view.Schema.Count; ++i)
                    {
                        _active[i] = predicate(i);
                    }
                }
            }