Say I have a decision tree that looks like this:
I've written a cypher query to create that decision tree:
create (_0 {`name`:"Spins?", `type`:"split"})
create (_1a {`name`:"Weight", `type`:"split"})
create (_1b {`name`:"Weight", `type`:"split"})
create (_2a {`name`:"Spider", `type`:"terminal"})
create (_2b {`name`:"Spider Man", `type`:"terminal"})
create (_2c {`name`:"Ant", `type`:"terminal"})
create (_2d {`name`:"Ant Man", `type`:"terminal"})
create (_0)-[:`CON` {`lt`:.5}]->(_1a)
create (_0)-[:`CON` {`gte`:.5}]->(_1b)
create (_1a)-[:`CON` {`lt`:200}]->(_2a)
create (_1a)-[:`CON` {`gte`:200}]->(_2b)
create (_1b)-[:`CON` {`lt`:200}]->(_2c)
create (_1b)-[:`CON` {`gte`:200}]->(_2d)
;
A couple questions:
- Is this the best way to set up a decision tree in neo4j?
- How would I write a cypher query to join to the graph and get the result node with input data? e.g. say I had the data {'Spins?' : False, 'Weight' : 500}, how would I write a query to efficiently return the "Ant Man" node?