public State(IExceptionContext ectx, Row input, TreeEnsembleModelParameters ensemble, int numLeaves, int featureIndex)
                {
                    Contracts.AssertValue(ectx);
                    _ectx = ectx;
                    _ectx.AssertValue(input);
                    _ectx.AssertValue(ensemble);
                    _ectx.Assert(ensemble.TrainedEnsemble.NumTrees > 0);
                    _input     = input;
                    _ensemble  = ensemble;
                    _numTrees  = _ensemble.TrainedEnsemble.NumTrees;
                    _numLeaves = numLeaves;

                    _src           = default(VBuffer <float>);
                    _featureGetter = input.GetGetter <VBuffer <float> >(featureIndex);

                    _cachedPosition = -1;
                    _leafIds        = new int[_numTrees];
                    _pathIds        = new List <int> [_numTrees];
                    for (int i = 0; i < _numTrees; i++)
                    {
                        _pathIds[i] = new List <int>();
                    }

                    _cachedLeafBuilderPosition = -1;
                    _cachedPathBuilderPosition = -1;
                }
Esempio n. 2
0
 private static float GetLeafValue(TreeEnsembleModelParameters model, int treeId, int leafId)
 {
     return((float)_getLeafValueMethod.Invoke(model, new object[] { treeId, leafId }));
 }
Esempio n. 3
0
        private static int GetLeaf(TreeEnsembleModelParameters model, int treeId, VBuffer <Float> features)
        {
            List <int> path = null;

            return((int)_getLeafMethod.Invoke(model, new object[] { treeId, features, path }));
        }
 internal PretrainedTreeFeaturizationEstimator(IHostEnvironment env, Options options) : base(env, options)
 {
     _modelParameters = options.ModelParameters;
 }