Skip to content

Variable going out of scope when other variables are defined #922

Description

@sanitgupta
var P = function() {
  return flip(theta) ?  'a' : 'b';
}

var fn = function() {
  return sample(Beta({a: 1, b: 1}))
}

//var x = sample(Beta({a: 1, b: 1}));
var theta = 0.1;
theta;

var dist = Infer(
  {method: 'MCMC', kernel: 'MH', samples: 1000},
  P);

viz.auto(dist)

This code runs fine but when I uncomment the line initializing x, the code gives an error 'theta is not defined' . I am not sure how/why this is happening. Apologies if it isn't a bug.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions