예제 #1
0
파일: InputForm.cs 프로젝트: NadaElawad/OCR
        private void trainButton_Click(object sender, EventArgs e)
        {
            if (IsDataComplete() == false)
            {
                return;
            }

            if (activationFunctionCmbx.SelectedItem.ToString() == "Sigmoid")
            {
                TransferFunction.slope = Double.Parse(valATxt.Text);
            }

            PrinicpleComponentAnalysis PCA = null;

            if (pcaCheckBox.Checked == true)
            {
                int              num_Components   = Int32.Parse(numPCTxtBox.Text);
                double           pcaAlpha         = Double.Parse(pcaAlphaTxtBox.Text);
                TransferFunction transferFunction = new TransferFunction(TransferFunction.Type.Linear);
                PCA = new PrinicpleComponentAnalysis(pcaAlpha, transferFunction, num_Components);
            }
            Train(PCA);
            EvaluateClassifier(PCA);
            output = new OutputForm(this);
            output.Show();
        }
예제 #2
0
        public PrinicpleComponentAnalysis(double alpha, TransferFunction transferFunction, int num_Components)
        {
            this.alpha            = alpha;
            this.num_Components   = num_Components;
            this.transferFunction = transferFunction;
            this.layers           = new Layer[2];

            layers[0] = new Layer(30 * 30, 0);
            layers[1] = new Layer(num_Components, 30 * 30);
        }
예제 #3
0
파일: InputForm.cs 프로젝트: NadaElawad/OCR
 private void activationFunctionCmbx_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (activationFunctionCmbx.SelectedItem.ToString() == "Tanh")
     {
         valALbl.Hide();
         valATxt.Hide();
         mainTransferFunction = new TransferFunction(TransferFunction.Type.Hyperbolic);
     }
     else
     {
         valALbl.Show();
         valATxt.Show();
         mainTransferFunction = new TransferFunction(TransferFunction.Type.Sigmoid);
     }
 }
예제 #4
0
        public MultiLayerPerceptron(int[] layers, double alpha, TransferFunction transferFunction)
        {
            this.alpha            = alpha;
            this.transferFunction = transferFunction;

            this.layers = new Layer[layers.Length];

            for (int i = 0; i < layers.Length; i++)
            {
                if (i == 0)
                {
                    this.layers[i] = new Layer(layers[i], 0);
                }
                else
                {
                    this.layers[i] = new Layer(layers[i], layers[i - 1]);
                }
            }
        }
예제 #5
0
 public OCR(int[] layers, int num_Classes, double alpha, double threshold, TransferFunction transferFunction)
 {
     this.threshold   = threshold;
     this.num_Classes = num_Classes;
     MLP = new MultiLayerPerceptron(layers, alpha, transferFunction);
 }