Instructions to use Delower/liver-extratrees-deployment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use Delower/liver-extratrees-deployment with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("Delower/liver-extratrees-deployment", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
File size: 1,000 Bytes
f389d38 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # validate.py — loads the shipped ExtraTrees deployment weights and
# reproduces the model's predictions on examples.json (8 DPP-4 leads
# screened with this exact model; expected probabilities stored
# alongside the SMILES). Exits non-zero if any reproduced probability
# deviates by > 1e-6 (the model is deterministic).
import json, os, sys
HERE = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, HERE)
from infer import predict
examples = json.load(open(os.path.join(HERE, "examples.json")))
worst = 0.0
for ex in examples:
got = predict(ex["smiles"])
exp = ex["expected_Liver_ExtraTrees_deployment_prob"]
assert got is not None, f"unparseable example: {ex['lead_id']}"
dev = abs(got - exp)
worst = max(worst, dev)
print(f"{ex['lead_id']:>8} expected {exp:.6f} got {got:.6f} dev {dev:.2e}")
assert dev <= 1e-6, f"deviation too large for {ex['lead_id']}: {dev}"
print(f"VALIDATION PASSED — max deviation {worst:.2e} over {len(examples)} examples")
|