Example #1
0
        //Main Contructor
        public DataSet(
            IDataContext data_context,
            IList <FeatureType[]> feature_data,
            IList <bool[]> missing_data,
            IList <LabelType[]> label_data)
        {
            if (data_context == null)
            {
                throw new NullReferenceException();
            }
            if (feature_data == null)
            {
                throw new NullReferenceException();
            }
            if (missing_data == null)
            {
                throw new NullReferenceException();
            }
            if (label_data == null)
            {
                throw new NullReferenceException();
            }

            if (ToolsCollection.IsStaggered(feature_data))
            {
                throw new Exception("Does not accept staggered feature data");
            }

            if (ToolsCollection.IsStaggered(missing_data))
            {
                throw new Exception("Does not accept staggered missing data");
            }
            //TODO check that feature_data is of equal size as missing data
            if (ToolsCollection.IsStaggered(label_data))
            {
                throw new Exception("Does not accept staggered label data");
            }

            if (!ToolsCollection.AreEqualSize(feature_data, missing_data))
            {
                throw new Exception("Must have missing data for every feature");
            }

            if (feature_data.Count != label_data.Count)
            {
                throw new Exception("Feature and label instances must be equal");
            }

            this.DataContext  = data_context;
            this.feature_data = ToolsCollection.ConvertToArrayArray(feature_data);
            this.missing_data = ToolsCollection.ConvertToArrayArray(missing_data);
            this.label_data   = ToolsCollection.ConvertToArrayArray(label_data);
        }