funded by   
DependenceViewer
The Dependence Viewer is user control for the visualisation of dependence
between events. A number of the most common events is displayed as buttons
on a panel, the dependence between the events is visualised by blue and
red lines, blue indication positive dependence, red negative dependence,
and thicker lines representing more reliable dependence.
The user can adjust the number of events and their minimum reliability
(chi-square) on trackbars. By selecting an event, more information on the
respective event is shown in the info panel. By select a line between two
events, more information on both events and their connections is shown.
Mor information on the internal calculations in the DependenceViewer
control and its use is provided in the section "Internal
calculations"; the calculation of the data behind the scene is described
in the "significant combinations"
section of the Miner.
Overview
Programming Language
-
Microsoft Visual Basic .Net.
Availability
Constructors
Public Sub New()
Instantiates a new Dependence Viewer.
Parameters
Remarks
-
The DependenceViewer control can be handled like any other user control.
The constructor is automatically called when the control is placed onto
a form in the designer.
-
The DependenceViewer receives its data from a Miner object which is set
by reference using the setMiner() function.
Interfaces
This class does not implement an interface.
Enumerations
The class does not provide enumerations.
Properties
Apart from the properties inherited from System.Windows.Forms.UserControl,
two properties are available:
Public ReadOnly Property MinimumHeight() As
Integer
Gets the minimum height required by the DependenceViewer control.
Property Value
-
the minimum height of the DependenceViewer control.
Remarks
-
This value cannot be changed.
Public ReadOnly Property MinimumWidth() As Integer
Gets the minimum width required by the DependenceViewer control.
Property Value
-
the minimum width of the DependenceViewer control.
Remarks
-
This value cannot be changed.
Methods
Apart from the methods inherited from System.Windows.Forms.UserControl
, the following methods were implemented:
Public Sub getMiner() As Miner
Returns the Miner object associated with the DependenceViewer
.
Return Value
-
the Miner object associated with the DependenceViewer
.
Parameters
Remarks
-
The Miner is set using the setMiner() function.
Because it is passed by reference for performance reasons, the Miner cannot
be implemented as a property.
Public Sub setMiner(ByRef NewMiner As Miner)
Associates a Miner object with the DependenceViewer
.
Return Value
Parameters
-
NewMiner: a reference to the Miner to be associated with the DependenceViewer
.
Remarks
-
The Miner cannot be implemented as a property because it is passed by reference
for performance reasons.
-
The Miner can be retrieved using the getMiner function.
Public Sub calculateNetwork()
Calculates the dependence network with the data obtained from the Miner.
Return Value
Parameter
Remarks
Public Sub circularArrange()
Arranges the events in a circular fashion on the viewing panel.
Return Value
Parameter
Remarks
-
Events are sorted by frequency: the most frequent event is found on top,
the next frequent event follows right (in clockwise direction) to it.
Public Function getBitmap() As Bitmap
Returns a bitmap with the events and their dependence as shown in the viewer.
Return Value
-
a bitmap with the events and their dependence.
Parameter
Remarks
-
Buttons are replaced by ellipses which are sized appropriately in order
to take up the full name of the respective event.
Public Sub setDependenceRange(ByVal Minimum
As Integer, ByVal Maximum As Integer)
Sets the range for the trackbar which is used for adjusting the minimum
value of an event dependence to be displayed.
Return Value
Parameter
-
Minimum: the user-adjustable minimum value for an event dependence.
-
Maximum: the user-adjustable maximum value which an event dependence
must exceed.
Remarks
-
Setting the range does not cause a recalculation and redrawing of the viewer.
Public Sub setEventRange(ByVal Minimum As Integer,
ByVal Maximum As Integer)
Sets the range for the trackbar which is used for adjusting the number
of events to be displayed.
Return Value
Parameter
-
Minimum: the user-adjustable minimum value for the number of events.
-
Maximum: the user-adjustable maximum value for the number of events..
Remarks
-
Setting the range does not cause a recalculation and redrawing of the viewer.
Public Sub setStartEventCount(ByVal NewValue
As Integer)
Sets the number of events to be displayed when the dependence network is
calculated for the first time.
Return Value
Parameter
-
NewValue: the number of events.
Remarks
-
If this function is not used, 5 events will be displayed.
Public Sub setStartDependence(ByVal NewValue
As Double)
Sets the reliability / strength of event dependences to be displayed when
the dependence network is calculated for the first time.
Return Value
Parameter
-
NewValue: the strength of event dependences.
Remarks
-
If this function is not used, 1 is the default value.
-
The parameter used for the strength of an event dependence is the chi-square-value.
Interaction with other classes
Classes using DependenceViewer
The DependenceViewer class is a top level class and not used by other classes
of the Mining library.
Classes used by DependenceViewer
The DependenceViewer relies on the data supplied via the Miner
object.
Interal Calculations
General Use
If you want to use the DependenceViewer in your project, the steps will
typically be:
Calculating the Network
In the Miner object, cases and events are counted and significant
combinations of events are determined.
The private function calculateEventButtons (which also reacts on changing
the trackbar for the number of events) fills the event buttons collection
with the appropriate events. It searches through all events for the next
most frequent event. If such an event was encountered, a button is instantiated
for it which gets tagged with the index of the event. It is placed randomly
onto the dependence panel.
After the calculation of the event buttons, the lines representing the
dependence of two events are determined with the private function calculateDependenceLines.
For every possible combination of two buttons (events), an EventDependence
object is instantiated if the chi-square value meets the minimum value.
The private position calculateDependencePositions calculates for every
EventDependence object the start and end positions of the lines which are
then shown by the refresh function of the viewer (i.e. they are drawn in
pnlView_Paint).
Reacting on the Selection of a Dependence Line
When the user clicks somewhere onto the viewer, the pnlView.MouseUp handler
looks if a line was hit allowing for some deviation. It iterates through
the collection of EventDependences and checks if the point clicked can
be found in the rectangle described by its start and end posotions. If
so, it checks if the angle from the start point to the clicked point coincides
with the angle from the start point to the end point. If so, the private
function EventDependenceClick is called with the respective EventDependence
as a parameter.
The latter function retrieves data on the events from the miner and
shows them on the info panel.
Private Class EventDependence
The EventDependence class is used for the storage of data on a specific
combination of two events. It does not contain an actual business logic.
It is defined by the properties showing both events (their indices) and
the properties showing start and end point of the dependence line, and
finally the strength (chi-square) of the dependence.