Esempio n. 1
0
        private async void trackbar_ValueChanged(object sender, EventArgs e)
        {
            var trackBar = sender as DensityTrackbar;

            if (trackBar == null)
            {
                return;
            }
            sharedFixedVariables.SetVariableValue((double)trackBar.Value, variableNames[trackbars.IndexOf(trackBar)], 0);
            await _partialDependencePlot.RecalculateAsync();
        }
        void UpdateCursor()
        {
            var x = VerticalLineAnnotation.X;

            sharedFixedVariables.SetVariableValue(x, FreeVariable, 0);

            if (ShowCursor)
            {
                chart.Titles[0].Text = FreeVariable + " : " + x.ToString("N3", CultureInfo.CurrentCulture);
                chart.Update();
            }

            OnVariableValueChanged(this, EventArgs.Empty);
        }
Esempio n. 3
0
        private void SampleTrainingData(MersenneTwister rand, ModifiableDataset ds, int rRows,
                                        IDataset sourceDs, double[] curTarget, string targetVarName, IEnumerable <int> trainingIndices)
        {
            var selectedRows = trainingIndices.SampleRandomWithoutRepetition(rand, rRows).ToArray();
            int t            = 0;

            object[] srcRow   = new object[ds.Columns];
            var      varNames = ds.DoubleVariables.ToArray();

            foreach (var r in selectedRows)
            {
                // take all values from the original dataset
                for (int c = 0; c < srcRow.Length; c++)
                {
                    var col = sourceDs.GetReadOnlyDoubleValues(varNames[c]);
                    srcRow[c] = col[r];
                }
                ds.ReplaceRow(t, srcRow);
                // but use the updated target values
                ds.SetVariableValue(curTarget[r], targetVarName, t);
                t++;
            }
        }
Esempio n. 4
0
 private void UpdateSelectedValue(string variableValue)
 {
     sharedFixedVariables.SetVariableValue(variableValue, FreeVariable, 0);
     OnVariableValueChanged(this, EventArgs.Empty);
 }
 private void SampleTrainingData(MersenneTwister rand, ModifiableDataset ds, int rRows,
   IDataset sourceDs, double[] curTarget, string targetVarName, IEnumerable<int> trainingIndices) {
   var selectedRows = trainingIndices.SampleRandomWithoutRepetition(rand, rRows).ToArray();
   int t = 0;
   object[] srcRow = new object[ds.Columns];
   var varNames = ds.DoubleVariables.ToArray();
   foreach (var r in selectedRows) {
     // take all values from the original dataset
     for (int c = 0; c < srcRow.Length; c++) {
       var col = sourceDs.GetReadOnlyDoubleValues(varNames[c]);
       srcRow[c] = col[r];
     }
     ds.ReplaceRow(t, srcRow);
     // but use the updated target values
     ds.SetVariableValue(curTarget[r], targetVarName, t);
     t++;
   }
 }