How to use the planout.Experiment function in planout

To help you get started, we’ve selected a few planout examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rawls238 / react-experiments / __tests__ / utils / experimentUtils.js View on Github external
import planout from 'planout';

let globalLog = [];
class DefaultExperiment extends planout.Experiment {
  setup() {
    this.setName("SampleExperiment");
  }

  assign(params, args) {
    params.set('foo',
      new planout.Ops.Random.UniformChoice({
        'choices': ['Variation A', 'Variation B'],
        'unit': args.id
      })
    );

    params.set('test2',
      new planout.Ops.Random.UniformChoice({
        'choices': ['Num1', 'Num2'],
        'unit': args.id
github rawls238 / react-experiments / __tests__ / utils / experimentUtils.js View on Github external
}

  log(stuff) {
    globalLog.push(stuff);
  }

  getParamNames() {
    return this.getDefaultParamNames();
  }

  previouslyLogged() {
    return this._exposureLogged;
  }
};

class DefaultExperiment2 extends planout.Experiment {
  setup() {
    this.setName('SampleExperiment2');
  }

  assign(params, args) {
    params.set('foobar',
      new planout.Ops.Random.UniformChoice({
        'choices': ['Variation A', 'Variation B'],
        'unit': args.id
      })
    );
  }

  configureLogger() {
    return;
  }
github facebook / planout / alpha / js / examples / experiment_verification.js View on Github external
var Experiment1 = function(args) {
  var experiment = new planout.Experiment(args);
  experiment.setup = function() { this.set_salt("Exp1"); }
  experiment.setup();
  experiment.assign = function(params, args) {
    params.set('group_size', new planout.Ops.Random.UniformChoice({ 'choices': [1, 10], 'unit': args.userid}));
    params.set('specific_goal', new planout.Ops.Random.BernoulliTrial({'p': 0.8, 'unit': args.userid}));
    if (params.get('specific_goal')) {
      params.set('ratings_per_user_goal', new planout.Ops.Random.UniformChoice({ 'choices': [8, 16, 32, 64], 'unit': args.userid}));
      params.set('ratings_goal', params.get('group_size') * params.get('ratings_per_user_goal'));
    }
  };
  experiment.configure_logger = function() { return; }
  experiment.log = function(stuff) { return; }
  experiment.previously_logged = function() { return; }
  return experiment;
};
github facebook / planout / alpha / js / examples / experiment_verification.js View on Github external
var Experiment3 = function(args) {
  var experiment = new planout.Experiment(args);
  experiment.setup = function() { this.set_salt("Exp3"); }
  experiment.setup();
  experiment.assign = function(params, args) {
    params.set('has_banner', new planout.Ops.Random.BernoulliTrial({ 'p': 0.97, 'unit': args.userid}));
    var cond_probs = [0.5, 0.95];
    params.set('has_feed_stories', new planout.Ops.Random.BernoulliTrial({'p': cond_probs[params.get('has_banner')], 'unit': args.userid}));
    params.set('button_text', new planout.Ops.Random.UniformChoice({'choices': ["I'm a voter", "I'm voting"], 'unit': args.userid}))
  };
  experiment.configure_logger = function() { return; }
  experiment.log = function(stuff) { return; }
  experiment.previously_logged = function() { return; }
  return experiment;

}

planout

PlanOut is a framework and programming language for online field experimentation

MIT
Latest version published 4 years ago

Package Health Score

54 / 100
Full package analysis