scorer.py module
- class Scorer
Bases:
object
- property model_url: str
URL or local FS path leading to Improve AI booster to be used with this scorer. Allows both raw xgboost files (most commonly having *.xgb extension) as well as gzipped boosters (*.xgb.gz). Can only be set during object initialization.
- Returns:
model URL for this Scorer
- Return type:
str
- property chooser: XGBChooser
Chooser object (for more info please check Chooser tab -> XGBChooser class) for this scorer. Can only be set during object initialization.
- Returns:
a chooser object for this Scorer
- Return type:
- property TIEBREAKER_MULTIPLIER: float
Small float value used to randomize model’s scores (random numbers sampled uniformly from [0, 1) are multiplied by TIEBREAKER_MULTIPLIER and added to scores)
- Returns:
Small float value used to randomize model’s scores
- Return type:
float
- __init__(model_url)
Init with params
- Parameters:
model_url (str) – URL or local FS of a plain or gzip compressed Improve AI model resource
- score(items, context=None)
Uses the model to score a list of items with the given context
- Parameters:
items (list or tuple or np.ndarray) – list of items to be scored
context (object) – any JSON encodable extra context info that will be used with each of the item to get its score
- Returns:
an array of float64 (double) values representing the scores of the items.
- Return type:
np.ndarray