Exemple #1
0
            public FeatureNameCollectionSchema(FeatureNameCollection collection)
            {
                Contracts.CheckValue(collection, nameof(collection));

                _collection    = collection;
                _colType       = new VectorType(NumberType.R4, collection.Count);
                _slotNamesType = new VectorType(TextType.Instance, collection.Count);
                _getSlotNames  = GetSlotNames;
            }
Exemple #2
0
            public FeatureNameCollectionBinding(FeatureNameCollection collection)
            {
                Contracts.CheckValue(collection, nameof(collection));

                _collection    = collection;
                _colType       = new VectorType(NumberDataViewType.Single, collection.Count);
                _slotNamesType = new VectorType(TextDataViewType.Instance, collection.Count);

                var metadataBuilder = new DataViewSchema.Annotations.Builder();

                metadataBuilder.Add(AnnotationUtils.Kinds.SlotNames, _slotNamesType,
                                    (ref VBuffer <ReadOnlyMemory <char> > slotNames) => { GetSlotNames(0, ref slotNames); });
                var schemaBuilder = new DataViewSchema.Builder();

                schemaBuilder.AddColumn(RoleMappedSchema.ColumnRole.Feature.Value, _colType, metadataBuilder.ToAnnotations());
                FeatureNameCollectionSchema = schemaBuilder.ToSchema();
            }