switch
This commit is contained in:
parent
faba2494b2
commit
f30c6ceaa1
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import pickle
|
||||
|
||||
import numpy as np
|
||||
from sklearn.linear_model import LogisticRegression
|
||||
|
@ -67,6 +68,10 @@ def plot_bandwidth(val_choice, test_results):
|
|||
|
||||
bandwidths, results = zip(*test_results[dataset_name])
|
||||
|
||||
print(dataset_name)
|
||||
print(bandwidths)
|
||||
print(results)
|
||||
|
||||
# Crear la gráfica
|
||||
plt.figure(figsize=(8, 6))
|
||||
|
||||
|
@ -74,12 +79,12 @@ def plot_bandwidth(val_choice, test_results):
|
|||
plt.plot(bandwidths, results, marker='o')
|
||||
|
||||
# Agregar la línea vertical en bandwidth_chosen
|
||||
plt.axvline(x=val_choice[dataset_name], color='r', linestyle='--', label=f'Bandwidth elegido: {val_choice[dataset_name]}')
|
||||
plt.axvline(x=val_choice[dataset_name], color='r', linestyle='--', label=f'bandwidth mod-sel: {val_choice[dataset_name]}')
|
||||
|
||||
# Agregar etiquetas y título
|
||||
plt.xlabel('Bandwidth')
|
||||
plt.ylabel('Resultado')
|
||||
plt.title('Gráfica de Bandwidth vs Resultado')
|
||||
plt.ylabel('MAE')
|
||||
plt.title('bandwidth vs score')
|
||||
|
||||
# Mostrar la leyenda
|
||||
plt.legend()
|
||||
|
@ -89,16 +94,25 @@ def plot_bandwidth(val_choice, test_results):
|
|||
# plt.show()
|
||||
os.makedirs('./plots', exist_ok=True)
|
||||
plt.savefig(f'./plots/{dataset_name}.png')
|
||||
plt.close()
|
||||
|
||||
|
||||
|
||||
for dataset in datasets():
|
||||
print('NAME', dataset.name)
|
||||
print(len(dataset.training))
|
||||
print(len(dataset.test))
|
||||
|
||||
if DEBUG:
|
||||
result_path = f'./results/debug/{dataset.name}.pkl'
|
||||
else:
|
||||
result_path = f'./results/{dataset.name}.pkl'
|
||||
|
||||
modsel_choice, dataset_results = qp.util.pickled_resource(result_path, experiment_dataset, dataset)
|
||||
#modsel_choice, dataset_results = qp.util.pickled_resource(result_path, experiment_dataset, dataset)
|
||||
if os.path.exists(result_path):
|
||||
modsel_choice, dataset_results = pickle.load(open(result_path, 'rb'))
|
||||
else:
|
||||
continue
|
||||
val_choice[dataset.name] = modsel_choice
|
||||
test_results[dataset.name] = dataset_results
|
||||
|
||||
|
|
Loading…
Reference in New Issue