ExactMatch reward
ExactMatch
Bases: RewardFunctionWrapper
Computes the exact match between y_true
and y_pred
.
Example:
program.compile(
reward=synalinks.rewards.ExactMatch(),
optimizer=synalinks.optimizers.RandomFewShot(),
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Optional. string name of the reward instance. |
'exact_match'
|
in_mask
|
list
|
Optional. list of keys to keep to compute the reward. |
None
|
out_mask
|
list
|
Optional. list of keys to remove to compute the reward. |
None
|
Source code in synalinks/src/rewards/exact_match.py
exact_match(y_true, y_pred)
async
Computes the exact match between y_true
and y_pred
.
If their values are equal, it returns a reward of 1.0; otherwise, it returns 0.0.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_true
|
JsonDataModel
|
The ground truth JSON data_model. |
required |
y_pred
|
JsonDataModel
|
The predicted JSON data_model. |
required |
Returns:
Type | Description |
---|---|
float
|
The reward value, which is 1.0 if the values match exactly, and 0.0 otherwise. |