def __init__(self, project_name, model):
     self.project_name = project_name
     self.model = model
     self.data = DataRepository.provide_project_data(project_name)
     self.format_strategies = {
         'ttf': TTFFormatStrategy,
         'fpd': FPDFormatStrategy
     }
     self.format_strategy = self.choose_format_strategy(
         self.data.get_format())
Exemplo n.º 2
0
 def fit(self, project_name, **kwargs):
     fitted_stages = []
     for i in range(len(self.stages)):
         stage = self.stages[i]
         fit_strategy = self.get_model_strategy(stage.get_model())(project_name)
         data = DataRepository.provide_project_data(project_name)
         stage_number = i + 1
         stage_fitter = StageFitter()
         fitted_stage = stage_fitter.fit(stage, fit_strategy, data, stage_number, **kwargs)
         fitted_stages.append(fitted_stage)
     return MultistageFit(project_name, fitted_stages)
Exemplo n.º 3
0
from src.data.data_repository import DataRepository
from src.domain.models.delayed_s_shaped.delayed_s_shaped_estimator import DelayedSShapedEstimator
from src.domain.models.logistic.logistic_estimator import LogisticEstimator
from src.domain.fitters.model_fitter import ModelFitter

fpd_fitter = ModelFitter()

data = DataRepository.provide_project_data('mixed-waterfall-agile')
x_axis_data = data.get_formated_times()
cumulative_failures = data.get_cumulative_failures()

