Exemplo n.º 1
0
            ValueGetter <VBuffer <float> > GetGetterVector(ScalingFactor scales)
            {
                var getter = _inputCursor.GetGetter <VBuffer <float> >(scales.columnId);

                return((ref VBuffer <float> dst) =>
                {
                    getter(ref dst);
                    if (dst.Length != scales.mean.Length)
                    {
                        throw _parent._host.Except("Mismatch dimension {0} for destination != {1} for scaling vectors.", dst.Length, scales.mean.Length);
                    }
                    scales.Update(ref dst);
                });
            }
Exemplo n.º 2
0
            ValueGetter <VBuffer <float> > GetGetter(ScalingFactor scales)
            {
                var   getter = _inputCursor.GetGetter <float>(scales.columnId);
                float value  = 0f;

                return((ref VBuffer <float> dst) =>
                {
                    getter(ref value);
                    if (1 != scales.mean.Length)
                    {
                        throw _parent._host.Except("Mismatch dimension {0} for destination != {1} for scaling vectors.", dst.Length, scales.mean.Length);
                    }
                    if (dst.Length != 1)
                    {
                        dst = new VBuffer <float>(1, new[] { value });
                    }
                    else
                    {
                        dst.Values[0] = value;
                    }
                    scales.Update(ref dst);
                });
            }