Fit_Everything_ALT
- class reliability.ALT_fitters.Fit_Everything_ALT(failures, failure_stress_1=None, failure_stress_2=None, right_censored=None, right_censored_stress_1=None, right_censored_stress_2=None, use_level_stress=None, CI=0.95, optimizer=None, show_probability_plot=True, show_best_distribution_probability_plot=True, print_results=True, exclude=None, sort_by='BIC', **kwargs)
This function will fit all available ALT models for the data you enter, which may include right censored data.
ALT models are either single stress (Exponential, Eyring, Power) or dual stress (Dual_Exponential, Power_Exponential, Dual_Power).
Depending on the data you enter (ie. whether failure_stress_2 is provided), the applicable set of ALT models will be fitted.
- Parameters:
failures (array, list) – The failure data.
failure_stress_1 (array, list, optional) – The corresponding stresses (such as temperature or voltage) at which each failure occurred. This must match the length of failures as each failure is tied to a failure stress. Alternative keyword of failure_stress is accepted in place of failure_stress_1.
failure_stress_2 (array, list, optional) – The corresponding stresses (such as temperature or voltage) at which each failure occurred. This must match the length of failures as each failure is tied to a failure stress. Optional input. Providing this will trigger the use of dual stress models. Leaving this empty will trigger the use of single stress models.
right_censored (array, list, optional) – The right censored failure times. Optional input.
right_censored_stress_1 (array, list, optional) – The corresponding stresses (such as temperature or voltage) at which each right_censored data point was obtained. This must match the length of right_censored as each right_censored value is tied to a right_censored stress. Conditionally optional input. This must be provided if right_censored is provided. Alternative keyword of right_censored_stress is accepted in place of right_censored_stress_1.
right_censored_stress_2 (array, list, optional) – The corresponding stresses (such as temperature or voltage) at which each right_censored data point was obtained. This must match the length of right_censored as each right_censored value is tied to a right_censored stress. Conditionally optional input. This must be provided if failure_stress_2 is provided.
use_level_stress (int, float, list, array, optional) – The use level stress at which you want to know the mean life. Optional input. This must be a list or array [stress_1,stress_2] if failure_stress_2 is provided and you want to know the mean life.
print_results (bool, optional) – True/False. Default is True. Prints the results to the console.
show_probability_plot (bool, optional) – True/False. Default is True. Provides a probability plot of each of the fitted ALT model.
show_best_distribution_probability_plot (bool, optional) – True/False. Defaults to True. Provides a probability plot in a new figure of the best ALT model.
CI (float, optional) – Confidence interval for estimating confidence limits on parameters. Must be between 0 and 1. Default is 0.95 for 95% CI.
optimizer (str, optional) – The optimization algorithm used to find the solution. Must be either ‘TNC’, ‘L-BFGS-B’, ‘nelder-mead’, or ‘powell’. Specifying the optimizer will result in that optimizer being used. To use all of these specify ‘best’ and the best result will be returned. The default behaviour is to try each optimizer in order (‘TNC’, ‘L-BFGS-B’, ‘nelder-mead’, and ‘powell’) and stop once one of the optimizers finds a solution. If the optimizer fails, the initial guess will be returned. For more detail see the documentation.
sort_by (str, optional) – Goodness of fit test to sort results by. Must be ‘BIC’,’AICc’, or ‘Log-likelihood’. Default is ‘BIC’.
exclude (list, array, optional) – A list or array of strings specifying which distributions to exclude. Default is None. Options are: Weibull_Exponential, Weibull_Eyring, Weibull_Power, Weibull_Dual_Exponential, Weibull_Power_Exponential, Weibull_Dual_Power, Lognormal_Exponential, Lognormal_Eyring, Lognormal_Power, Lognormal_Dual_Exponential, Lognormal_Power_Exponential, Lognormal_Dual_Power, Normal_Exponential, Normal_Eyring, Normal_Power, Normal_Dual_Exponential, Normal_Power_Exponential, Normal_Dual_Power, Exponential_Exponential, Exponential_Eyring, Exponential_Power, Exponential_Dual_Exponential, Exponential_Power_Exponential, Exponential_Dual_Power
kwargs – Accepts failure_stress and right_censored_stress as alternative keywords to failure_stress_1 and right_censored_stress_1. This is used to provide consistency with the other functions in ALT_Fitters which also accept failure_stress and right_censored_stress.
- Returns:
results (dataframe) – The dataframe of results. Fitted parameters in this dataframe may be accessed by name. See below example.
best_model_name (str) – The name of the best fitting ALT model. E.g. ‘Weibull_Exponential’. See above list for exclude.
best_model_at_use_stress (object) – A distribution object created based on the parameters of the best fitting ALT model at the use stress. This is only provided if the use_level_stress is provided. This is because use_level_stress is required to find the scale parameter.
parameters and goodness of fit results (float) – This is provided for each fitted model. For example, the Weibull_Exponential model values are Weibull_Exponential_a, Weibull_Exponential_b, Weibull_Exponential_beta, Weibull_Exponential_BIC, Weibull_Exponential_AICc, Weibull_Exponential_loglik
excluded_models (list) – A list of the models which were excluded. This will always include at least half the models since only single stress OR dual stress can be fitted depending on the data.
probability_plot (object) – The figure handle from the probability plot (only provided if show_probability_plot is True).
best_distribution_probability_plot (object) – The figure handle from the best distribution probability plot (only provided if show_best_distribution_probability_plot is True).
Notes
From the results, the models are sorted based on their goodness of fit test results, where the smaller the goodness of fit value, the better the fit of the model to the data.
Example Usage:
failures = [619, 417, 173, 161, 1016, 512, 999, 1131, 1883, 2413, 3105, 2492] failure_stresses = [500, 500, 500, 500, 400, 400, 400, 400, 350, 350, 350, 350] right_censored = [29, 180, 1341] right_censored_stresses = [500, 400, 350] use_level_stress = 300 output = Fit_Everything_ALT(failures=failures,failure_stress_1=failure_stresses,right_censored=right_censored, right_censored_stress_1=right_censored_stresses, use_level_stress=use_level_stress) # To extract the parameters of the Weibull_Exponential model from the results dataframe, you may access the parameters by name: print('Weibull Exponential beta =',output.Weibull_Exponential_beta) >>> Weibull Exponential beta = 3.0807072337386123