Esempio n. 1
0
                  E1=E1,
                  E2=E2,
                  E3=E3,
                  h1=h1,
                  h2=h2,
                  C1=C1,
                  C2=C2,
                  alpha12=alpha12,
                  alpha21=alpha21,
                  gamma12=gamma12,
                  gamma21=gamma21)

npoints = 8
npoints2 = 8
d1, d2 = grid(C1 / 1e2,
              C1 * 1e2,
              C2 / 1e2,
              C2 * 1e2,
              npoints,
              npoints2,
              include_zero=True)

E = truemodel.E(d1, d2)

noise = 0.05
E_fit = E + noise * (E0 - E3) * (2 * np.random.rand(len(E)) - 1)

model = MuSyC(variant="no_gamma")
model.fit(d1, d2, E_fit, bootstrap_iterations=100)

print(model.summary())
Esempio n. 2
0
              E3=E3,
              h1=h1,
              h2=h2,
              C1=C1,
              C2=C2,
              alpha12=alpha12,
              alpha21=alpha21,
              gamma12=gamma12,
              gamma21=gamma21)

npoints = 8
npoints2 = 12

D1, D2 = grid(1e-3 / 3, 1 / 3, 1e-2, 10, npoints, npoints2, include_zero=True)

E = model.E(D1, D2)
Efit = E * (1 + (np.random.rand(len(D1)) - 0.5) / 5.)

model.fit(D1, D2, Efit)
#%timeit model.fit(D1, D2, Efit)
#%timeit model.fit(D1, D2, Efit, use_jacobian=False)
# With Jacobian
# noise /5.
# 73.5 ms ± 965 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
# 63.7 ms ± 203 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

# Without Jacobian (frequently has "covariance of parameters" warning)
# noise /5.
# 26.1 ms ± 385 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
# 21.5 ms ± 422 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
# 29.6 ms ± 101 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
Esempio n. 3
0
              E2=E2,
              E3=E3,
              h1=h1,
              h2=h2,
              C1=C1,
              C2=C2,
              alpha12=alpha12,
              alpha21=alpha21,
              gamma12=gamma12,
              gamma21=gamma21)

npoints1 = 8
npoints2 = 10
D1, D2 = grid(1e-4, 10, 1e-4, 10, npoints1, npoints2, include_zero=True)

E = musyc.E(D1, D2)

# Build and fit ZIP model
zip_model = ZIP(synergyfinder=True)
zip_model.fit(D1, D2, E)

# Build and fit BRAID model
#braid_model = BRAID()
#braid_model.fit(D1, D2, E, bootstrap_iterations=100)

sfdf = pd.read_csv("synergyfinder_output.csv")
sfdf.sort_values(by=["d2", "d1"], inplace=True)

print("Correlation between this package and synergyfinder = %f" %
      np.corrcoef(zip_model.synergy, sfdf['synergy'])[0, 1])
fig = plt.figure(figsize=(4, 4))