private static TrainingResults LoadCompressed(string path)
        {
            log.Debug("LoadNormal: {0}", path);
            TrainingHeader header  = null;
            Model          model   = null;
            IArffDataSet   dataSet = null;

            using (ZipArchive archive = ZipFile.OpenRead(path))
            {
                foreach (ZipArchiveEntry entry in archive.Entries)
                {
                    if (entry.FullName.EndsWith(headerFile, StringComparison.OrdinalIgnoreCase))
                    {
                        header = XDocument.Load(entry.Open()).XmlDeserialize <TrainingHeader>();
                    }
                    else if (entry.FullName.EndsWith(modelFile, StringComparison.OrdinalIgnoreCase))
                    {
                        model = Model.Read(entry.Open());
                    }
                    else if (entry.FullName.EndsWith(arffFile, StringComparison.OrdinalIgnoreCase))
                    {
                        using (StreamReader reader = new StreamReader(entry.Open()))
                        {
                            dataSet = ArffDataSet.LoadSimple(reader);
                        }
                    }
                }
            }

            return(new TrainingResults(model, header, dataSet));
        }
Пример #2
0
 public TrainingResults(Model model, TrainingHeader header, IArffDataSet dataSet)
 {
     Guard.NotNull(() => model, model);
     Guard.NotNull(() => header, header);
     Guard.NotNull(() => dataSet, dataSet);
     Model   = model;
     Header  = header;
     DataSet = dataSet;
 }
        public static TrainingHeader Create(KernelType type, SvmType svmType)
        {
            TrainingHeader header = new TrainingHeader();

            header.GridSelection = true;
            header.Normalization = NormalizationType.None;
            header.Kernel        = type;
            header.SvmType       = svmType;
            return(header);
        }
 public TrainingModel(TrainingHeader header)
 {
     Header = header;
 }