CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\UserTestingEngine Class Reference

Decision making around user testing. More...

Public Member Functions

 __construct (array $tests, ?string $activeTest, callable $callback)
 
 decideTestByTrigger (string $trigger)
 
 decideTestByAutoenroll ()
 
 decideActiveTest (?string $trigger)
 
 activateTest (UserTestingStatus $status)
 If provided status is in an active state enable the related configuration.
 

Static Public Member Functions

static fromConfig (Config $config)
 
static chooseBucket (float $probability, array $buckets)
 
static hexToProbability (string $hash)
 Converts a hex string into a probability between 0 and 1.
 
static stableUserProbability (string $testName)
 

Detailed Description

Decision making around user testing.

See docs/user_testing.md for more information.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\UserTestingEngine::__construct ( array $tests,
?string $activeTest,
callable $callback )
Parameters
array$tests
?string$activeTestArray key in test to enable autoenroll for, or null for no autoenrollment.
callable$callbackCalled with the test name, returns a float between 0 and 1 which is uniformly distributed across users and stable for an individual user+testName combination.

Member Function Documentation

◆ activateTest()

CirrusSearch\UserTestingEngine::activateTest ( UserTestingStatus $status)

If provided status is in an active state enable the related configuration.

Parameters
UserTestingStatus$status

◆ chooseBucket()

static CirrusSearch\UserTestingEngine::chooseBucket ( float $probability,
array $buckets )
static
Parameters
float$probabilityA number between 0 and 1
string[]$bucketsList of buckets to choose from.
Returns
string The chosen bucket.

◆ hexToProbability()

static CirrusSearch\UserTestingEngine::hexToProbability ( string $hash)
static

Converts a hex string into a probability between 0 and 1.

Retains uniform distribution of incoming hash string.

Parameters
string$hash
Returns
float Probability between 0 and 1

◆ stableUserProbability()

static CirrusSearch\UserTestingEngine::stableUserProbability ( string $testName)
static
Parameters
string$testName
Returns
float Returns a value between 0 and 1 that is uniformly distributed between users, but constant for a single user+test combination.

The documentation for this class was generated from the following file: