Пример #1
0
        public bool Save()
        {
            this._trained = true;
            FileInfo f = new FileInfo(this._fullPath);

            this._Name = f.Name.Replace(f.Extension, "");
            for (int i = 0; i < this._idPath.Count; i++)//识别
            {
                var      p     = this._idPath[i];
                FileInfo subf  = new FileInfo(p);
                var      fname = string.Format("id_{0}_{1}", i + 1, subf.Name);
                this.copyfile(p, fname);
                this._idPath[i] = fname;
            }

            for (int i = 0; i < this._fitPath.Count; i++)//拟合
            {
                var      p     = this._fitPath[i];
                FileInfo subf  = new FileInfo(p);
                var      fname = string.Format("fit_{0}_{1}", i + 1, subf.Name);
                this.copyfile(p, fname);
                this._fitPath[i] = fname;
            }

            if (!string.IsNullOrWhiteSpace(this._plsPath))
            {
                FileInfo subff  = new FileInfo(this._plsPath);
                var      fnamee = string.Format("pls_{0}", subff.Name);
                this.copyfile(this._plsPath, fnamee);
                this._plsPath = fnamee;
            }

            if (!string.IsNullOrWhiteSpace(this._itgPath))
            {
                var subff  = new FileInfo(this._itgPath);
                var fnamee = string.Format("itg_{0}", subff.Name);
                this.copyfile(this._itgPath, fnamee);
                this._itgPath = fnamee;
            }

            this._identify = null;
            this._fit      = null;
            this._pls      = null;
            this._itg      = null;

            //删除子文件夹内无关的文件
            var flst = new List <string>();

            flst.AddRange(this._idPath);
            flst.AddRange(this._fitPath);
            flst.Add(this._plsPath);
            flst.Add(this._itgPath);
            DirectoryInfo d      = new DirectoryInfo(Path.Combine(f.DirectoryName, this._Name));
            var           dfiles = d.GetFiles();

            foreach (var df in dfiles)
            {
                if (!flst.Contains(df.Name))
                {
                    df.Delete();
                }
            }
            return(Serialize.Write <BindModel>(this, this._fullPath));
        }
Пример #2
0
 public void Train(SpecBase lib, bool needFilter = true)
 {
     PLSModel model = new PLSModel();
 }