Skip to content

Design ideas

sylvainbonnot edited this page Feb 17, 2022 · 5 revisions

Getitem method

Simple dag example

Let's consider a simple dag:

subdag

Expected behavior for subdags with only input names (no output names)

subdag with all coparents present

In the dag above, prediction is a coparent of truth, because they share the same child confusion_count

subdag = sdag[['truth', 'prediction', 'confusion_value'],:]
subdag.dot_digraph()

This code gives the expected result:

subdag2

subdag with missing coparents in the output

If in the above, prediction is missing, the subdag generated is the same (i.e the missing coparent should be added, at least by default) This is already the case.

subdag = sdag[['truth', 'confusion_value'],:]
subdag.dot_digraph()

subdag with missing coparents in some descendant

For example we consider

subdag = sdag[['truth', 'prediction'],:]
subdag.dot_digraph()

That means that confusion_value is now absent.

Current error in the get item

def f(a,b):
    return a+b

def g(b,c):
    return b*c

def h(f,g):
    return f-g

mydag = DAG([f,g,h])
subdag4
smydag = mydag[['a','b','c'],:]
smydag.dot_digraph()

This produces the wrong result: subdag5

Why is that? Because of the following:

ins | descendants(ins)

is not the same as:

ins | descendants(ins) | descendants(ins | descendants(ins))

In our example: ins=['a','b','c']