Giter VIP home page Giter VIP logo

ablincoln's People

Contributors

akalicki avatar jacoboliver avatar phuedx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ablincoln's Issues

README revamp

revamp readme to better address differences between python + php port and usage at Vimeo

Rename repository

Think about renaming repository to better establish relationship between original PlanOut release and PHP port (e.g. keep ABLincoln as an internal use name and release repo as PlanOut-PHP)

  • rename repo [has to be done by organization admin]
  • re-link with Packagist after name change (if it doesn't update automatically)
  • update PHP file namespacing
  • update README references with new name

PHP: Exception when specifying compound primary_unit in SimpleNamespace

Referring to the python reference implementation, it is possible to specify a compound primary_unit (e.g.: [ 'distinct_id', 'country' ] ) when setting up a SimpleNamespace. However, in PHP an exception is thrown in _getSegment() when an array of units is specified:

SimpleNamespace.php:_getSegment() line 174:
$assignment->segment = new Random\RandomInteger(
['min' => 0, 'max' => $this->num_segments - 1],
['unit' => $this->inputs[$this->primary_unit]]
);

$this->inputs can't be indexed by $this->primary_unit, which is an array. Both parity with python and the helper function SimpleNamespace.php:setPrimaryUnit($value) (where scalar $value is converted to an array automatically), suggest that compound units would be supported.

The following sample program exercises the issue:

use \Vimeo\ABLincoln\Namespaces\SimpleNamespace;
use \Vimeo\ABLincoln\Experiments\SimpleExperiment;
use \Vimeo\ABLincoln\Operators\Random as Random;

class MyExperiment extends SimpleExperiment {
public function assign($params, $inputs) {
$params->button_color = new Random\WeightedChoice( ['choices'=>['red', 'blue'], 'weights' => [ 0.5, 0.5 ] ], $inputs);
}
}

class MyNamespace extends \Vimeo\ABLincoln\Namespaces\SimpleNamespace {
public function setup() {
$this->name = 'My Namespace';
$this->num_segments = 10;
$this->primary_unit = [ 'distinct_id', 'country' ];
}
public function setupExperiments() {
$this->addExperiment('My Experiment', MyExperiment, 5);
}
}

$ns = new MyNamespace(['country' => 'US', 'distinct_id' => 'slkf982-fjfs894hg-ishgfjgh']);

print $ns->get('button_color');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.