Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 25.1.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.262'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.9.6'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
12 changes: 6 additions & 6 deletions delphi/log/result_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ def parse_score_file(file_path):
"total_examples": total_examples,
"total_positives": total_positives,
"total_negatives": total_negatives,
"positive_class_ratio": total_positives / total_examples
if total_examples > 0
else 0,
"negative_class_ratio": total_negatives / total_examples
if total_examples > 0
else 0,
"positive_class_ratio": (
total_positives / total_examples if total_examples > 0 else 0
),
"negative_class_ratio": (
total_negatives / total_examples if total_examples > 0 else 0
),
"failed_count": failed_count,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def from_string(cls, s: str) -> SimulationType:


def compute_expected_value(
norm_probabilities_by_distribution_value: OrderedDict[int, float]
norm_probabilities_by_distribution_value: OrderedDict[int, float],
) -> float:
"""
Given a map from distribution values (integers on the range [0, 10]) to normalized
Expand Down
12 changes: 5 additions & 7 deletions examples/score_explanations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,21 @@
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"from functools import partial\n",
"import os \n",
"import torch\n",
"\n",
"import orjson\n",
"import torch\n",
"\n",
"from delphi.clients import OpenRouter\n",
"from delphi.config import ExperimentConfig, LatentConfig\n",
"from delphi.explainers import explanation_loader\n",
"from delphi.latents import (\n",
" LatentDataset\n",
")\n",
"from delphi.latents import LatentDataset\n",
"from delphi.latents.constructors import default_constructor\n",
"from delphi.latents.samplers import sample\n",
"from delphi.pipeline import Pipeline, process_wrapper\n",
"from delphi.scorers import FuzzingScorer\n",
"\n",
"\n",
"\n",
"API_KEY = os.getenv(\"OPENROUTER_API_KEY\")"
]
},
Expand Down