Example #1
0
        private VBProjectManager()
        {
            ProjectSaved += new VBProjectManager.ProjectSavedHandler <PackEventArgs>(ProjectSavedListener);

            String strPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);

            _cachePath = strPath + "\\cache";

            _siteInfo             = null;
            _comms                = new VBComm();
            Model                 = new Dictionary <string, double>();
            _modelingInfo         = new ModelingInfo();
            _residualAnalysisInfo = new ResidualAnalysisInfo();
            _predInfo             = new PredInfo();
            _datasheetInfo        = new DataSheetInfo();
            _tabStates            = new TabStates();

            _graph = new object[7];
        }
Example #2
0
        /// <summary>
        /// Fires when the app saves a project file
        /// </summary>
        /// <param name="projMgr"></param>
        private void ProjectSavedListener(object sender, PackEventArgs e)
        {
            ModelingInfo localModelingInfo = new ModelingInfo();

            //Not really much to save if no models were generated
            if (((_list == null) || (_list.Count < 1)) && ipyPLSControl.VirginState == true)
                return;

            //if (_projMgr.ModelingInfo == null)
            //    _projMgr.ModelingInfo = new ModelingInfo();

            //if the datasheet is dirty, don't want to save modeling data
            if (!_projMgr.DataSheetInfo.Clean) return;

            //Get the state of the IronPython-based modeling methods
            localModelingInfo.PlsProject = ipyPLSControl.PackProjectState();
            localModelingInfo.ActiveModelingTab = tabControl1.SelectedIndex;

            localModelingInfo.Model = _projMgr.Model;

            localModelingInfo.DependentVariable = _projMgr.ModelDataTable.Columns[1].ColumnName;

            //Save dependent variable transform
            if (rbValMET.Checked)
                localModelingInfo.DependentVariableTransform = Globals.DependentVariableTransforms.none;
            else if (rbLog10ValMET.Checked)
                localModelingInfo.DependentVariableTransform = Globals.DependentVariableTransforms.Log10;
            else if (rbLogeValMET.Checked)
                localModelingInfo.DependentVariableTransform = Globals.DependentVariableTransforms.Ln;
            else if (rbPwrValMET.Checked)
            {
                localModelingInfo.DependentVariableTransform = Globals.DependentVariableTransforms.Power;
                localModelingInfo.PowerTransformExponent = Convert.ToDouble(txtPwrValMET.Text);
            }
            //Save available and independent variables
             localModelingInfo.AvailableVariables = new List<ListItem>();
            for (int i = 0; i < lbAvailableVariables.Items.Count; i++)
                localModelingInfo.AvailableVariables.Add((ListItem)lbAvailableVariables.Items[i]);

            localModelingInfo.IndependentVariables = new List<ListItem>();
            for (int i = 0; i < lbIndVariables.Items.Count; i++)
                localModelingInfo.IndependentVariables.Add((ListItem)lbIndVariables.Items[i]);

            //Save the chromosomes
            if (listBox1.Items.Count > 0)
            {
                localModelingInfo.Chromosomes = new List<List<short>>();
                for (int i = 0; i < _list.Count; i++)
                    localModelingInfo.Chromosomes.Add(_list[i].Chromosome);

                MLRIndividual indiv = _list[0] as MLRIndividual;
                localModelingInfo.DecisionThreshold = indiv.DecisionThreshold;
                localModelingInfo.MandatedThreshold = indiv.MandatedThreshold;
                localModelingInfo.FitnessCriteria = (int)indiv.FitnessCriteria;
                localModelingInfo.MaxGeneValue = indiv.MaxGeneValue;
                localModelingInfo.MaxVIF = indiv.MaxVIF;
                localModelingInfo.NumGenes = indiv.NumGenes;
                localModelingInfo.Accuracy = indiv.Accuracy;
                localModelingInfo.AdjustedR2 = indiv.AdjustedR2;
                localModelingInfo.AIC = indiv.AIC;
                localModelingInfo.AICC = indiv.AICC;
                localModelingInfo.BIC = indiv.BIC;
                localModelingInfo.Press = indiv.Press;
                localModelingInfo.R2 = indiv.R2;
                localModelingInfo.RMSE = indiv.RMSE;
                localModelingInfo.Sensitivity = indiv.Sensitivity;
                localModelingInfo.Specificity = indiv.Specificity;
                localModelingInfo.VIF = indiv.VIF;

                localModelingInfo.SelectedModel = _selectedModelIndex;
            }
            else
            {
                localModelingInfo.Chromosomes = null;
            }

            if (_state == _mlrState.clean)
            {
                _projMgr.TabStates.TabState["Residuals"] = true;
                _projMgr.TabStates.TabState["Prediction"] = true;
            }
            else
            {
                _projMgr.TabStates.TabState["Residuals"] = false;
                _projMgr.TabStates.TabState["Prediction"] = false;
            }
            e.DictPacked.Add("frmModel", localModelingInfo);
        }
Example #3
0
        private VBProjectManager()
        {
            ProjectSaved += new VBProjectManager.ProjectSavedHandler<PackEventArgs>(ProjectSavedListener);

            String strPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
            _cachePath = strPath + "\\cache";

            _siteInfo = null;
            _comms = new VBComm();
            Model = new Dictionary<string, double>();
            _modelingInfo = new ModelingInfo();
            _residualAnalysisInfo = new ResidualAnalysisInfo();
            _predInfo = new PredInfo();
            _datasheetInfo = new DataSheetInfo();
            _tabStates = new TabStates();

            _graph = new object[7];
        }