# some simple similar op examples

In this post just a few simple examples of similar. More interesting examples in future posts.

First, say we know a little about oranges. We know their taste, their smell, their colour, and their size. And say we know those operators for other objects too. Then, in an English like way, we can ask:
```similar[taste] |orange>
similar[smell] |orange>
similar[colour] |orange>
similar[size] |orange>
```
and we should get back expected results. Now, how about a working example?
```-- learn some toy knowledge about disease symptoms:
disease-symptoms |disease: 1> => |symptom: a> + |symptom: b> + |symptom: c>
disease-symptoms |disease: 2> => |symptom: d> + |symptom: e>
disease-symptoms |disease: 3> => |symptom: f> + |symptom: g> + |symptom: h> + |symptom: i>
disease-symptoms |disease: 4> => |symptom: j> + |symptom: k> + |symptom: l>

-- learn some symptoms of a new patient:
disease-symptoms |patient: 1> => |symptom: b> + |symptom: h> + |symptom: f> + |symptom: k>

-- now ask, and see what the possible disease is for our patient?
-- and the 100 is in there to convert it to percent
sa: 100 similar[disease-symptoms] |patient: 1>
50.000|disease: 3> + 25.000|disease: 1> + 25.000|disease: 4>
```
So 50% chance of disease 3, and 25% for disease 1 and 4.

Now, another example. Say a shopping centre keeps track of all your purchases (heh, not a big stretch!). Now, given a new shopping basket just rung up, can we guess who it might be? Yup.
```-- this is what the shop knows:
basket |user 1> => |milk> + |bread> + |tea> + |bananas> + |carrots> + |chocolate>
basket |user 2> => 4|apple> + |milk> + |coffee> + |steak>
basket |user 3> => |chocolate> + |vegemite> + |olive oil> + |pizza> + |cheese>

-- a new basket has just been processed:
basket |f> => 3|apple> + 5|oranges> + |milk> + |bread> + |coffee> + |steak>

-- now ask, which user is this likely to be?
50.000|user 2> + 16.667|user 1> + 8.333|user 4>
```
So, 50% chance it is user 2. BTW, this example relies on the assumption that from shopping trip to shopping trip you largely purchase the same thing. Or at least that your average shopping basket converges to something that can identify you. And given that a large supermarket may have on the order of 40,000 different products, it is quite likely your shopping basket can identify you with high confidence!

Anyway, the above is really just proof-of-concept for similar[op] |x>. In a future post I will give a bigger example.

Update: I guess the point is that it is all abstract and general, so we can apply the exact same technique all over the place. eg, perhaps identifying you from your browser details similar to EFF's panopticlick. All you need are appropriately defined operators mapping objects to superpositions.

Home
previous: introducing similar op x
next: simple image recognition

updated: 19/12/2016
by Garry Morrison
email: garry -at- semantic-db.org