Example #1
0
        /**
         * <summary>The getSubSetOfFeatures method takes a {@link FeatureSubSet} as an input. First it creates a result {@link Instance}
         * with the class label, and adds the attributes of the given featureSubSet to it.</summary>
         *
         * <param name="featureSubSet">{@link FeatureSubSet} an {@link ArrayList} of indices.</param>
         * <returns>result Instance.</returns>
         */
        public Instance GetSubSetOfFeatures(FeatureSubSet featureSubSet)
        {
            var result = new Instance(_classLabel);

            for (var i = 0; i < featureSubSet.Size(); i++)
            {
                result.AddAttribute(_attributes[featureSubSet.Get(i)]);
            }

            return(result);
        }
        /**
         * <summary>Generates new subset of attribute types by using given feature subset.</summary>
         *
         * <param name="featureSubSet">{@link FeatureSubSet} input.</param>
         * <returns>DataDefinition with new subset of attribute types.</returns>
         */
        public DataDefinition GetSubSetOfFeatures(FeatureSubSet featureSubSet)
        {
            var newAttributeTypes = new List <AttributeType>();

            for (var i = 0; i < featureSubSet.Size(); i++)
            {
                newAttributeTypes.Add(_attributeTypes[featureSubSet.Get(i)]);
            }

            return(new DataDefinition(newAttributeTypes));
        }