Ejemplo n.º 1
0
        public static HyperRectangleBuilder InitializeWithSeed(Dataset dataset, int seedIndex)
        {
            var builder      = new HyperRectangleBuilder(dataset);
            var seed         = dataset.GetInstanceData(seedIndex);
            var featureCount = dataset.FeatureCount;

            for (int i = 0; i < featureCount; i++)
            {
                switch (dataset.GetFeatureType(i))
                {
                case FeatureType.Continuous: {
                    builder.UpdateContinuousDimensionIntervalStart(
                        dimensionIndex: i,
                        value: seed[i]);

                    builder.UpdateContinuousDimensionIntervalEnd(
                        dimensionIndex: i,
                        value: seed[i]);

                    break;
                }

                default:
                    throw CommonExceptions.UnknownFeatureType;
                }
            }

            return(builder);
        }
Ejemplo n.º 2
0
        public static HyperRectangleBuilder InitializeWithLargestRectangle(Dataset dataset)
        {
            var builder      = new HyperRectangleBuilder(dataset);
            var featureCount = dataset.FeatureCount;

            for (int i = 0; i < featureCount; i++)
            {
                switch (dataset.GetFeatureType(i))
                {
                case FeatureType.Continuous:
                    builder._starts[i] = float.NegativeInfinity;
                    builder._ends[i]   = float.PositiveInfinity;
                    break;

                default:
                    throw CommonExceptions.UnknownFeatureType;
                }
            }

            return(builder);
        }