Пример #1
0

if __name__ == '__main__':

    # Calculate various skill metrics, writing results to screen
    # and Excel file. Use an ordered dictionary so skill metrics are
    # saved in the Excel file in the same order as written to screen.
    stats = OrderedDict()

    # Read data from pickle file
    data = load_obj('target_data')
    pred = data.pred1['data']
    ref = data.ref['data']

    # Get bias
    stats['bias'] = sm.bias(pred, ref)
    print('Bias = ' + str(stats['bias']))

    # Get Root-Mean-Square-Deviation (RMSD)
    stats['rmsd'] = sm.rmsd(pred, ref)
    print('RMSD = ' + str(stats['rmsd']))

    # Get Centered Root-Mean-Square-Deviation (CRMSD)
    stats['crmsd'] = sm.centered_rms_dev(pred, ref)
    print('CRMSD = ' + str(stats['crmsd']))

    # Get Standard Deviation (SDEV)
    stats['sdev'] = np.std(pred)
    print('SDEV = ' + str(stats['sdev']))

    # Get correlation coefficient (r)
Пример #2
0
plt.scatter(fechan, realn, color='black', label='Data')  # datos iniciales
plt.plot(fechan, testn, color='red', label='Modelo RBF')  # RBF kernel
plt.title('Tunal (Nov 22 y 23)')
#plt.plot(fechas,svr_lin.predict(fechas), color= 'green', label= 'Modelo Lineal') # lineal kernel
#plt.plot(fechas,svr_poly.predict(fechas), color= 'blue', label= 'Modelo Polinomial') # Polinomial kernel
plt.xlabel('Horas')
plt.ylabel('Concentracion de PM_25')
plt.legend()
plt.savefig('Tun_Nov_22-23.png')
plt.show()
plt.close()

print('------ Febrero 14 y 15 de 2019 ------')
print(np.corrcoef(real, test))
print(sm.rmsd(test, np.array(real)))
print(sm.bias(test, np.array(real)))

print('------ Noviembre 22 y 23 de 2018 ------')
print(np.corrcoef(realn, testn))
print(sm.rmsd(testn, np.array(realn)))
print(sm.bias(testn, np.array(realn)))

##### Create files
## Feb
soda = {'SVR_tun': test.tolist()}
df = pd.DataFrame(soda, columns=['SVR_tun'])
df.to_csv('tun_feb_svr.csv')

## Nov
soda = {'SVR_tun': test.tolist()}
df = pd.DataFrame(soda, columns=['SVR_tun'])