14. DecisionMaker63 Class Library14.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.
- Specify two Input Files
- Click a button
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_DecisionMaker63In addition, the class library has the following properties:
{bool openDecisionMakerTrainFile ();}
bool openDecisionMakerRecoFile ();
bool openOutputFile ();bool decisionMakerBinaryLinearPlusReal ();
bool decisionMakerBinaryLinearPlusInt ();
bool decisionMakerBinaryLinearMinusReal ();
bool decisionMakerBinaryLinearMinusInt ();
bool decisionMakerBinaryLinearZeroReal ();
bool decisionMakerBinaryLinearZeroInt ();I/O Files:public string DecisionMakerTrainNamePresentation Layer parameters:
public string DecisionMakerRecoName
public string OutputNamepublic int PrecisionNeural Layer parameters:
public double Emptyfieldpublic int Sensitivity
public int Blurring
public int InternalWeightCutThe 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)Recognition file:{private void textBox1_TextChanged(object sender, System.EventArgs e)
if ( openFileDialog1.ShowDialog () != DialogResult.OK )
return;
textBox1.Text = openFileDialog1.FileName ;
}{private void button2_Click(object sender, System.EventArgs e)
z.DecisionMakerTrainName = textBox1.Text;
richTextBox1.AppendText ("DecisionMaker Input: " + z.DecisionMakerTrainName + "\n");
}{
z.openDecisionMakerTrainFile ();
}private void button13_Click_1(object sender, System.EventArgs e)14.3 Parameters{private void textBox3_TextChanged(object sender, System.EventArgs e)
if ( openFileDialog1.ShowDialog () != DialogResult.OK )
return;
textBox2.Text = openFileDialog1.FileName ;
}{private void button14_Click(object sender, System.EventArgs e)
z.DecisionMakerRecoName = textBox3.Text;
richTextBox1.AppendText ("DecisionMaker Input: " + z.DecisionMakerRecoName + "\n");
}{
z.openDecisionMakerRecoFile ();
}
Figure 14.2 The DecisionMaker Parameter Form.
The DecisionMaker has several parameters:
Presentation Layer parameters:
public int PrecisionNeural Layer parameters:
public double Emptyfieldpublic int SensitivityThis 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:
public int Blurring
public int InternalWeightCutprivate void button5_Click(object sender, System.EventArgs e)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:{
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" ;
}private void Form2_Load(object sender, System.EventArgs e)The OK button will set a new set of DecisionMaker parameters. Double click the OK button and enter:{
textBox1.Text = "" + a.Blurring ;
textBox2.Text = "" + a.Sensitivity ;
textBox3.Text = "" + a.InternalWeightCut ;
textBox4.Text = "" + a.Precision ;
textBox5.Text = "" + a.Emptyfield ;
}private void button1_Click(object sender, System.EventArgs e)This should set the DecisionMaker parameters.{
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();}
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:
- In the Solution Explorer, right click References and select Add Reference;
- Browse to find �DecisionMaker63.dll� in c:\polyapplet63\;
- Highlight it and click the �OK� button.
using Attrasoft.PolyApplet63.DecisionMaker63;To declare an object, add:public Attrasoft.PolyApplet63.DecisionMaker63. DecisionMaker63 zNow DecisionMaker63 object, z, is ready to use.
= new Attrasoft.PolyApplet63.DecisionMaker63. DecisionMaker63 (richTextBox1);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){private void button8_Click(object sender, System.EventArgs e)
z.decisionMakerBinaryLinearPlusInt ();
}{private void button9_Click(object sender, System.EventArgs e)
z.decisionMakerBinaryLinearPlusReal ();
}{private void button10_Click(object sender, System.EventArgs e)
z.decisionMakerBinaryLinearMinusInt ();
}{private void button11_Click(object sender, System.EventArgs e)
z.decisionMakerBinaryLinearMinusReal ();
}{private void button12_Click(object sender, System.EventArgs e)
z.decisionMakerBinaryLinearZeroInt ();
}{
z.decisionMakerBinaryLinearZeroReal ();
}
14.6 Test RunThere 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