Hi all,

I'm using Gremlin to perform a recommendation query. Locally in the gremlin
shell I get amazingly useful results. However when I use the webadmin
gremlin console I get different results, both locally and in the Heroku
addon environment. I get the same wrong results when I use the rest
interface, so I assume something is incorrect in the Gremlin REST
interface. In all these cases the data is the same or on the same database.

The gremlin query is below (it is own of my first so probably not the most
efficient). It returns the top 10 list of most similar items according to
the Jaccard similarity index (= (Intersection(A, B) / Union(A, B) ):

node = g.v(14260); m = [:].withDefault{0.0}; a_total = node.inE().count();
node.in().out('owns').sideEffect{union = a_total +
it.inE().count()}.groupCount(m) { it }{ it += (1/(union)) } >> -1;
m.sort{a,b -> b.value <=> a.value}[0..9]

When I do the following locally everything is fine:

    gremlin> g = new
Neo4jGraph('/usr/local/Cellar/neo4j/community-1.4/libexec/data/graph.db')
    ==>neo4jgraph[EmbeddedGraphDatabase
[/usr/local/Cellar/neo4j/community-1.4/libexec/data/graph.db]]
    gremlin> node = g.v(14260); m = [:].withDefault{0.0}; a_total =
node.inE().count(); node.in().out('owns').sideEffect{union = a_total +
it.inE().count()}.groupCount(m) { it }{ it += (1/(union)) } >> -1;
m.sort{a,b -> b.value <=> a.value}[0..9]
    ==>v[14260]=0.5000000013
    ==>v[12974]=0.1014492752
    ==>v[12349]=0.0952380952
    ==>v[12082]=0.0833333332
    ==>v[15434]=0.0810810810
    ==>v[11237]=0.0810810810
    ==>v[17672]=0.0769230768
    ==>v[18338]=0.0769230768
    ==>v[12852]=0.0769230768
    ==>v[11969]=0.075
    gremlin>

However when I repeat this using the webadmin console interface I get the
following results:

    gremlin> node = g.v(14260); m = [:].withDefault{0.0}; a_total =
node.inE().count(); node.in().out('owns').sideEffect{union = a_total +
it.inE().count()}.groupCount(m) { it }{ it += (1/(union)) } >> -1;
m.sort{a,b -> b.value <=> a.value}[0..9]
    ==> v[14260]=31.0
    ==> v[9204]=30.0
    ==> v[8958]=29.0
    ==> v[15763]=22.0
    ==> v[13906]=22.0
    ==> v[18477]=21.0
    ==> v[9081]=20.0
    ==> v[9019]=19.0
    ==> v[9074]=18.0
    ==> v[9066]=18.0

The values of a Jaccard Index should never be above 1 so something is
clearly wrong. Any ideas?

Thanks,
Jeroen
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to