예제 #1
0
        private void btnEstimateSig_Click(object sender, EventArgs e)
        {
            double[,] sourceMatrix;
            double[,] inputs;
            int[] labels;
            getData(out sourceMatrix, out inputs, out labels);
            DoubleRange range;

            var g = Sigmoid.Estimate(inputs.ToArray(), labels.Length, out range);

            numSigAlpha.Value = (decimal)g.Alpha;
            numSigB.Value     = (decimal)g.Constant;
        }
예제 #2
0
        private void buttonEstimate_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(this, "This action will first save the configuration. Do you wish to Continue?", "Save required", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (save())
                {
                    double[,] sourceMatrix = _model.FeatureTable.ToMatrix <double>(_activeFeatures.ToArray());
                    double[][]  inputs = sourceMatrix.ToArray();
                    DoubleRange range;

                    if (groupGaussianKernel.Enabled)
                    {
                        Gaussian gaussian = Gaussian.Estimate(inputs, inputs.Length, out range);
                        tbGaussianSigma.Value = (decimal)gaussian.Sigma;
                    }

                    if (groupPolyKernel.Enabled)
                    {
                    }

                    if (groupSigmoidKernel.Enabled)
                    {
                        Sigmoid sigmoid = Sigmoid.Estimate(inputs, inputs.Length, out range);

                        if (sigmoid.Alpha < (double)Decimal.MaxValue && sigmoid.Alpha > (double)Decimal.MinValue)
                        {
                            tbSigmoidAlpha.Value = (decimal)sigmoid.Alpha;
                        }

                        if (sigmoid.Constant < (double)Decimal.MaxValue && sigmoid.Constant > (double)Decimal.MinValue)
                        {
                            tbSigmoidConst.Value = (decimal)sigmoid.Constant;
                        }
                    }

                    if (groupLaplacianKernel.Enabled)
                    {
                        Laplacian laplacian = Laplacian.Estimate(inputs, inputs.Length, out range);
                        tbLaplacianSigma.Value = (decimal)laplacian.Sigma;
                    }
                }
                else
                {
                    MessageBox.Show("Failed to fully save the configuration.\nTherefore configuration properties can not be estimated.");
                }
            }
        }
예제 #3
0
        private void setKernalType(KernelType k)
        {
            switch (k)
            {
            case KernelType.Linear:
                kernel = new Linear();
                break;

            case KernelType.Quadratic:
                kernel = new Quadratic();
                break;

            case KernelType.Sigmoid:
                kernel = Sigmoid.Estimate(independentVls);
                break;

            case KernelType.Spline:
                kernel = new Spline();
                break;

            case KernelType.ChiSquared:
                kernel = new ChiSquare();
                break;

            case KernelType.Gaussian:
                kernel = Gaussian.Estimate(independentVls);
                break;

            case KernelType.Multiquadric:
                kernel = new Multiquadric();
                break;

            case KernelType.InverseMultquadric:
                kernel = new InverseMultiquadric();
                break;

            case KernelType.Laplacian:
                kernel = Laplacian.Estimate(independentVls);
                break;

            default:
                kernel = new Polynomial(2);
                break;
            }
        }
예제 #4
0
        private void btnEstimateSig_Click(object sender, EventArgs e)
        {
            // Get only the input vector values (in the first two columns)
            double[][] inputs = ConvertDataTableToMatrix(TrainingData.Tables["InterestedTrainingDataValues"]);

            DoubleRange range; // valid range will be returned as an out parameter
            var         sigmoid = Sigmoid.Estimate(inputs, inputs.Length, out range);

            if (sigmoid.Alpha < (double)Decimal.MaxValue && sigmoid.Alpha > (double)Decimal.MinValue)
            {
                numSigAlpha.Value = (decimal)sigmoid.Alpha;
            }

            if (sigmoid.Constant < (double)Decimal.MaxValue && sigmoid.Constant > (double)Decimal.MinValue)
            {
                numSigB.Value = (decimal)sigmoid.Constant;
            }
        }
예제 #5
0
        private void btnEstimateSigmoid_Click(object sender, EventArgs e)
        {
            DataTable source = dgvLearningSource.DataSource as DataTable;

            // Creates a matrix from the source data table
            double[,] sourceMatrix = source.ToMatrix(out columnNames);

            // Get only the input vector values (in the first two columns)
            double[][] inputs = sourceMatrix.GetColumns(0, 1).ToArray();

            DoubleRange range; // valid range will be returned as an out parameter
            var         sigmoid = Sigmoid.Estimate(inputs, inputs.Length, out range);

            if (sigmoid.Alpha < (double)Decimal.MaxValue && sigmoid.Alpha > (double)Decimal.MinValue)
            {
                numSigAlpha.Value = (decimal)sigmoid.Alpha;
            }

            if (sigmoid.Constant < (double)Decimal.MaxValue && sigmoid.Constant > (double)Decimal.MinValue)
            {
                numSigB.Value = (decimal)sigmoid.Constant;
            }
        }