14.   DecisionMaker63 Class Library
14.1   DecisionMaker63 Interface
14.2   Input
14.3   Parameters
14.4   Link to Class Library
14.5   DecisionMaker Buttons
14.6   Test Run

14.   DecisionMaker63 Class Library

This chapter introduces the class library, Attrasoft.PolyApplet63.DecisionMaker63, which is the library for the software, Attrasoft DecisionMaker. DecisionMaker operation includes two steps:

We have seen the expanded version of the DecisionMaker in chapter 10 at the Presentation Layer.
The DecisionMaker63 class library is an Application Layer library, which makes the programming much easier.
 

Figure 14.1   The DecisionMaker Form.

14.1   DecisionMaker63 Interface

The DecisionMaker63 class library implements the following interface:

public interface I_DecisionMaker63
 {
  bool openDecisionMakerTrainFile ();
  bool openDecisionMakerRecoFile ();
  bool openOutputFile ();

  bool decisionMakerBinaryLinearPlusReal ();
  bool decisionMakerBinaryLinearPlusInt ();
  bool decisionMakerBinaryLinearMinusReal ();
  bool decisionMakerBinaryLinearMinusInt ();
  bool decisionMakerBinaryLinearZeroReal ();
  bool decisionMakerBinaryLinearZeroInt ();

 }
In addition, the class library has the following properties:
 I/O Files:
  public string DecisionMakerTrainName
  public string DecisionMakerRecoName
  public string OutputName
Presentation Layer parameters:
  public int Precision
  public double Emptyfield
 Neural Layer parameters:
  public int Sensitivity
  public int Blurring
  public int InternalWeightCut


14.2   Input

The Output File code has been implemented and we will just do the input part. We have implemented the Input Files several times before. We will just list the Input File codes below:

 Training file:

  private void button1_Click(object sender, System.EventArgs e)
  {
   if ( openFileDialog1.ShowDialog () != DialogResult.OK )
    return;
   textBox1.Text =  openFileDialog1.FileName  ;
  }
  private void textBox1_TextChanged(object sender, System.EventArgs e)
  {
   z.DecisionMakerTrainName  = textBox1.Text;
richTextBox1.AppendText ("DecisionMaker Input: " + z.DecisionMakerTrainName + "\n");
  }
  private void button2_Click(object sender, System.EventArgs e)
  {
   z.openDecisionMakerTrainFile ();
  }
Recognition file:
private void button13_Click_1(object sender, System.EventArgs e)
  {
   if ( openFileDialog1.ShowDialog () != DialogResult.OK )
    return;
   textBox2.Text =  openFileDialog1.FileName  ;
  }
  private void textBox3_TextChanged(object sender, System.EventArgs e)
  {
   z.DecisionMakerRecoName  = textBox3.Text;
richTextBox1.AppendText ("DecisionMaker Input: " + z.DecisionMakerRecoName  + "\n");
  }
  private void button14_Click(object sender, System.EventArgs e)
  {
   z.openDecisionMakerRecoFile ();
  }
14.3   Parameters

Figure 14.2  The DecisionMaker Parameter Form.

The DecisionMaker has several parameters:

Presentation Layer parameters:

 public int Precision
 public double Emptyfield
Neural Layer parameters:
 public int Sensitivity
 public int Blurring
 public int InternalWeightCut
This section implements the form in Figure 14.2, which will set the DecisionMaker parameters. To set the parameters, double click the �Parameter� button in Figure 14.1 and enter:
private void button5_Click(object sender, System.EventArgs e)
  {
   Form2 paraForm = new Form2 (z );
   paraForm.ShowDialog ();

   richTextBox1.Text =
      "Blurring = " + z.Blurring + "\n" +
       "Sensitivity = " + z.Sensitivity + "\n" +
       "Threshold = " + z.InternalWeightCut + "\n" +
       "Precision = " + z.Precision + "\n" +
       "Empty Field = " + z.Emptyfield + "\n" ;
  }

This will bring up the form in Figure 14.2. The Parameter form will first display the current parameters. Go to the form, Form2, double click the background and enter:
private void Form2_Load(object sender, System.EventArgs e)
  {
   textBox1.Text = "" + a.Blurring ;
   textBox2.Text = "" + a.Sensitivity ;
   textBox3.Text = "" + a.InternalWeightCut ;
   textBox4.Text = "" + a.Precision ;
   textBox5.Text = "" + a.Emptyfield ;
  }
The OK button will set a new set of DecisionMaker parameters. Double click the OK button and enter:
private void button1_Click(object sender, System.EventArgs e)
  {
   try
   {
    a.Blurring = int.Parse (textBox1.Text);
    a.Sensitivity = int.Parse (textBox2.Text );
    a.InternalWeightCut = int.Parse (textBox3.Text );
    a.Precision = int.Parse (textBox4.Text ) ;
    a.Emptyfield = int.Parse (textBox5.Text ) ;
   }
   catch
   {
    MessageBox.Show ("Please enter valid integers", "Entry Error");
   }
   this.Close();

  }

This should set the DecisionMaker parameters.

14.4   Link to Class Library

The class library is:

 Attrasoft.PolyApplet63.DecisionMaker63.
The class in this library will be:
 Attrasoft.PolyApplet63.DecisionMaker63. DecisionMaker63.
To include the class library in the project, To use the class library, add:
using Attrasoft.PolyApplet63.DecisionMaker63;
To declare an object, add:
public Attrasoft.PolyApplet63.DecisionMaker63. DecisionMaker63 z
= new Attrasoft.PolyApplet63.DecisionMaker63. DecisionMaker63 (richTextBox1);
Now DecisionMaker63 object, z, is ready to use.


14.5   DecisionMaker Buttons

There are 6 DecisionMaker commands in Figure 14.1; each button will simply use one of the 6 commands:

private void button7_Click(object sender, System.EventArgs e)
  {
   z.decisionMakerBinaryLinearPlusInt ();
  }
 private void button8_Click(object sender, System.EventArgs e)
  {
   z.decisionMakerBinaryLinearPlusReal ();
  }
 private void button9_Click(object sender, System.EventArgs e)
  {
   z.decisionMakerBinaryLinearMinusInt ();
  }
 private void button10_Click(object sender, System.EventArgs e)
  {
   z.decisionMakerBinaryLinearMinusReal ();
  }
 private void button11_Click(object sender, System.EventArgs e)
  {
   z.decisionMakerBinaryLinearZeroInt ();
  }
 private void button12_Click(object sender, System.EventArgs e)
  {
   z.decisionMakerBinaryLinearZeroReal ();
  }

14.6   Test Run

There are two data files in this chapter project; both data files are from the DecisionMaker software.

Step 1. Files.

The following are done automatically:

DecisionMaker Train:                   cancer1a.txt:
DecisionMaker Recognition:         cancer1b.txt:
Train:                                          example1a.txt
Recognition:                                 example1c.txt
Neural Output:                             example1d.txt
Output:                                        example2c.txt


Step 2. Prediction.

Click �+ Int Linear� button to complete the neural computing.
 

Step 3. Repeat Step 2 for other buttons.

The results should be the same as in chapter 10.
 
 

Return