Property | Type | Description | |
---|---|---|---|
$inputs | |||
$name | |||
$num_segments | |||
$primary_unit |
Method | Description | |
---|---|---|
__construct ( array $inputs ) | Set up attributes needed for the namespace | |
addExperiment ( string $name, string $exp_class, integer $num_segments ) | Map a new experiment to a given number of segments in the namespace | |
get ( string $name, string $default = null ) : the | Get the value of a given experiment parameter - triggers exposure log | |
inExperiment ( ) : boolean | In-experiment accessor | |
logEvent ( $event_type, array $extras = null ) | Log an arbitrary event | |
logExposure ( array $extras = null ) | Logs exposure to treatment | |
primaryUnit ( ) : array | Get the primary unit that will be mapped to segments | |
removeExperiment ( string $name ) | Remove a given experiment from the namespace and free its associated segments | |
setAutoExposureLogging ( boolean $value ) | Disables / enables auto exposure logging (enabled by default) | |
setPrimaryUnit ( mixed $value ) | Set the primary unit that will be used to map to segments | |
setup ( ) | Set namespace attributes for run. Developers extending this class should set the following variables: this->name = 'sample namespace'; this->primary_unit = 'userid'; this->num_segments = 10000; | |
setupExperiments ( ) | Setup experiments segments will be assigned to: $this->addExperiment('first experiment', Exp1, 100); |
Method | Description | |
---|---|---|
_requiresDefaultExperiment ( ) | Checks if primary unit segment is assigned to a default experiment, and if not assigns it to one | |
_requiresExperiment ( ) | Checks if primary unit segment is assigned to an experiment, and if not assigns it to one |
Method | Description | |
---|---|---|
_assignDefaultExperiment ( ) | Assigns the primary unit value(s) and associated segment to a new default experiment used if segment not assigned to a real one | |
_assignExperiment ( ) | Assigns the primary unit value(s) and associated segment to a new experiment and updates the experiment name/salt accordingly | |
_defaultGet ( string $name, string $default = null ) : the | Get the value of a given default experiment parameter. Called on get() if primary unit value(s) not mapped to a real experiment | |
_getSegment ( ) : integer | Use the primary unit value(s) to obtain a segment and associated experiment |
public __construct ( array $inputs ) | ||
$inputs | array | data to determine parameter assignments, e.g. userid |
protected _requiresDefaultExperiment ( ) |
protected _requiresExperiment ( ) |
public inExperiment ( ) : boolean | ||
return | boolean | true if primary unit mapped to an experiment, false otherwise |
public logExposure ( array $extras = null ) | ||
$extras | array | optional extra data to include in exposure log |
public primaryUnit ( ) : array | ||
return | array | array containing value(s) used for unit assignment |
public removeExperiment ( string $name ) | ||
$name | string | previously defined name of experiment to remove |
public setAutoExposureLogging ( boolean $value ) | ||
$value | boolean | true to enable, false to disable |
public setPrimaryUnit ( mixed $value ) | ||
$value | mixed | value or array used for unit assignment to segments |
abstract public setup ( ) |
abstract public setupExperiments ( ) |