private void RunManual() { ResetGraphs(); ResetOutputFields(); if (chkAllCombinations.Checked) { SearchExhaustiveModelList(); return; } DataTable dt = _projMgr.ModelDataTable; int numVars = lbIndVariables.Items.Count; FitnessCriteria fitnessCrit = GetFitnessCriteria(); MLRIndividual indiv = null; indiv = new MLRIndividual(numVars, numVars, fitnessCrit, _maxVIF, _decisionThreshold, _mandateThreshold); for (int i = 0; i < numVars; i++) indiv.Chromosome[i] = (short)(i + 1); indiv.Evaluate(); _list.Clear(); _list.Add(indiv); btnRun.Text = "Run"; changeControlStatus(true); UpdateFitnessListBox(); return; }
/// <summary> /// Fires when the app opens a project file /// </summary> /// <param name="projMgr"></param> /// public void UnpackState(object objPackedStates) { ModelingInfo formPackedState = (ModelingInfo)objPackedStates; //If either of these are null, then no project to open if (formPackedState == null) return; if (formPackedState.AvailableVariables == null) return; //Unpack the saved state of the PLS modeling control. this.Show(); tabControl1.SelectedTab = tabControl1.TabPages["PLS"]; ipyPLSControl.UnpackProjectState(formPackedState.PlsProject); //Return to the tab that was active when the project was saved. tabControl1.SelectedIndex = formPackedState.ActiveModelingTab; //Console.WriteLine("\n*** Modeling: project opened.***\n"); //Save dependent variable transform if (formPackedState.DependentVariableTransform == Globals.DependentVariableTransforms.none) mlrPredObs1.Transform = Globals.DependentVariableTransforms.none; else if (formPackedState.DependentVariableTransform == Globals.DependentVariableTransforms.Log10) mlrPredObs1.Transform = Globals.DependentVariableTransforms.Log10; else if (formPackedState.DependentVariableTransform == Globals.DependentVariableTransforms.Ln) mlrPredObs1.Transform = Globals.DependentVariableTransforms.Ln; else if (formPackedState.DependentVariableTransform == Globals.DependentVariableTransforms.Power) mlrPredObs1.Transform = Globals.DependentVariableTransforms.Power; _projMgr.Model = formPackedState.Model; //Save available and independent variables lbAvailableVariables.Items.Clear(); for (int i = 0; i < formPackedState.AvailableVariables.Count; i++) lbAvailableVariables.Items.Add(formPackedState.AvailableVariables[i]); lbIndVariables.Items.Clear(); for (int i = 0; i < formPackedState.IndependentVariables.Count; i++) lbIndVariables.Items.Add(formPackedState.IndependentVariables[i]); lblAvailVars.Text = lbAvailableVariables.Items.Count.ToString(); lblDepVars.Text = lbIndVariables.Items.Count.ToString(); //Save the chromosomes if (_list != null) _list.Clear(); else _list = new List<IIndividual>(); _projMgr.ModelDataTable = CreateModelDataTable(); MLRIndividual indiv = null; ModelingInfo modInfo = null; if (formPackedState.Chromosomes != null) { for (int i = 0; i < formPackedState.Chromosomes.Count; i++) { modInfo = formPackedState; int numGenes = formPackedState.Chromosomes[i].Count; indiv = new MLRIndividual(numGenes, modInfo.MaxGeneValue, (FitnessCriteria)modInfo.FitnessCriteria, modInfo.MaxVIF, modInfo.DecisionThreshold, modInfo.MandatedThreshold); indiv.Chromosome = formPackedState.Chromosomes[i]; indiv.Evaluate(); _list.Add((IIndividual)indiv); } UpdateFitnessListBox(); if (formPackedState.SelectedModel > -1 && indiv.Parameters != null) listBox1.SelectedIndex = formPackedState.SelectedModel; } _numObs = _projMgr.CorrelationDataTable.Rows.Count; lblNumObs.Text = "Number of Observations: " + _numObs.ToString(); int maxVar = _numObs / 5; //int recVar = Math.Min(((_numObs / 10) + 1), availVar); int recVar = Math.Min(((_numObs / 10) + 1), (lbIndVariables.Items.Count)); lblMaxAndRecommended.Text = "Recommended: " + recVar.ToString() + ", Max: " + maxVar.ToString(); txtMaxVars.Text = recVar.ToString(); this.Show(); if (listBox1.Items.Count < 1 && ipyPLSControl.VirginState == true) { _projMgr._comms.sendMessage("Hide", this); } }