Exemple #1
0
        public Datasets(CommonParameters cp, DatasetParameters dp, DataSparse trainData, DataSparse validData)
        {
            Common  = cp;
            Dataset = dp;

            Training = LoadTrainingData(trainData);
            if (validData != null)
            {
                Validation = LoadValidationData(Training, validData);
            }
        }
Exemple #2
0
        private Dataset LoadTrainingData(DataSparse trainData)
        {
            if (trainData == null)
            {
                throw new ArgumentNullException(nameof(trainData));
            }
            trainData.Validate();

            // TODO: not parallelised, better off to concat data and pass in as a single matrix?
            Dataset dtrain = CreateDatasetFromSamplingData(trainData, Common, Dataset);

            return(dtrain);
        }
Exemple #3
0
        /// <summary>
        /// Create a dataset from the sampling data.
        /// </summary>
        private Dataset CreateDatasetFromSamplingData(DataSparse data,
                                                      CommonParameters cp,
                                                      DatasetParameters dp)
        {
            var dataset = new Dataset(data.Features
                                      , data.NumColumns
                                      , cp
                                      , dp
                                      , data.Labels
                                      , data.Weights
                                      , data.Groups
                                      );

            return(dataset);
        }
Exemple #4
0
        private Dataset LoadValidationData(Dataset dtrain, DataSparse validData)
        {
            if (validData == null)
            {
                throw new ArgumentNullException(nameof(validData));
            }
            validData.Validate();

            var dvalid = new Dataset(validData.Features
                                     , validData.NumColumns
                                     , Common
                                     , Dataset
                                     , validData.Labels
                                     , validData.Weights
                                     , validData.Groups
                                     , dtrain
                                     );

            return(dvalid);
        }