ds = DelayedSShapedEstimator()
log = LogisticEstimator()
'''

ds_fit = fpd_fitter.fit('delayed-s-shaped', 'mixed-waterfall-agile')
log_fit = fpd_fitter.fit('logistic', 'mixed-waterfall-agile')

ds_lsq_a = ds_fit.get_lsq_parameters()[0]
ds_lsq_b = ds_fit.get_lsq_parameters()[1]

log_lsq_a = log_fit.get_lsq_parameters()[0]
log_lsq_b = log_fit.get_lsq_parameters()[1]
log_lsq_c = log_fit.get_lsq_parameters()[2]

fig, axes = plt.subplots()
axes.set_xlabel('Tiempo (días)')
axes.set_ylabel('Numero esperado de fallas')
axes.set_xlim(left=0, auto=True)
axes.set_ylim(auto=True)
axes.patch.set_facecolor("#ffffff")
 def obtain_full_data(self, project_name):
     data = DataRepository.provide_project_data(project_name)
     return data.get_project_title(), [0] + data.get_times(), [0] + data.get_cumulative_failures()
ds_fit = ttf_fitter.fit('delayed-s-shaped',
                        'agile-n4',
                        initial_approx=(100, 0.001),
                        lsq_only=True,
                        mt_formula='regular')
log_fit = ttf_fitter.fit('logistic',
                         'agile-n4',
                         initial_approx=(30, 0.03, 300),
                         lsq_only=True,
                         mt_formula='regular')
bc_fit = ttf_fitter.fit('barraza-contagion',
                        'agile-n4',
                        lsq_only=True,
                        mt_formula='conditional')

data = DataRepository.provide_project_data('agile-n4')
real_tbf = data.get_time_between_failures()
x_axis_data = np.linspace(1, len(real_tbf), len(real_tbf))

ds_mtbf = ds_fit.get_all_mtbf()
log_mtbf = log_fit.get_all_mtbf()
bc_mtbf = bc_fit.get_all_mtbf()

fig, axes = plt.subplots(figsize=(6, 4))
axes.set_xlabel('Failure number', fontsize=12)
axes.xaxis.set_tick_params(labelsize=10)
axes.xaxis.labelpad = 4
axes.set_ylabel('Mean time between failures', fontsize=12)
axes.yaxis.set_tick_params(labelsize=10)
axes.yaxis.labelpad = 8
axes.set_xlim(left=0, auto=True)
 def setUpClass(cls):
     cls.ntds_data = DataRepository.provide_project_data('ntds')
     cls.ttf_formater = TTFDataFormater.get_instance()
import numpy as np
from matplotlib import pyplot as plt

from src.data.data_repository import DataRepository
from src.domain.models.barraza_contagion.barraza_contagion_estimator import BarrazaContagionEstimator
from src.domain.models.delayed_s_shaped.delayed_s_shaped_estimator import DelayedSShapedEstimator
from src.domain.models.goel_okumoto.goel_okumoto_estimator import GoelOkumotoEstimator
from src.domain.models.logistic.logistic_estimator import LogisticEstimator

go = GoelOkumotoEstimator()
ds = DelayedSShapedEstimator()
log = LogisticEstimator()
bc = BarrazaContagionEstimator()

ntds = DataRepository.provide_project_data('ntds')
ntds_data = ntds.get_data()
ntds_cumfailures = ntds.get_cumulative_failures()
n = ntds_cumfailures[-1]
tbf = ntds.get_time_between_failures()

a_go = 33.5994
b_go = 0.0063

a_ds = 26.7155
b_ds = 0.0212

a_log = 24.6114
b_log = 0.0413
c_log = 76.4858

a_bc = 0.3799
import numpy as np

from src.data.data_repository import DataRepository
from src.domain.fitters.model_fitter import ModelFitter
from src.domain.models.barraza_contagion.barraza_contagion_estimator import BarrazaContagionEstimator

import matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42

bc = BarrazaContagionEstimator()

agile1 = DataRepository.provide_project_data('agile-n1')
agile1_times = agile1.get_times()
agile1_cf = agile1.get_cumulative_failures()

ttf_fitter = ModelFitter()
agile1_fit = ttf_fitter.fit('barraza-contagion', 'agile-n1')

a_bc, b_bc = agile1_fit.get_lsq_parameters()
mean_values_bc = bc.calculate_mean_failure_numbers(agile1_times, a_bc, b_bc)
coef_r2 = np.var(mean_values_bc)/np.var(agile1_cf)

print("rho: ", a_bc)
print("gamma: ", b_bc * a_bc)
print("gamma/rho: ", b_bc)
print("r2: ", coef_r2)

plt.style.use('bmh')
from src.data.data_repository import DataRepository
from src.domain.models.barraza_contagion.barraza_contagion_estimator import BarrazaContagionEstimator
from src.domain.models.delayed_s_shaped.delayed_s_shaped_estimator import DelayedSShapedEstimator
from src.domain.models.logistic.logistic_estimator import LogisticEstimator

from matplotlib import pyplot as plt

ds = DelayedSShapedEstimator()
log = LogisticEstimator()
bc = BarrazaContagionEstimator()

agile2 = DataRepository.provide_project_data('agile-n2')
agile2_times = agile2.get_times()

a_ds = 370.3103
b_ds = 0.0025

a_log = 309.2426
b_log = 0.0047
c_log = 580.9822

a_bc = 0.2221
b_bc = 1.0479

mean_values_ds = ds.calculate_mean_failure_numbers(agile2_times, a_ds, b_ds)
mean_values_log = log.calculate_mean_failure_numbers(agile2_times, a_log, b_log, c_log)
mean_values_bc = bc.calculate_mean_failure_numbers(agile2_times, a_bc, b_bc)

fig, axes = plt.subplots()
axes.set_xlabel('Time (days)')
axes.set_ylabel('Number of failures')
 def print_project_name(self, project_name):
     self.reset_console_colors()
     project_data = DataRepository.provide_project_data(project_name)
     project_title = project_data.get_project_title()
     print((Fore.YELLOW + 'Project: ') +
           (Fore.LIGHTRED_EX + project_title) + "\n")
 def setUpClass(cls):
     cls.mixed_data = DataRepository.provide_project_data(
         'mixed-waterfall-agile')
     cls.fpd_formater = FPDDataFormater.get_instance()