Exemplo n.º 1
0
        public CombinationRuntimeBuilder(int classidx, T[] data, int[] indexes, int degrees)
        {
            if (degrees != 3)
            {
                throw new ArgumentException("Only 3 degrees currently supported.", "degrees");
            }
            this.classidx = classidx;
            this.data     = data;
            this.degrees  = degrees;

            var startprops = Helpers.GetProps(typeof(T)).
                             Where((p, i) => {
                if (indexes.Contains(i))
                {
                    if (!InternalHelpers.IsAtt <NominalAttribute>(p))
                    {
                        throw new NotSupportedException("Only [Nominal] attributes (or descendant attributes) can be combined");
                    }
                    return(true);
                }
                return(false);
            }).
                             Select(p => p.Name).
                             ToArray();

            props = GetAdditionalProperties(startprops).ToArray();
            Console.WriteLine("Additional Properties to Add: " + props.Length);
        }
Exemplo n.º 2
0
        private static int GetClassIdx <T>(string classifier)
        {
            var unignored = Helpers.GetProps(typeof(T)).
                            Where(p => !InternalHelpers.IsAtt <IgnoreFeatureAttribute>(p)).
                            Select(p => p.Name).
                            ToArray();

            var idx = Array.IndexOf(unignored, classifier);

            if (idx < 0)
            {
                throw new ArgumentException("classifier: " + classifier + " could not be found");
            }
            return(idx);
        }