Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.
Merged
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
13 changes: 12 additions & 1 deletion ocean/mip/_explainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import warnings

import gurobipy as gp
import numpy as np
from sklearn.ensemble import IsolationForest

from ..abc import Mapper
Expand Down Expand Up @@ -46,13 +47,23 @@ def __init__(
max_samples=max_samples,
name=name,
env=env,
epsilon=epsilon,
epsilon=self.__find_best_num_epsilon(epsilon, mapper),
num_epsilon=num_epsilon,
model_type=model_type,
flow_type=flow_type,
)
self.build()

@staticmethod
def __find_best_num_epsilon(
epsilon: float, mapper: Mapper[Feature]
) -> float:
eps = epsilon
for f in mapper.values():
if f.is_numeric:
eps = min(eps, *np.diff(f.levels) / 2.0)
return eps

def get_objective_value(self) -> float:
return self.ObjVal

Expand Down