Exemplo n.º 1
0
        public override void ExitFeatureSparse(VowpalWabbitParser.FeatureSparseContext context)
        {
            var index = context.index.Text;
            var x     = context.x.value;

            if (index == "const")
            {
                this.example.Constant = x;
            }
            else
            {
                this.example.Features.Add(new KeyValuePair <string, float>(index, x));
            }
        }
Exemplo n.º 2
0
        public override void ExitFeatureSparse(VowpalWabbitParser.FeatureSparseContext context)
        {
            var index = context.index;

            var weight_index = index.Text;
            var x            = context.x;

            if (x == null)
            {
                // hashed feature
                this.example.T = weight_index;
            }
            else
            {
                // sparse feature
                this.example.F.Add(new KeyValuePair <string, float>(weight_index, context.x.value));
            }
        }