Skip to content

Commit 52b1f14

Browse files
committed
Added seed parameter to search based HPI games interfaces.
1 parent 9ed29af commit 52b1f14

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/hypershap/hypershap.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ def tunability(
243243
index: str = "FSII",
244244
order: int = 2,
245245
n_samples: int = 10_000,
246+
seed: int | None = 0,
246247
) -> InteractionValues:
247248
"""Compute and return the interaction values for tunability analysis.
248249
@@ -251,6 +252,7 @@ def tunability(
251252
index (str, optional): The index to use for computing interaction values. Defaults to "FSII".
252253
order (int, optional): The order of the interaction values. Defaults to 2.
253254
n_samples (int, optional): The number of samples to use for simulating HPO. Defaults to 10_000.
255+
seed (int, optiona): The random seed for simulating HPO. Defaults to 0.
254256
255257
Returns:
256258
InteractionValues: The computed interaction values.
@@ -278,6 +280,7 @@ def tunability(
278280
explanation_task=tunability_task,
279281
n_samples=n_samples,
280282
mode=Aggregation.MAX,
283+
seed=seed,
281284
),
282285
n_workers=self.n_workers,
283286
verbose=self.verbose,
@@ -298,6 +301,7 @@ def sensitivity(
298301
index: str = "FSII",
299302
order: int = 2,
300303
n_samples: int = 10_000,
304+
seed: int | None = 0,
301305
) -> InteractionValues:
302306
"""Compute and return the interaction values for sensitivity analysis.
303307
@@ -306,6 +310,7 @@ def sensitivity(
306310
index (str, optional): The index to use for computing interaction values. Defaults to "FSII".
307311
order (int, optional): The order of the interaction values. Defaults to 2.
308312
n_samples (int, optional): The number of samples to use for simulating HPO. Defaults to 10_000.
313+
seed (int, optiona): The random seed for simulating HPO. Defaults to 0.
309314
310315
Returns:
311316
InteractionValues: The computed interaction values.
@@ -333,6 +338,7 @@ def sensitivity(
333338
explanation_task=sensitivity_task,
334339
n_samples=n_samples,
335340
mode=Aggregation.VAR,
341+
seed=seed,
336342
),
337343
n_workers=self.n_workers,
338344
verbose=self.verbose,
@@ -353,6 +359,7 @@ def mistunability(
353359
index: str = "FSII",
354360
order: int = 2,
355361
n_samples: int = 10_000,
362+
seed: int | None = 0,
356363
) -> InteractionValues:
357364
"""Compute and return the interaction values for mistunability analysis.
358365
@@ -361,6 +368,7 @@ def mistunability(
361368
index (str, optional): The index to use for computing interaction values. Defaults to "FSII".
362369
order (int, optional): The order of the interaction values. Defaults to 2.
363370
n_samples (int, optional): The number of samples to use for simulating HPO. Defaults to 10_000.
371+
seed (int, optiona): The random seed for simulating HPO. Defaults to 0.
364372
365373
Returns:
366374
InteractionValues: The computed interaction values.
@@ -388,6 +396,7 @@ def mistunability(
388396
explanation_task=mistunability_task,
389397
n_samples=n_samples,
390398
mode=Aggregation.MIN,
399+
seed=seed,
391400
),
392401
n_workers=self.n_workers,
393402
verbose=self.verbose,

0 commit comments

Comments
 (0)