Thurstonian for ranking: declaring and initializing pairwise ranking array<p>I am attempting to implement the Thurstonian model for pairwise ranking. I ran into a problem defining elements of the pairwise ranking VariableArray<bool> based on pairs of elements from the scores VariableArray<double> array.</p>
<p>An item is represented as an VariableArray<double> of scores and is of length n. Each element of the array is a Gaussian RV. Mean is defined by an inner product of respective feature vector (observed) and parameters vector (VectorGaussian and is learned).
The variance is hard-coded for now.</p>
<p>I need to declare and statistically define the pairwise ranking VariableArray<bool> which is associated with the scores array described above. The size of this array is n-1. To define first element of this array, I need to compare first and second
RV of the scores variable array using ">" factor. To define the second element, I need to compare second and third from the scores variable array. And so forth. How can I write that in Infer.NET using "Variable.ForEach(...)" constructs?
Or differently.</p>
<p>To train the model (infer the parameters VectorGaussian posterior), I have an array of items. Each item has a potentially different size (different number of feature vectors) and respectively scores and respectively the outcomes. I created a jagged array
for features and a different one for outcomes to realize that I cannot index pairs from scores</p>
<pre class="prettyprint" style="">VariableArray<VariableArray<double>, double[][]></pre>
<br/>
<p>to statistically define the outcomes (</p>
<pre class="prettyprint" style="">VariableArray<VariableArray<bool, bool[][]>></pre>
<br/>
<p>). Also I cannot write a comparison "using(Variable.If(scores[item][feature]) > scores[iteam][item][feature+1])".</p>
<p>The problem looks twofolds (1) scores array of array and outcomes array of arrays have different internal ranges (2) unclear how to write comparison when adding/subtracting integer from range in "Variable.If(...)" construction is not allowed.</p>
<p>The work code is on GitHub:</p>
<p>https://github.com/usptact/Infer.NET-LTR/tree/master/Infer.NET-LTR</p>
<p>Look at the Model.cs file where I defined variables and started to design the model. The Reader.cs and Program.cs should give an idea about the data. The sample data is in a "sample.ltr" file and follows SVM-Rank format. There are two items and
each is 3 feature vectors big.</p>
<p>In my code I have three outcomes: ">" is true, "<" is true and draw option. Perhaps I need to simplify the code to two outcomes for now.</p>
<p>A route that I don't want to go, is to instead of VariableArray's use .NET arrays. I guess that would be fairly inefficient.</p>
<p>Thanks</p>
<br/>© 2009 Microsoft Corporation. Todos los derechos reservados.Fri, 01 Dec 2017 22:18:41 Zb493aa77-dfaa-4f4e-85de-6fbc0ded0142- https://social.microsoft.com/Forums/es-ES/b493aa77-dfaa-4f4e-85de-6fbc0ded0142/thurstonian-for-ranking-declaring-and-initializing-pairwise-ranking-array?forum=infer.net#b493aa77-dfaa-4f4e-85de-6fbc0ded0142https://social.microsoft.com/Forums/es-ES/b493aa77-dfaa-4f4e-85de-6fbc0ded0142/thurstonian-for-ranking-declaring-and-initializing-pairwise-ranking-array?forum=infer.net#b493aa77-dfaa-4f4e-85de-6fbc0ded0142usptacthttps://social.microsoft.com:443/profile/usptact/?type=forumThurstonian for ranking: declaring and initializing pairwise ranking array<p>I am attempting to implement the Thurstonian model for pairwise ranking. I ran into a problem defining elements of the pairwise ranking VariableArray<bool> based on pairs of elements from the scores VariableArray<double> array.</p>
<p>An item is represented as an VariableArray<double> of scores and is of length n. Each element of the array is a Gaussian RV. Mean is defined by an inner product of respective feature vector (observed) and parameters vector (VectorGaussian and is learned).
The variance is hard-coded for now.</p>
<p>I need to declare and statistically define the pairwise ranking VariableArray<bool> which is associated with the scores array described above. The size of this array is n-1. To define first element of this array, I need to compare first and second
RV of the scores variable array using ">" factor. To define the second element, I need to compare second and third from the scores variable array. And so forth. How can I write that in Infer.NET using "Variable.ForEach(...)" constructs?
Or differently.</p>
<p>To train the model (infer the parameters VectorGaussian posterior), I have an array of items. Each item has a potentially different size (different number of feature vectors) and respectively scores and respectively the outcomes. I created a jagged array
for features and a different one for outcomes to realize that I cannot index pairs from scores</p>
<pre class="prettyprint" style="">VariableArray<VariableArray<double>, double[][]></pre>
<br/>
<p>to statistically define the outcomes (</p>
<pre class="prettyprint" style="">VariableArray<VariableArray<bool, bool[][]>></pre>
<br/>
<p>). Also I cannot write a comparison "using(Variable.If(scores[item][feature]) > scores[iteam][item][feature+1])".</p>
<p>The problem looks twofolds (1) scores array of array and outcomes array of arrays have different internal ranges (2) unclear how to write comparison when adding/subtracting integer from range in "Variable.If(...)" construction is not allowed.</p>
<p>The work code is on GitHub:</p>
<p>https://github.com/usptact/Infer.NET-LTR/tree/master/Infer.NET-LTR</p>
<p>Look at the Model.cs file where I defined variables and started to design the model. The Reader.cs and Program.cs should give an idea about the data. The sample data is in a "sample.ltr" file and follows SVM-Rank format. There are two items and
each is 3 feature vectors big.</p>
<p>In my code I have three outcomes: ">" is true, "<" is true and draw option. Perhaps I need to simplify the code to two outcomes for now.</p>
<p>A route that I don't want to go, is to instead of VariableArray's use .NET arrays. I guess that would be fairly inefficient.</p>
<p>Thanks</p>
<br/>Tue, 28 Nov 2017 08:29:06 Z2017-11-28T08:29:06Z
- https://social.microsoft.com/Forums/es-ES/b493aa77-dfaa-4f4e-85de-6fbc0ded0142/thurstonian-for-ranking-declaring-and-initializing-pairwise-ranking-array?forum=infer.net#c5766bc7-893f-4444-9eaa-24ff77baf36bhttps://social.microsoft.com/Forums/es-ES/b493aa77-dfaa-4f4e-85de-6fbc0ded0142/thurstonian-for-ranking-declaring-and-initializing-pairwise-ranking-array?forum=infer.net#c5766bc7-893f-4444-9eaa-24ff77baf36bTom Minkahttps://social.microsoft.com:443/profile/tom%20minka/?type=forumThurstonian for ranking: declaring and initializing pairwise ranking arrayRead the last part of <a href="http://infernet.azurewebsites.net/docs/ForEach%20blocks.aspx" id="x_x_13::ForEach" style="">ForEach blocks.</a>Tue, 28 Nov 2017 14:43:21 Z2017-11-28T14:43:21Z