Skip to content
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
ENH: speed up _harmonize_tensor
Common case is just a single element, thus that the overhead of NumPy is
very large.
  • Loading branch information
Weh Andreas committed Jan 5, 2025
commit ac2c6ddba3789ba66fdc0b432b237a151d849cde
4 changes: 2 additions & 2 deletions python/interpret-core/interpret/glassbox/_ebm/_merge_ebms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import warnings
from collections.abc import Sequence
from itertools import chain, count
from math import isnan
from math import isnan, prod
from typing import List, Type

import numpy as np
Expand Down Expand Up @@ -257,7 +257,7 @@ def _harmonize_tensor(
map_bins[bin_idx]
for map_bins, bin_idx in zip(mapping, old_reversed_bin_idxs)
]
n_cells2 = np.prod([len(x) for x in cell_map])
n_cells2 = prod(map(len, cell_map))
val = 0 if n_multiclasses == 1 else np.zeros(n_multiclasses, np.float64)
total_weight = 0.0
for cell2_idx in range(n_cells2):
Expand Down
Loading