Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nicer node printing & summary methods #22

Closed
goldingn opened this issue Mar 24, 2017 · 3 comments
Closed

nicer node printing & summary methods #22

goldingn opened this issue Mar 24, 2017 · 3 comments

Comments

@goldingn
Copy link
Member

Printing nodes should say that they are greta nodes and preferably state the node type.

For data nodes, which have fixed values, they should summarise the data as if they were arrays (but with drop = FALSE). For stochastic or op nodes, they should summarise the data shape and print that with ? entries.

This gist defines an array-like class for unknown values, with subsetting methods etc. This can be used to overload head() for nodes. Printing would look like this:

> head(x)
greta node with unknown values

     [,1] [,2] [,3]
[1,]   ?    ?    ? 
[2,]   ?    ?    ? 
[3,]   ?    ?    ? 
[4,]   ?    ?    ? 
[5,]   ?    ?    ? 
[6,]   ?    ?    ? 

A dim() method (just returning x$dim), would also be helpful.

summary() and str() methods for distribution nodes should also return some information about the distributions and possibly parameters.

@goldingn
Copy link
Member Author

goldingn commented Mar 25, 2017

'Node' isn't the best name for these (and it's confusing as nodes are defined internally, too). 'Tensor' may also be confused with TF tensors. Since they are intended to behave like arrays, perhaps 'greta array' is a better term?

The print method might then give:

greta array (fixed)

     [,1] [,2] [,3]
[1,]  0    1    0 
[2,]  1    0    1.2 
greta array (deterministic)

     [,1] [,2] [,3]
[1,]   ?    ?    ? 
[2,]   ?    ?    ? 
greta array (stochastic with beta distribution)

     [,1] [,2] [,3]
[1,]   ?    ?    ? 
[2,]   ?    ?    ? 

for consistency, and to hide internal functions from users, it might be better to thinly wrap these in a greta_array S3 class?

@goldingn
Copy link
Member Author

ideas for the greta_array class are in this gist

@goldingn goldingn mentioned this issue Mar 26, 2017
@goldingn
Copy link
Member Author

implemented in #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant