Just a pre-warning - I'm new to machine learning and the concepts that come with it, so please be nice with the terminology!

I have a directed Graph which represents a home and some devices in it. Users are able to create rules to control how devices interact with each other (e.g. when motion sensor triggered, turn on the light)

Users are able to build the graph themselves, and label the nodes however they see fit.

Here's an example of a basic graph: Initial graph Key:

  • Red nodes: Inputs - these are usually connected to sensors on devices
  • Orange nodes: Logic - allows you to connect other nodes together to change behaviour
  • Blue nodes: General - just used to help the user understand behaviour
  • Green nodes: Outputs - these control devices

The aim is to try and identify which rooms particular devices are in.

There are some nodes that we can already label without machine learning. I was thinking it could scan the nodes and look for any that contain a single room name. Those nodes would then get labelled with that room name: initially labelled rooms

From that we learn:

  • Device A = lounge
  • Device D = lounge
  • Device E = kitchen

Then the clever part.. it needs to be able to traverse the graph to make predictions on what nodes are in which rooms: enter image description here

From that we should learn:

  • Device B = lounge
  • Device C = dining room
  • Device G = lounge
  • Device H = dining room

There's not enough info to determine where device F is located.

Any thoughts on how I could accomplish this?

I feel like this might need to go down a semi-supervised route, as I'm not going to have much training data to play with. I feel like https://research.googleblog.com/2016/10/graph-powered-machine-learning-at-google.html gives some good ideas, but I don't know where to start.

If it helps I'm planning to use TensorFlow.js to complete the task, but I'm open to other suggestions etc.


  • 3
    $\begingroup$ Doesn't sound like for "machine learning". This sounds like just computing the reachability between node of one type to another. Do tell if I misunderstand $\endgroup$ – Apiwat Chantawibul Apr 6 '18 at 8:24
  • $\begingroup$ Possibly, though reading that Googgle blog post made me think this was a job for machine learning. Perhaps it's not! I think I can get a good distance just by traversing the graph and filling in room names following certain rules, just worried there'll be lots of scenarios that the rules fail for $\endgroup$ – richwol Apr 6 '18 at 8:32
  • 2
    $\begingroup$ Machine learning isn't the appropriate tool for every algorithmic task. For example, machine learning isn't appropriate for adding numbers. Your problem is might benefit from machine learning in inferring information not present in the data. Deep networks, however, are not necessarily the best approach. In any case, you need first to prepare a large bunch of labeled examples. $\endgroup$ – Yuval Filmus Apr 6 '18 at 9:23
  • $\begingroup$ Is there some reason to expect that the links are at all related to location? If there is an edge from A to B, is there some reason to think that A and B are in the same room? I doubt it. Perhaps A = Alexa and B = the lights in another room. Seems to me like the premise is a bit dubious. Anyway, if you think it's valid, can you be more explicit about what you think an edge in the graph have to say about the location of the endpoints of the edge? Right now the question is not very explicit, so if you could make those assumptions explicit that might help you get a better answer. $\endgroup$ – D.W. Apr 6 '18 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.