Commit 05fabfb7 authored by Malthe Kjær Bisbo's avatar Malthe Kjær Bisbo
Browse files

moved OperationConstraint to utils, wrote __init__ in surrogate folder and...

moved OperationConstraint to utils, wrote __init__ in surrogate folder and changed some class names to have capital letters, changed candidate_operations folder to candidates
parent 62fa4a29
from surrogate.gpr import GPR
from surrogate.descriptor.fingerprint import Fingerprint
from surrogate.prior.prior import RepulsivePrior
__all__ = ['GPR', 'Fingerprint', 'RepulsivePrior']
\ No newline at end of file
......@@ -2,9 +2,9 @@ import numpy as np
from scipy.linalg import cholesky, cho_solve, solve_triangular
from scipy.optimize import fmin_l_bfgs_b
from surrogate.kernel import gauss_kernel, double_gauss_kernel
from surrogate.descriptor.fingerprint import Fingerprint
from surrogate.prior.prior import repulsive_prior
from surrogate.kernel import GaussKernel, DoubleGaussKernel
from surrogate import Fingerprint
from surrogate import RepulsivePrior
from surrogate.gpr_calculator import gpr_calculator
class gpr_memory():
......@@ -89,14 +89,14 @@ class GPR():
Nsplit_eta = self.descriptor.Nelements_2body
if kernel is 'single':
self.kernel = gauss_kernel(Nsplit_eta=Nsplit_eta)
self.kernel = GaussKernel(Nsplit_eta=Nsplit_eta)
elif kernel is 'double':
self.kernel = double_gauss_kernel(Nsplit_eta=Nsplit_eta)
self.kernel = DoubleGaussKernel(Nsplit_eta=Nsplit_eta)
self.kernel = kernel
if prior is None:
self.prior = repulsive_prior()
self.prior = RepulsivePrior()
self.prior = prior
......@@ -5,7 +5,7 @@ from scipy.spatial.distance import pdist, cdist, squareform
from time import time
class kernel(ABC):
class Kernel(ABC):
def __init__(self):
self._theta = None
......@@ -79,7 +79,7 @@ class kernel(ABC):
return dK_dTheta
class gauss_kernel(kernel):
class GaussKernel(Kernel):
def __init__(self, amplitude=100.0, amplitude_bounds=(1e0, 1e5),
length_scale=10.0, length_scale_bounds=(1e0, 1e3),
noise=1e-5, noise_bounds=None,
......@@ -284,7 +284,7 @@ class gauss_kernel(kernel):
class double_gauss_kernel(kernel):
class DoubleGaussKernel(Kernel):
def __init__(self, amplitude=100., amplitude_bounds=(1e1,1e5),
length_scale1=10.0, length_scale1_bounds=(1e0, 1e3),
length_scale2=10.0, length_scale2_bounds=(1e0, 1e3),
......@@ -44,8 +44,7 @@ def convert_atom_types(num):
num_converted[i] = j
return num_converted
class repulsive_prior():
class RepulsivePrior():
def __init__(self, rcut=6, ratio_of_covalent_radii=0.7):
self.rcut = rcut
self.ratio_of_covalent_radii = ratio_of_covalent_radii
......@@ -17,7 +17,6 @@ class test_gpr(unittest.TestCase):
def setUp(self):
#self.kernel = gauss_kernel()
a = read('structures.traj', index='0')
#self.gpr = gpr()
#self.gpr = gpr(kernel='double', template_structure=a)
import numpy as np
import unittest
from kernel import gauss_kernel, double_gauss_kernel
from kernel import GaussKernel, DoubleGaussKernel
class test_kernel(unittest.TestCase):
......@@ -14,11 +14,11 @@ class test_kernel(unittest.TestCase):
def setUp(self):
#self.kernel = gauss_kernel()
#self.kernel = GaussKernel()
#self.kernel_old = C(10, (1e1, 1e6)) * RBF(10, (1,1000))
#self.kernel = double_gauss_kernel(Nsplit_eta=2, eta=10)
self.kernel = gauss_kernel(Nsplit_eta=2, eta=10)
#self.kernel = DoubleGaussKernel(Nsplit_eta=2, eta=10)
self.kernel = GaussKernel(Nsplit_eta=2, eta=10)
def tearDown(self):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment