Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
nvocal: int = 95,
embedding_dim: int = 16,
nbvocal: int = None,
bond_embedding_dim: int = None,
ngvocal: int = None,
global_embedding_dim: int = None,
npass: int = 3,
ntarget: int = 1,
act: Callable = softplus2,
is_classification: bool = False,
loss: str = "mse",
metrics: List[str] = None,
l2_coef: float = None,
dropout: float = None,
graph_converter: StructureGraph = None,
target_scaler: Scaler = DummyScaler(),
optimizer_kwargs: Dict = None,
dropout_on_predict: bool = False
):
"""
Args:
nfeat_edge: (int) number of bond features
nfeat_global: (int) number of state features
nfeat_node: (int) number of atom features
nblocks: (int) number of MEGNetLayer blocks
lr: (float) learning rate
n1: (int) number of hidden units in layer 1 in MEGNetLayer
n2: (int) number of hidden units in layer 2 in MEGNetLayer
n3: (int) number of hidden units in layer 3 in MEGNetLayer
nvocal: (int) number of total element
embedding_dim: (int) number of embedding dimension
nbvocal: (int) number of bond types if bond attributes are types
nvocal: int = 95,
embedding_dim: int = 16,
nbvocal: int = None,
bond_embedding_dim: int = None,
ngvocal: int = None,
global_embedding_dim: int = None,
npass: int = 3,
ntarget: int = 1,
act: Callable = softplus2,
is_classification: bool = False,
loss: str = "mse",
metrics: List[str] = None,
l2_coef: float = None,
dropout: float = None,
graph_converter: StructureGraph = None,
target_scaler: Scaler = DummyScaler(),
optimizer_kwargs: Dict = None,
dropout_on_predict: bool = False
):
"""
Args:
nfeat_edge: (int) number of bond features
nfeat_global: (int) number of state features
nfeat_node: (int) number of atom features
nblocks: (int) number of MEGNetLayer blocks
lr: (float) learning rate
n1: (int) number of hidden units in layer 1 in MEGNetLayer
n2: (int) number of hidden units in layer 2 in MEGNetLayer
n3: (int) number of hidden units in layer 3 in MEGNetLayer
nvocal: (int) number of total element
embedding_dim: (int) number of embedding dimension
nbvocal: (int) number of bond types if bond attributes are types
def __init__(self,
model: Model,
graph_converter: StructureGraph,
target_scaler: Scaler = DummyScaler(),
metadata: Dict = None,
**kwargs):
"""
Args:
model: (keras model)
graph_converter: (object) a object that turns a structure to a graph,
check `megnet.data.crystal`
target_scaler: (object) a scaler object for converting targets, check
`megnet.utils.preprocessing`
metadata: (dict) An optional dict of metadata associated with the model.
Recommended to incorporate some basic information such as units,
MAE performance, etc.
"""
self.model = model
self.graph_converter = graph_converter
self.target_scaler = target_scaler
super().__init__()
if val_gen is None:
raise ValueError('No validation data is provided!')
self.verbose = verbose
if self.verbose > 0:
logging.basicConfig(level=logging.INFO)
self.filepath = filepath
self.save_best_only = save_best_only
self.save_weights_only = save_weights_only
self.period = period
self.epochs_since_last_save = 0
self.val_gen = val_gen
self.steps_per_val = steps_per_val
self.target_scaler = target_scaler
if self.target_scaler is None:
self.target_scaler = DummyScaler()
if monitor == 'val_mae':
self.metric = mae
self.monitor = 'val_mae'
elif monitor == 'val_acc':
self.metric = accuracy
self.filepath = self.filepath.replace('val_mae', 'val_acc')
self.monitor = 'val_acc'
if mode == 'min':
self.monitor_op = np.less
self.best = np.Inf
elif mode == 'max':
self.monitor_op = np.greater
self.best = -np.Inf
else:
val_units: List[str] = None,
is_pa: bool = False):
super().__init__()
self.train_gen = train_gen
self.val_gen = val_gen
self.steps_per_train = steps_per_train
self.steps_per_val = steps_per_val
self.yscaler = y_scaler
self.epochs = []
self.total_epoch = 0
self.n_every = n_every
self.val_names = val_names
self.val_units = val_units
self.is_pa = is_pa
if self.yscaler is None:
self.yscaler = DummyScaler()
def __init__(self,
model: Model,
graph_converter: StructureGraph,
target_scaler: Scaler = DummyScaler(),
metadata: Dict = None,
**kwargs):
"""
Args:
model: (keras model)
graph_converter: (object) a object that turns a structure to a graph,
check `megnet.data.crystal`
target_scaler: (object) a scaler object for converting targets, check
`megnet.utils.preprocessing`
metadata: (dict) An optional dict of metadata associated with the model.
Recommended to incorporate some basic information such as units,
MAE performance, etc.
"""
self.model = model
self.graph_converter = graph_converter
self.target_scaler = target_scaler