Skip to content

Commit

Permalink
bin_width when list
Browse files Browse the repository at this point in the history
  • Loading branch information
ShreeshaM07 committed May 16, 2024
1 parent 7af0ff3 commit e676a1e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions skpro/distributions/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,19 @@ def _cut(self, x):
# to include it in the histogram
bins = []
range_x = max(x) - min(x)
if isinstance(self.bin_width, int):
bin_width = self._bc_params["bin_width"]
if isinstance(bin_width, int):
bins.append(min(x) - 0.001 * (range_x))
bin_width = self.bin_width
nbins = range_x / bin_width
for i in range(1, nbins):
bins.append(min(x) + i * bin_width)
bins.append(max(x) + 0.001 * (range_x))
elif isinstance(self.bins, list):
bins = self.bins.copy()
elif isinstance(bin_width, list):
bins.append(min(x) - 0.001 * (range_x))
nbins = len(bin_width)
for bw in bin_width:
bins.append(min(x) + bw)
bins.append(max(x) + 0.001 * (range_x))

self.bins = bins
return bins
Expand Down

0 comments on commit e676a1e

Please sign in to comment.