def main(): ########################## # CONFIG ########################## seeds = [11,7,13,19,5189,600,1000,1500,1500,1500, 1000] size = [50,100,250,500,1000,1500,2000,2500,3000,3500,7000] epcohs = [] ########################## ########################## ########################## # RUN THE EXPERIMENTS ########################## # Throw the experiments for exp in range(5): print(f">>>> EXPERIMENTO: {exp + 1} <<<<") results = [] for i,seed in enumerate(seeds): np.random.seed(seed) vetor = gera_seq_aleatoria(size[i]) cron = Cronometro() cron.Iniciar() conta_somas(vetor) cron.Parar() results.append(cron.Exibir()) print(f"Tempo gasto com {size[i]} elementos foi {cron} segundos") del vetor del cron epcohs.append(results) print() ########################## ########################## ########################## # PLOT THE RESULTS ########################## # Generate the scatter X and Y scatter_x = size * len(epcohs) scatter_y = np.concatenate(epcohs) # Create a polinomial function of 1 dimension fit_fn = np.poly1d(np.polyfit(scatter_x,scatter_y,1)) plt.title("Resultados") # PLOT: Linear Regression line, = plt.plot(scatter_x, fit_fn(scatter_x), '--', c="#0c29d0") line.set_dashes([10,5,10,5]) # PLOT: Poly Regression plt.plot(size, np.mean(epcohs, axis=0), c="#ff5900", label="Regressão Poly") # PLOT: STM plt.fill_between(size, np.min(epcohs, axis=0), np.max(epcohs, axis=0), alpha=.3, facecolor="#ff5900", label="Desvio") # PLOT: Scatter plt.scatter(scatter_x, scatter_y, c="#0c29d0", label="Tempos") plt.legend(['Tendência', 'Regressão Polinomial', 'Desvio', 'Tempos']) plt.show()