FAQ - nesterovsky-bros/KB GitHub Wiki

Q: How "Probably answers" are managed? It appears you perform multiplication between "probability answers" value.

A: Probable answers are working like this.

Suppose you have a whole set of entities E.
Suppose the question splits it into two subsets: E0 + E1 = E,
where E0 corresponds to answer “no” and E1 to “yes”.
Suppose your answer is not precise (you’re not sure or don’t know),
so its value is in the range 0 < A < 1.

Then we give weights to entities in these two subsets.

Entities in E1 are given weight A, while entities in E0 have weight (1 - A); or
more correctly we use normalized weights, so E1 entities have weight A/max(A, 1 - A),
while E0 entities have weight (1 - A)/max(A, 1 - A).

In other words one subset of entities gets weight 1 and other is
min(A, 1 - A)/max(A, 1 - A)

This means that we don’t throw away entities but give them weights, and
use these weights to order results.

In limit case, when your answer is precise 1 or 0, one of subsets is given weight 1 and the other 0. We optimize this case by reducing the query and not returning entities with weight 0.

Initially all entities have weight 1. With each answer each entity is given a new weight
derived from multiplication of previous weight to a weight calculated for the answer.
Entities with weight 0 are discarded from further considerations.

To see this in action please:

  • delete data from the cache of results Data.PredicateTree;
  • run the search with @debug = 1;
  • compare queries with precise and imprecise answers.

You will see that entities are grouped and ordered by close weights, and next offers suggested are those that have higher weight.

⚠️ **GitHub.com Fallback** ⚠️