Skip to content

Commit

Permalink
Merge branch 'uf3:master' into drop_columns_2
Browse files Browse the repository at this point in the history
  • Loading branch information
monk-04 authored Oct 11, 2023
2 parents b1e8dee + 311ade2 commit d1cd6f2
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,12 @@ uf3/util/__pycache__/plotting.cpython-37.pyc
uf3/util/__pycache__/subsample.cpython-37.pyc

lammps_plugin/ML-UF3/.vscode/

.vscode/

*/__pycache__

*/*/__pycache__

*/*/*/__pycache__

2 changes: 2 additions & 0 deletions lammps_plugin/ML-UF3/uf3_pair_bspline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,6 @@ double uf3_pair_bspline::memory_usage()
bytes += (double)dnbspline_bases[i].memory_usage(); //bspline_basis2

bytes += (double)2*sizeof(double); //ret_val

return bytes;
}
2 changes: 2 additions & 0 deletions uf3/default_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ learning:
weight: 0.5
regularizer:
ridge_1b: 1.0e-8
ridge_2b: 0.0
ridge_3b: 1.0e-5
curvature_2b: 1.0e-8
curvature_3b: 1.0e-8
18 changes: 9 additions & 9 deletions uf3/regression/least_squares.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,9 @@ def batched_predict(self,
Returns:
y_e (np.ndarray): target values for energies.
p_e (np.ndarray): prediction values for forces.
y_f (np.ndarray): target values for energies.
p_f (np.ndarray): target values for forces.
p_e (np.ndarray): prediction values for energies.
y_f (np.ndarray): target values for forces.
p_f (np.ndarray): prediction values for forces.
rmse_e (np.ndarray): RMSE across energy predictions.
rmse_e (np.ndarray): RMSE across force predictions.
drop_columns (list): list of columns to drop. Used when modifying
Expand Down Expand Up @@ -949,9 +949,9 @@ def subset_prediction(df: pd.DataFrame,
Returns:
y_e (np.ndarray): target values for energies.
p_e (np.ndarray): prediction values for forces.
y_f (np.ndarray): target values for energies.
p_f (np.ndarray): target values for forces.
p_e (np.ndarray): prediction values for energies.
y_f (np.ndarray): target values for forces.
p_f (np.ndarray): prediction values for forces.
"""
if subset_keys is not None:
idx = df.index.unique(level=0).intersection(subset_keys)
Expand Down Expand Up @@ -987,9 +987,9 @@ def batched_prediction(model: WeightedLinearModel,
Returns:
y_e (np.ndarray): target values for energies.
p_e (np.ndarray): prediction values for forces.
y_f (np.ndarray): target values for energies.
p_f (np.ndarray): target values for forces.
p_e (np.ndarray): prediction values for energies.
y_f (np.ndarray): target values for forces.
p_f (np.ndarray): prediction values for forces.
"""
if table_names is None:
_, _, table_names, _ = io.analyze_hdf_tables(filename)
Expand Down
4 changes: 2 additions & 2 deletions uf3/representation/bspline.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ def get_regularization_matrix(self,
Args:
ridge_map (dict): n-body term ridge regularizer strengths.
default: {1: 1e-4, 2: 1e-6, 3: 1e-5}
default: {1: 1e-8, 2: 0e0, 3: 1e-5}
curvature_map (dict): n-body term curvature regularizer strengths.
default: {1: 0.0, 2: 1e-5, 3: 1e-5}
default: {1: 0.0, 2: 1e-8, 3: 1e-8}
TODO: refactor to break up into smaller, reusable functions
Expand Down
5 changes: 3 additions & 2 deletions uf3/representation/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def evaluate_configuration(self,
{(name, 'e'), (name, 'fx'), ...{ instead of {'e', 'fx', ...}
energy (float): energy of configuration (optional).
forces (list, np.ndarray): array containing force components
fx, fy, fz for each atom. Expected shape is (n_atoms, 3).
fx, fy, fz for each atom. Expected shape is (3, n_atoms).
energy_key (str): column name for energies, default "energy".
Returns:
Expand Down Expand Up @@ -527,6 +527,7 @@ def get_training_tuples(self, df_features, kappa, data_coordinator):
y (np.ndarray): target vector.
w (np.ndarray): weight vector for machine learning.
"""
warnings.warn("get_training_tuples() is deprecated.", DeprecationWarning)
energy_key = data_coordinator.energy_key
x, y, w = dataframe_to_training_tuples(df_features,
kappa=kappa,
Expand Down Expand Up @@ -626,4 +627,4 @@ def flatten_by_interactions(vector_map, pair_tuples):
(np.ndarray): concatenated result of joining vector_map
in order of occurrence in pair_tuples.
"""
return np.concatenate([vector_map[pair] for pair in pair_tuples], axis=-1)
return np.concatenate([vector_map[pair] for pair in pair_tuples], axis=-1)

0 comments on commit d1cd6f2

Please sign in to comment.