Skip to content

Commit

Permalink
bugfix for v0.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewReid854 committed May 5, 2022
1 parent 5c481b0 commit 8264678
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
11 changes: 11 additions & 0 deletions docs/Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
Changelog
---------

**Version: 0.8.4 --- Released: 05 May 2022**
''''''''''''''''''''''''''''''''''''''''''''

**Summary of changes**

This is bugfix release to deal with a minor bug.

**Bug Fixes**

- Weibull Mixture models and Weibull Competing Risks models obtain their initial guesses by splitting the data into two groups and fitting a Weibull distribution to each group. If there are not two distinct groups, the estimate for the dividing line between the two groups may result in one of the groups having fewer than 2 failures allocated to the group. This causes an error when fitting the Weibull distribution to that group. It has been fixed by checking the number of elements in the group and moving the dividing line if required. The dividing line is only an estimate used to obtain the initial guess for the parameters and the dividing line is not used in the final MLE or LS estimates in the fitter.

**Version: 0.8.3 --- Released: 17 Apr 2022**
''''''''''''''''''''''''''''''''''''''''''''

Expand Down
18 changes: 18 additions & 0 deletions reliability/Fitters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3679,6 +3679,15 @@ def __init__(
else:
dividing_line = right_div_line

number_of_items_in_group_1 = len(np.where(failures<dividing_line)[0])
number_of_items_in_group_2 = len(failures) - number_of_items_in_group_1
if number_of_items_in_group_1 < 2:
failures_sorted = np.sort(failures)
dividing_line = (failures_sorted[1]+failures_sorted[2])/2 # adjusts the dividing line in case there aren't enough failures in the first group
if number_of_items_in_group_2 < 2:
failures_sorted = np.sort(failures)
dividing_line = (failures_sorted[-2]+failures_sorted[-3])/2 # adjusts the dividing line in case there aren't enough failures in the second group

# this is the point at which data is assigned to one group or another for the purpose of generating the initial guess
GROUP_1_failures = []
GROUP_2_failures = []
Expand Down Expand Up @@ -4164,6 +4173,15 @@ def __init__(
else:
dividing_line = right_div_line

number_of_items_in_group_1 = len(np.where(failures<dividing_line)[0])
number_of_items_in_group_2 = len(failures) - number_of_items_in_group_1
if number_of_items_in_group_1 < 2:
failures_sorted = np.sort(failures)
dividing_line = (failures_sorted[1]+failures_sorted[2])/2 # adjusts the dividing line in case there aren't enough failures in the first group
if number_of_items_in_group_2 < 2:
failures_sorted = np.sort(failures)
dividing_line = (failures_sorted[-2]+failures_sorted[-3])/2 # adjusts the dividing line in case there aren't enough failures in the second group

# this is the point at which data is assigned to one group or another for the purpose of generating the initial guess
GROUP_1_failures = []
GROUP_2_failures = []
Expand Down
2 changes: 1 addition & 1 deletion reliability/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from datetime import date

__title__ = 'reliability'
__version__ = "0.8.3"
__version__ = "0.8.4"
__description__ = 'A Python library for reliability engineering'
__url__ = 'https://reliability.readthedocs.io/en/latest/index.html'
__author__ = 'Matthew Reid'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="reliability",
version="0.8.3",
version="0.8.4",
description="Reliability Engineering toolkit for Python",
author="Matthew Reid",
author_email="alpha.reliability@gmail.com",
Expand Down

0 comments on commit 8264678

Please sign in to comment.