optimizer.momentum.Momentum

optimizer.momentum.Momentum(self, lr=0.01, alpha=0.9)

Methods

Name Description
get_trace Get the optimization trace
optimize Optimize the parameters of the model
setup
update update whole parameters one step

get_trace

optimizer.momentum.Momentum.get_trace()

Get the optimization trace

Returns

Name Type Description
pl.DataFrame pl.DataFrame: the optimization trace with columns ['epoch', 'mse_train', 'mse_test', 'tt_norm', 'tt_ranks'].

optimize

optimizer.momentum.Momentum.optimize(
    epochs=1000
    epoch_per_trace=1
    epoch_per_log=500
    epoch_per_save=100000000
    fix_coord=False
    fix_basis=False
    wf=1.0
)

Optimize the parameters of the model

Parameters

Name Type Description Default
epochs int the number of epochs executed in this execution. 1000
epoch_per_trace int the number of epochs per recording the optimization trace. Defaults to 1. 1
epoch_per_log int the number of epochs per logging. Defaults to 500. 500
epoch_per_save int the number of epochs per saving the model. Defaults to 100_000_000. 100000000
fix_coord bool whether to fix the coordinator or not. Defaults to False. False
fix_basis bool whether to fix the basis or not. Defaults to False. False
wf float the weight factor for the force. 1.0

Returns

Name Type Description
pl.DataFrame pl.DataFrame: the optimization trace with columns ['epoch', 'mse_train', 'mse_test', 'tt_norm', 'tt_ranks'].

setup

optimizer.momentum.Momentum.setup(
    model
    x_train
    y_train
    *
    batch_size=100
    shuffle=True
    x_test=None
    y_test=None
    f_train=None
    f_test=None
    jobname=None
    outdir='.'
)

Parameters

Name Type Description Default
model pompon.model.Model the model to be optimized required
x_train Array the training data required
y_train Array the training target required
batch_size int the batch size for stochastic method. Defaults to 100. 100
shuffle bool whether to shuffle the data. Defaults to True. When batch_size is large, it is recommended to set shuffle=False. True
x_test Array the test data. Defaults to None. None
y_test Array the test target. Defaults to None. None
f_train Array the force data. Defaults to None. None
f_test Array the force data for test. Defaults to None. Currently, test MSE is evaluated by only the energy term. None
jobname str the name of the job. Defaults to None. None
outdir str the output directory. Defaults to “.”. '.'

Returns

Name Type Description
Optimizer Optimizer the optimizer defined with the model and data.

update

optimizer.momentum.Momentum.update(params)

update whole parameters one step