Skip to content

Instantly share code, notes, and snippets.

@andersx
Created April 5, 2017 15:12
Show Gist options
  • Select an option

  • Save andersx/d500d007c0e28af5ba22f925e63bd4c8 to your computer and use it in GitHub Desktop.

Select an option

Save andersx/d500d007c0e28af5ba22f925e63bd4c8 to your computer and use it in GitHub Desktop.
lol learningcurve
#!/usr/bin/env python2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib
matplotlib.rcParams['xtick.minor.size'] = 0
matplotlib.rcParams['xtick.minor.width'] = 0
cmat_H = np.array([0.01411625284730, 0.01156763771220, 0.01028136505150, 0.00922856778135,
0.00832607218566, 0.00753118369583, 0.00680493804346])
cmat_C = np.array([0.05209449056730, 0.04311612940300, 0.03621917068040, 0.03045724774640,
0.02567189952020, 0.02190313628230, 0.01860507453570])
cmat_N= np.array([0.0594763460734,0.0498454460526,0.0418617840876,0.0344605890075,
0.0287360921768,0.0235323935813,0.0188990017579])
cmat_O = np.array([ 0.0351159819664, 0.0306679911167, 0.0261231594199, 0.0219098131318,
0.0183183159273, 0.0148631312546, 0.0120398243948])
arad_H = np.array([0.00524686981787, 0.00473619017511, 0.00444523921688, 0.00420098359973,
0.00404343236846, 0.00390155524685, 0.00377452758820])
arad_C = np.array([
#0.0187120144857,
#0.0153668990028,
#0.0134273947451,
#0.0123309197662,
#0.0114507572425,
#0.0108264804567])
0.0187820298058,
0.015345503611 ,
0.0132067065705 ,
0.01205056773 ,
0.0110997907916 ,
0.0103383808794 ,
0.00977683984923])
arad_N = np.array([
0.0164562555084 ,
0.0140631254927 ,
0.0123373305615 ,
0.0111841105441 ,
0.0104071189521 ,
0.00974294172462,
0.0091474878246 ])
arad_O = np.array([
0.00905516433996,
0.00766256408912,
0.00668741322232,
0.0060874760913 ,
0.0056748987601 ,
0.00538127070123,
0.00513132918469])
def major_formatter(x, pos):
return "%2.0f" % x
def minor_formatter(x, pos):
return "%4.3f" % x
def off_formatter(x, pos):
return ""
sizes = np.array([1000, 2000, 4000, 8000, 16000, 32000, 64000])
ax = plt.subplot(1, 1, 1)
plt.loglog(sizes, cmat_H, color="gray", linestyle="--", marker=".", label="H/CM")
plt.loglog(sizes, cmat_C, color="black", linestyle="--", marker=".", label="C/CM")
plt.loglog(sizes, cmat_N, color="blue", linestyle="--", marker=".", label="N/CM")
plt.loglog(sizes, cmat_O, color="red", linestyle="--", marker=".", label="O/CM")
plt.loglog(sizes, arad_H, color="gray", marker=".", label="H/ARAD")
plt.loglog(sizes, arad_C, color="black", marker=".", label="C/ARAD")
plt.loglog(sizes, arad_N, color="blue", marker=".", label="N/ARAD")
plt.loglog(sizes, arad_O, color="red", marker=".", label="O/ARAD")
ax.set_xticks(sizes)
ax.xaxis.set_major_formatter(ticker.FuncFormatter(major_formatter))
ax.xaxis.set_minor_formatter(ticker.FuncFormatter(off_formatter))
# ax.set_yticks(np.array([0.003, 0.004, 0.005, 0.006, 0.007, 0.008,
# 0.009, 0.010, 0.011, 0.012, 0.013, 0.014, 0.015]))
ax.set_yticks(np.array([0.003, 0.004, 0.005, 0.006, 0.007, 0.008,
0.009, 0.010, 0.020, 0.030, 0.040, 0.050, 0.060]))
ax.yaxis.set_major_formatter(ticker.FuncFormatter(minor_formatter))
ax.yaxis.set_minor_formatter(ticker.FuncFormatter(off_formatter))
ax.set(ylabel='MAE partial charge [e]',
xlabel='# Atoms (training)',
title="DFTB3 Mulliken charge prediction // GDB9")
ax.set_xlim(1000, 64000)
ax.set_ylim(0.003, 0.06)
plt.legend(loc="upper right", ncol=2)
plt.grid(True)
plt.savefig("mae.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment