Click or drag to resize
sqx

SQXMutualInformationMatrix Method

Procedure MutualInformationMatrix [nvarchar](max) @Query, [bit] @SnapShot, [Matrix] @MIMatrix OUTPUT

Namespace:  sqx
Assembly:  SQX (in SQX.dll) Version: 1.0.2.6 (1.0.2.6)
Syntax
C#
public static int MutualInformationMatrix(
	SqlChars Query,
	SqlBoolean SnapShot,
	SqlInt32 Round,
	out Matrix MIMatrix
)

Parameters

Query
Type: System.Data.SqlTypesSqlChars
[nvarchar](max)
SnapShot
Type: System.Data.SqlTypesSqlBoolean
[bit] 0 Read Commited | 1 SnapShot
Round
Type: System.Data.SqlTypesSqlInt32
[int] Default use NULL
MIMatrix
Type: sqxMatrix
[Matrix] Output

Return Value

Type: Int32
[int] 0 success | -1 failure
Remarks
High performance Discrete Mutual Information Matrix procedure.
It can compute Mutual Information Matrix up to Observed plus 91 Columns.

NOTE: Observed [0|1] must be the first column in the query.
NOTE: Query must return a dataset with only Observed and the matrix columns with numeric data type.
NOTE: CTE not available in @Query parameter.
NOTE: Mutual Information Matrix is Memory Intensive (Manage Memory).
Examples
SQL
declare @Query nvarchar(max) = N'
select sqx.BernoulliD_PPF(a.Value, 0.8) Observed
, b.Value [1], c.Value [2], d.Value [3]
from sqx.UTable(100,1) a
inner join sqx.VectorTable(sqx.RandomVector(100,2)) b ON a.ID = b.ID
inner join sqx.VectorTable(sqx.RandomVector(100,3)) c ON a.ID = c.ID
inner join sqx.VectorTable(sqx.RandomVector(100,4)) d ON a.ID = d.ID
'
declare @MI sqx.Matrix
exec sqx.MutualInformationMatrix @Query = @Query
    , @SnapShot = 0, @Round = 2, @MIMatrix = @MI OUTPUT
exec sqx.MatrixToTable @MI
/*
ID          1                      2                      3
----------- ---------------------- ---------------------- ----------------------
1           0.187548875021635      0.379741684510371      0.370195500086539
2           0.379741684510371      0.192192809488736      0.37483943455364
3           0.370195500086539      0.37483943455364       0.182646625064904*/
See Also