private void findRandomEdgeTopic(out EdgeNavigationData edgeTopic, out string edgeHypothesis) { var rndIndex = _rnd.Next(_edges.Length); var edge = _edges[rndIndex]; edgeTopic = _data.GetEdgeData(edge); var hypotheses = edgeTopic.ExpressionVotes.ToArray(); var totalVoteCount = hypotheses.Select(t => Math.Abs(t.Item2)).Sum() + 1; //TODO format edge to be readable edgeHypothesis = formatFreebaseEdge(edgeTopic.Edge); var repetitionCount = hypotheses.Length * 5; for (var i = 0; i < repetitionCount; ++i) { var hypothesisSample = hypotheses[i % hypotheses.Length]; var threshold = 1.0 * Math.Max(1, hypothesisSample.Item2) / totalVoteCount; if (_rnd.NextDouble() >= threshold) { continue; } edgeHypothesis = hypothesisSample.Item1; } }