Bullseye: C# Class Final Project

This was a group final project, involving myself along with 5 other team members. It combined c#.net programming along with ADO.net database operations as well as extensive GUI work and neural work. The goal of the program is to display data from databases, as circular bullseyes, in a way as to highlight which sets of data are best within the given database. The goal is to train you to be able to just look at the different circles to tell what is best. The program allows you to select your top 3 based on the criteria you’ve selected and then it runs its neural net to predict its best guess. Then the actual best results are shown. My part in this project was to integrate the neural network and use the database functions to pull data into the neural net and have the NN make its prediction.

Project Bulls Eye

Code can be downloaded here:
Executable can be downloaded here:

Program Useage:

  1. Run GUITrial.exe from the extracted bin/debug folder
  2. This version if mean to work with the given cars data base. Decide which factors you want to rank as LittleGood or BigGood, i.e. check prices for low price being good.
  3. Click The Neural Net –> Run option from the Menu Bar.
  4. Click the buttons in the specified order.
    1. Load Database — > Microsoft 4.0 Jet OLE DB Provider
    2. Locate the car.mbd using the … browse button, click okay
    3. Choose which table to use — >click 2. Load Table
    4. Click Update — > in the input nodes table, table 4.0, just single click one entry, this is to populate the simulation data, do not change or add any parameters here.
    5. Now you can go to 6 and change NN options if you want, but by default it is set the optimal design as we’ve found.
    6. Click Train Network
    7. Click Fill, then run simulation
    8. Observe the results
    9. Click Done
  5. Now make a selection for what your best guess is, you will be deemed a “winner” if you manage to select any of the top 3 items.
  6. Click Rank, the top 3 choices will be displayed as well as if you guessed correctly or not.
  7. End.


Specifications:

This is the specification as given to the class.

  1. Design and implement a control to be called a BullsEye, which presents to the user a square containing a set of concentric rings around a central hub. Each ring is shown in a unique color and each ring is either thick or thin. The control must allow for a total of at least ten rings around the hub, representing at least 11 data factors. The hub may display either a number of 2 or 3 letters within, using an appropriate font and contrasting color.
  1. Note that the window around the control will of necessity be slightly rectangular in order to exactly fir around the square with a caption bar at top. The caption is removable, of course, but probably suits the GUI.
  1. Each ring will be bordered with a fine black or gray line.
  1. Circles should draw out-in or in-out, but the best fill has been observed with out-in.
  1. Each ring of the BullsEye control may be thick or think, where, “thick” is approximately twice as thick as “thin”.
  1. More than one ring may fit on a primary form or “view”. Typically, a window will contain ten or twelve and up to 36 bull’s-eyes. Remember a bullseye is a nearly square rectangle.
  1. Each bull’s-eye represents an item to be compared – a baseball team, a student, a stock; the array of visible rectangles is a display of the properties of the various teams, students, stocks. The hubs are common to all items, but whether or not a ring of a given color appears around the hub depends on the strength of the score for that item. A given measure may have a best, a second best, and third best displayed. However if there are fewer than six comparables, then only the first and second best are represented.
  1. Thus in constructing BullsEye objects on a large view, you should think of each competing entity as a bull’s—eye, and each variable or metric as a ring n a bulls-eye. As an example, think of students as the entities and all the students’ scores as rings. If a student is first, second, or third in an exam, that student will get a ring; if the student is first(best) then that student will get a wide or fat ring. If the student is second or third, the ring will be narrow. There are only three thicknesses, wide, narrow, and none.
  1. A routine to handle ordering any group of data high-low or low-high and providing ordinal values for each data item must be written, called “Mord.”
  1. The user should provide database and control information for the construction of the rings. From the database, the user will select a table. From a table, the user selects:
    1. Which fields are used as comparable measures;
    2. What color the field will be represented by (with simple defaults in case the user doesn’t care);
    3. Whether each data item being displayed is GoodBig or GoodLittle, whether the strongest performance if the numerically lowest score or vice-versa.
    4. What the hub should be (non comparable)
    5. What identifier should display below or in the caption of the bull’s—eye to designate the student or other comparable;
    6. What the reality vector is (the predicted result or goal), see below;
    7. Finally which data rows in the table are to be displayed.
  1. That there are few rings means most of the area of the square is vacant. As an example, one student might have a white hub, a thick red ring, and a thin green ring – and nothing else! This bull’s—eye will be small; another may have seven or even ten rings and be a large bull’s eye. All thick rings are about the same size in the various BullsEye controls.
  1. The view (that holds numerous bull’s–eye) must resize itself with the frame. The circles must look circular. Half rings must look less than whole rings. Take care to adjust the size of the font used for inside the hub. Provide for thirty-six bull’s—eyes and 40 variables (MAX). You must allow ten or more rings.
  1. Now the clicking game:
    1. Once a set of student’s is displayed, the user can click to designate their best choice, which will be designated in some visual manner.
    2. Then the neural net or your own predictor will pick its best one, best two, best three in order—whatever the agreed clicking rule is. These will be marked the selections of the NN.
    3. Then when you click one more time on a specified button or locus, the reality vector will kick in, the actual placement of the one, the two, the three in order, etc. This means that there must be a reality vector among the data columns.
    4. This teaches the user!
  1. The neural net may be a modest neural net in C++ translated into C# or used in its original C++ form if it is on a C++ dll that “allows managed extentions.” If you can figure out a bridge to java or j++ or Visual Basic, all of these are acceptable as well. Everything but the neural net must be C#.
  1. Delivery last day of class.

