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

"kindPrinter[dfKind] is not a function" for distributions on pairs of integers #68

Closed
stuhlmueller opened this issue Dec 2, 2016 · 5 comments

Comments

@stuhlmueller
Copy link
Member

In a previous version of webppl-viz, this code resulted in a table with colored cells:

viz.auto(Infer({ 
  model() {
    return {
      x: randomInteger(2),
      y: randomInteger(2)
    }
  }}));

Now, I get:

kindPrinter[dfKind] is not a function
@longouyang
Copy link
Member

I'm slowly (1) transitioning to use just viz and (2) changing the auto layout choices.

So using viz instead of viz.auto works on your example, though it shows a colored bar chart instead of the colored matrix (the new behavior is to show a matrix when a bar chart would be too hard to read -- when each component has more than 5 levels)

@stuhlmueller
Copy link
Member Author

viz doesn't work either for me (running the code on agentmodels, which uses http://cdn.webppl.org/webppl-viz-0.7.10.js).

@longouyang
Copy link
Member

longouyang commented Dec 3, 2016

Ah, I believe you're hitting a bug that was fixed in b727920 -- try using the latest version on the cdn, webppl-viz-818a17e.js

@stuhlmueller
Copy link
Member Author

Thanks, that worked. Is there any way to still get the colored matrix? For visualizing tic-tac-toe moves, it was a perfect fit.

@longouyang
Copy link
Member

For the moment, no, but I think fixing #23 will make the colored matrix possible again.

You'll have to manually pass in the vega spec, something like this:

viz.vegaLite(distribution,
             {
               data: {values: data},
               mark: "text",
               encoding: {
                 row: {field: 'x', type: 'nominal'},
                 column: {field: 'y', type: 'nominal'},
                 color: {field: 'prob', type: 'quantitative'},
                 text: {field: 'prob', type: 'quantitative'}
               },
               config: {mark: {applyColorToBackground: true}, numberFormat: ".1e",
                        scale: {textBandWidth: 40}
                       }
             })

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

2 participants