class ScoreAnswer extends Answer

Methods

array
toArray()

Get the instance as an array.

array
jsonSerialize()

Get the JSON serializable representation of the instance.

from  Answer
__construct(float $score, array $probabilities, array $legend, float|null $confidence = null)

Create a new score answer instance.

int
level()

Get the most probable level.

string|array|null
label()

Get the description of the most probable level.

float
normalized()

Get the score as a fraction of the highest level.

Details

at line 56
array toArray()

Get the instance as an array.

Return Value

array

in Answer at line 20
array jsonSerialize()

Get the JSON serializable representation of the instance.

Return Value

array

at line 17
__construct(float $score, array $probabilities, array $legend, float|null $confidence = null)

Create a new score answer instance.

Parameters

float $score

the probability-weighted level, which may fall between two levels

array $probabilities
array $legend
float|null $confidence

null when the provider cannot measure the distribution's certainty

at line 28
int level()

Get the most probable level.

Return Value

int

at line 40
string|array|null label()

Get the description of the most probable level.

Return Value

string|array|null

at line 48
float normalized()

Get the score as a fraction of the highest level.

Return Value

float