) for coef in coeficientes_confianca: arq_destino.write( '=============================================================================\n' ) arq_destino.write('Coeficiente de Confiança = %s\n' % (coef)) arq_destino.write( '=============================================================================\n' ) arq_destino.write('\n') for prob in probs: df_prob = udata.filtrarPorProbabilidadeErro(df, prob) for size in sizes: df_size = udata.filtrarPorTamanhoArray(df_prob, size) for alg in algs: df_alg = udata.filtrarPorAlgoritmo(df_size, alg) if (df_alg.shape[0] > 0): arq_destino.write(col) arq_destino.write('\n') arq_destino.write( 'Coef. Confiança = %s; Prob = %s; Size = %s; Alg = %s' % (coef, prob, size, alg)) arq_destino.write('\n') data = df_alg[col] lim_inferior, mean, lim_superior, h, std_error, std_dev = mean_confidence_interval( data, confidence=coef) arq_csv_destino.write( printCsvInfo(coef, prob, size, alg, col,
arq_destino.write(s + '\n') s = ' - f_statistic = %.15f / p_value = %.15f' % (f_statistic, p_value) print(s) arq_destino.write(s+'\n') colunas_desc = udata.COL_NAMES for prob in udata.PROBABILIDADES: for size in udata.TAMANHOS: df = udata.obterDados2() df = udata.filtrarPorProbabilidadeErro(df, prob=prob) df = udata.filtrarPorTamanhoArray(df, tamanho=size) if (df.shape[0] > 0): arq_name = 'anova_prob_%s_tam_%s' % (prob, size) arq_destino = os.path.join(path_arq_destino, '%s.txt' % (arq_name)) if os.path.exists(arq_destino): os.remove(arq_destino) arq_destino = open(arq_destino, 'w+') csv_destino = os.path.join(path_arq_destino, 'csv/%s' % (arq_name)) head_n = 1000 df_bubble = df[df[udata.obterNomeColuna('algoritmo')] == 'bubble']#.head(head_n) df_merge = df[df[udata.obterNomeColuna('algoritmo')] == 'merge']#.head(head_n) df_insertion = df[df[udata.obterNomeColuna('algoritmo')] == 'insertion']#.head(head_n)
def salvarGrafico(df_p, file_title, tam): # df_p.loc[:]['size_of_array'] = tam print(df_p['size_of_array'].unique()) corr = df_p.corr() #.round(decimal=3) print(corr) fig = plt.figure() sns.heatmap(corr, annot=True) #, cmap='coolwarm') fig.savefig( 'graficos/_%s.png' % (file_title), bbox_inches='tight', pad_inches=2 ) # , format='png', orientation='landscape', papertype='letter') plt.close(fig) q1 = udata.obterDados() q1 = udata.filtrarPorTamanhoArray(q1, 100) print(q1.corr()) df = udata.obterDados() # salvarGrafico(df=df, file_title='teste-04-correlacao-0-geral') for prob in udata.PROBABILIDADES: df_prob = udata.filtrarPorProbabilidadeErro(df, prob) # print( df_prob.shape ) # print(df_alg.shape) for tam in udata.TAMANHOS: # print('%.2f-%s-%s' % (prob, alg, tam)) df_tam = udata.filtrarPorTamanhoArray(df_prob, tam) for alg in udata.ALGORTIMOS: df_alg = udata.filtrarPorAlgoritmo(df_tam, alg) # print(df_tam.head())