<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.bci2000.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Programming_Reference%3ATrialStatistics_Class</id>
	<title>Programming Reference:TrialStatistics Class - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.bci2000.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Programming_Reference%3ATrialStatistics_Class"/>
	<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:TrialStatistics_Class&amp;action=history"/>
	<updated>2026-06-23T04:34:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:TrialStatistics_Class&amp;diff=4112&amp;oldid=prev</id>
		<title>Mellinger: /* Location */</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:TrialStatistics_Class&amp;diff=4112&amp;oldid=prev"/>
		<updated>2008-08-19T12:52:03Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Location&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:52, 19 August 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Location==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Location==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;tt&amp;gt;BCI2000/src/shared//modules/application/utils&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;/TrialStatistics&lt;/del&gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;tt&amp;gt;BCI2000/src/shared//modules/application/utils&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Synopsis==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Synopsis==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wikidb-bci_:diff:1.41:old-4063:rev-4112:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Mellinger</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:TrialStatistics_Class&amp;diff=4063&amp;oldid=prev</id>
		<title>Mellinger at 17:11, 14 August 2008</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:TrialStatistics_Class&amp;diff=4063&amp;oldid=prev"/>
		<updated>2008-08-14T17:11:35Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Location==&lt;br /&gt;
&amp;lt;tt&amp;gt;BCI2000/src/shared//modules/application/utils/TrialStatistics&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Synopsis==&lt;br /&gt;
The &amp;lt;tt&amp;gt;TrialStatistics&amp;lt;/tt&amp;gt; class provides bookkeeping for trial outcomes in form of a frequency matrix recording target and result of each trial.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;TrialStatistics&amp;lt;/tt&amp;gt; class is a descendant of the [[Programming Reference:EnvironmentExtension Class|&amp;lt;tt&amp;gt;EnvironmentExtension&amp;lt;/tt&amp;gt;]] class.&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
===int Hits (r)===&lt;br /&gt;
The number of trials where the result matched the target.&lt;br /&gt;
===int Total (r)===&lt;br /&gt;
The total number of trials recorded.&lt;br /&gt;
===int Invalid (r)===&lt;br /&gt;
The number of trials recorded as &amp;quot;invalid&amp;quot;. Invalid trials do not enter into performance computation.&lt;br /&gt;
===float Bits (r)===&lt;br /&gt;
The amount of information transferred since the last reset, given in bits. See the notes below for details.&lt;br /&gt;
&lt;br /&gt;
==Events==&lt;br /&gt;
===Initialize===&lt;br /&gt;
During system initialization, &amp;lt;tt&amp;gt;TrialStatistics&amp;lt;/tt&amp;gt; uses the [[User_Reference:CursorTask#NumberTargets|NumberTargets]] parameter to determine the size of its internal frequency matrix.&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
===Reset()===&lt;br /&gt;
Resets the invalid trials counter, and all entries of the frequency matrix to 0.&lt;br /&gt;
===Update(int TargetCode, int ResultCode)===&lt;br /&gt;
Adds the outcome of a trial to the frequency matrix.&lt;br /&gt;
===UpdateInvalid()===&lt;br /&gt;
Increments the invalid trials counter.&lt;br /&gt;
&lt;br /&gt;
==Remarks==&lt;br /&gt;
The &amp;#039;&amp;#039;Bits()&amp;#039;&amp;#039; function computes the amount of information transferred through&lt;br /&gt;
a noisy channel when for each combination of input and output symbols&lt;br /&gt;
(target and result codes) the number of occurrences is given in form of&lt;br /&gt;
the elements of a frequency matrix.&lt;br /&gt;
&lt;br /&gt;
The computation uses the formula for information transfer through a noisy channel as given in&lt;br /&gt;
Shannon, A Mathematical Theory of Communication, in: The Bell System Technical Journal, Vol. 27, 1948, section 16:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
      H = - \sum_{i,j}{P_i p_{ij}} \log\sum_i{P_i p_{ij}}&lt;br /&gt;
          + \sum_{i,j}{P_i (p_{ij} \log{p_{ij}})}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;H&amp;lt;/math&amp;gt; is the information transferred per symbol, &amp;lt;math&amp;gt;P_i&amp;lt;/math&amp;gt; is a probability distribution over input symbols, and noise is represented as a ``transition matrix&amp;#039;&amp;#039; &amp;lt;math&amp;gt;p_{ij}&amp;lt;/math&amp;gt; that contains the probability for output &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; if the input is &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In the expression, the first term represents the entropy of the distribution of output symbols&lt;br /&gt;
(result codes); the second term represents the reduction of this entropy&lt;br /&gt;
introduced by noise, and is given as the negative of the entropy for each&lt;br /&gt;
&amp;lt;math&amp;gt;p_{ij}&amp;lt;/math&amp;gt; row: &amp;lt;math&amp;gt;\sum_j p_{ij}\log p_{ij}&amp;lt;/math&amp;gt;, weighted by the probability &amp;lt;math&amp;gt;P_i&amp;lt;/math&amp;gt; for the occurrence of its input symbol, i.e. for its actual occurrence during transmission.&lt;br /&gt;
&lt;br /&gt;
We consider the elements of the frequency matrix as an estimate&lt;br /&gt;
for &amp;lt;math&amp;gt;N P_i p_{ij}&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of symbols transferred, i.e. the number of trials, and the relative frequencies of target codes as an estimate for the &amp;lt;math&amp;gt;P_i&amp;lt;/math&amp;gt;. From this, we compute the total number of bits transferred, i.e. Shannon&amp;#039;s expression multiplied by &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
Shannon&amp;#039;s expression is based on assumptions that are likely to be violated in practice, most notably&lt;br /&gt;
*the assumption that successive input symbols (target codes) are independent of each other -- this is clearly violated by obtaining target codes from a block randomization scheme, implying an over-estimate of the bit rate, but also&lt;br /&gt;
*the assumption that noise affects successive input independently is not necessarily fulfilled, especially in the presence of an adaptive algorithm.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Programming Reference:ApplicationBase Class]], [[Programming Reference:EnvironmentExtension Class]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Framework API]][[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Mellinger</name></author>
	</entry>
</feed>