Exemplo n.º 1
0
 public ScoresDistance(DocumentScore source, DocumentScore target, Double differenceNorm)
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     if (target == null)
     {
         throw new ArgumentNullException(nameof(target));
     }
     SourceScore    = source;
     TargetScore    = target;
     DifferenceNorm = differenceNorm;
 }
Exemplo n.º 2
0
 public ScoresDistance(DocumentScore source, DocumentScore target, Double differenceNorm)
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     if (target == null)
     {
         throw new ArgumentNullException(nameof(target));
     }
     SourceScore = source;
     TargetScore = target;
     DifferenceNorm = differenceNorm;
 }
Exemplo n.º 3
0
        private static async Task <ScoresDistance> compareScoresAsync(DocumentScore source, DocumentScore target)
        {
            return(await Task.Run(() =>
            {
                Double sumSquares = 0;
                var sourceScores = source.ScoreVector;
                var targetScores = target.ScoreVector;

                for (var j = 0; j < sourceScores.Length; j++)
                {
                    var residual = sourceScores[j] - targetScores[j];
                    sumSquares += residual * residual;
                }

                return new ScoresDistance(source, target, Math.Sqrt(sumSquares));
            }));
        }
        private static async Task<ScoresDistance> compareScoresAsync(DocumentScore source, DocumentScore target)
        {
            return await Task.Run(() =>
            {
                Double sumSquares = 0;
                var sourceScores = source.ScoreVector;
                var targetScores = target.ScoreVector;

                for (var j = 0; j < sourceScores.Length; j++)
                {
                    var residual = sourceScores[j] - targetScores[j];
                    sumSquares += residual*residual;
                }

                return new ScoresDistance(source, target, Math.Sqrt(sumSquares));
            });
        }
Exemplo n.º 5
0
 public ScoreDocumentResultMessage(ScoreDocumentRequestMessage request, DocumentScore score, Boolean isSourceScore)
     : base(request)
 {
     Score         = score;
     IsSourceScore = isSourceScore;
 }