Documentation:

Complete documentation can be downloaded here:
This is an excerpt of what is relevant for a base overview:

8.0 Design

8.1 Introduction
Our objective is to provide users with the BullsEye program. It is designed to have a little learning curve on the interface, and enjoy our application.
The application will have an interface for users to interact with, and will have a function to draw rings as a result of the user and the Neural Net choices. The rings are dependent upon the user’s choice and neural net’s choice from the database which the user used. The database is provided by the user.

8.2 Mord
Mord is a wrapper function which retrieves the first index (representing the first column in the database and the first entry of the array in the BullsEye class) of all the BullsEye and enters those values into an array which then gets morded. This happens for all the categories being compared. The Mord results are stored in the respective Ring[] array in the BullsEye object, which are then referenced in the GUI.

8.3 Neural Net
In essence, the Neural Net (NN) reads in the database, and by basing on all of the inputs in the table besides the model name, it tries to find a function that given those inputs will return the expected output. We train our data on one of the sub databases. For example, we run a database based on family cars and we run it on another database and see how it copes with this data. If it has been trained correctly we should get a correct result and be able to rank vehicles from other data bases to figure out of those given which are the top 3. Our NN is using a setup of 2 layers with 4 neurons each, with a training period of 6000 cycles.
.

8.4 Multithreading
We use the separate threads to perform the Neural Net and mord procedures. This is done by creating the thread object, passing in the method via a ThreadStart delegate. After this is done, we start the thread and it runs for its respected duration. Synchronization primitives are not required for this since our methods will only read instead of write from the database and thus allowing safe concurrency. The code was created from the tutorial given at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcoricsharptutorials.asp

8.5 Basic Program Cycle

As seen in the diagram above (Figure 1), opening up the BullsEye program by the user brings up a control panel of options and will load a database into the program. Then, the user picks the best three while the Neural Net, trained by developers, will also pick their best three which will be displayed on the ring as shown below in Figure 2. While the main function of the program is to display a correct bullseye rings on the screen, other functions will help the user to interact with the program even more. Such called GUI interfaces will be described in Section 9.
.
Figure 2. Program displaying rings on the screen

.

Figure 3. A flow diagram describing the forms and method layouts for different functions

The program will have functions and is built under the flow chart described in figure 3. Functions of the program strictly follows the chart. The chart above are specifically for developers who are looking into further enhance the program in the future.

9.0 GUI Interface

9.1 Basic Guide
When the program loads, a dialog will pop up, and the user could decide which way the category is morded.

.

To choose which BullsEyes are displayed go to Control -> View/Change Bullseye List.
. .
To decide which categories are displayed, go to Control -> View/Change Variable List.
. .

To change the ring colors of categories, go to Control -> View/Change Color Scheme.
. .

In Options -> User Choice, the user can pick the preference on how they choose their BullsEye (more than one can be selected).

Toggle Border:
. .

Toggle Text:
. .

Toggle Crosshairs:
. .

In Options -> Ring Choice, the user can pick how the BullsEyes are being displayed (rings, squares, and stars).

.

.

..

Citations:

All code is original with the exceptions as listed in the complete documentation in regards to multithreading, as well as the Neural Net Code.
The Neural Net code was taken from / heavily modified from an open source NN library known as DANNU.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: