Skip to main content

Local Quadratic Approximation (LQA)

In deep learning tasks, the learning rate determines the update step size in each iteration, which plays a critical role in gradient-based optimization. However, the determination of the appropriate learning rate in practice typically replies on subjective judgement. In this work, we propose a novel optimization method based on local quadratic approximation (LQA). In each update step, given the gradient direction, we locally approximate the loss function by a standard quadratic function of the learning rate. Then, we propose an approximation step to obtain a nearly optimal learning rate in a computationally efficient way. The proposed LQA method has three important features. First, the learning rate is automatically determined in each update step. Second, it is dynamically adjusted according to the current loss function value and the parameter estimates. Third, with the gradient direction fixed, the proposed method leads to nearly the greatest reduction in terms of the loss function. Extensive experiments have been conducted to prove the strengths of the proposed LQA method. The detailed description of the LQA method can be found at https://arxiv.org/abs/2004.03260.

How to use LQA

1. Import the package

import lqa

2. Initialize a LQA worker and train your model.

The following example shows the necessary parameters:

  • model: your model (based on tensorflow.keras)

  • epochs: the number of epochs

  • train: training dataset (e.g., [X0, Y0], or a data generator)

  • test: testing (or validation) dataset (e.g., [X1, Y1], or a data generator)

  • loss: loss function

bestmodel = lqa.gd(model, epochs=10, train=[X0,X1], test=[Y0,Y1]], loss='sparse_categorical_crossentropy')

3. Get the tuned model from the worker.

The tuned model and training records are organized as attributes of the LQA worker.

# tuned model
bestmodel.model

# training records, including:
# history[train_loss] - loss on the training dataset
# history[train_acc] - accuracy on the training dataset
# history[test_loss] - loss on the testing dataset
# history[test_acc] - accuracy on the testing dataset
bestmodel.history

Release files for lqa 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lqa 0.0.4
File Size Uploaded
lqa-0.0.4.tar.gz 6.8 kB Details

Release files / lqa-0.0.4.tar.gz

Download URL lqa-0.0.4.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1f923dfa65ad2c968b01e790b276a2017afcb55444676913aedfdd88f203e279
BLAKE2b-256 checksum
How to use checksums
389decc44667e8844570521c28c3f9eeeee33288fa8e39a3d5c15057afe47ce2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.7

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page