[BUG] - Stress-Strength Mixture_Model and Loglogistic errors
Closed this issue · 1 comments
Describe the bug
-
Mixture_Model is not an allowable input type for stress and strength - It would be helpful to add it
-
Loglogistic_Distribution when Beta < 1 raises TypeError
To Reproduce
from reliability.Other_functions import stress_strength
from reliability.Distributions import Loglogistic_Distribution
stress = Loglogistic_Distribution(alpha=20,beta=0.9)
strength = Loglogistic_Distribution(alpha=20,beta=0.9)
stress_strength(stress=stress, strength=strength, warn=False)
TypeError: '>' not supported between instances of 'float' and 'str'
due to the Loglogistic mean definition:
if self.beta > 1:
self.mean = float(
ss.fisk.stats(self.beta, scale=self.alpha, loc=self.gamma, moments="m")
)
else:
self.mean = r"no mean when $\beta \leq 1$"
easiest fix might be to nest the "if stress.mean > strength.mean" inside of "if warn == True:" to allow suppressing the warning/error... or more specific error handling for this specific case.
For the Mixture_Model:
from reliability.Fitters import Fit_Weibull_Mixture
from reliability.Other_functions import stress_strength
from reliability.Distributions import Weibull_Distribution
stress = Weibull_Distribution(alpha=2,beta=3,gamma=1)
strength = Fit_Weibull_Mixture([1,2,3,4], show_probability_plot=False, print_results=False).distribution
stress_strength(stress=stress, strength=strength)
ValueError: Stress and Strength must both be probability distributions. First define the distribution using reliability.Distributions.___
if I add the Mixture_Model to the stress_strength function, then it works fine except for plot and print_results, which returns:
AttributeError: 'Mixture_Model' object has no attribute 'param_title_long'
Could add a generic param_title_long ( 'Mixture_Model') to the Mixture_Model class to be able to use these, otherwise I'm fine with turning plot and print off for now...
Fixed in v0.8.15.
Thanks for reporting this bug and feature request.