Add log_argument

Signed-off-by: András Schmelczer <andras@schmelczer.dev>
This commit is contained in:
Andras Schmelczer 2022-04-09 22:02:00 +02:00
parent 09137e146c
commit 69d5c4f1f6
27 changed files with 332 additions and 58 deletions

View file

@ -1,15 +1,18 @@
import re
from typing import Dict, Iterable, List
from config import model_key
from models import DomainPrediction
from preprocess import preprocess
from sklearn.pipeline import Pipeline
from good_ai import use_model
from good_ai import use_model, log_argument, log_metric
from good_ai.utilities.clean import clean
@log_metric('text_length', calculate=lambda text: len(text))
@log_argument('text', expected_type=str, validator=lambda t: len(t) > 0)
@use_model(model_key, version="latest")
def predict_domain(
text: str, model: Pipeline, cut_off_probability: float = 0.2