Skip to main content

Multi-iteration Stochastic Estimator

Project description

Multi-iteration Stochastic Estimator

The Multi-Iteration stochastiC Estimator (MICE) is an estimator of gradients to be used in stochastic optimization. It uses control variates to build a hierarchy of iterations, adaptively sampling to keep the statistical variance below tolerance in an optimal fashion, cost-wise. The tolerance on the statistical error decreases proportionally to the square of the gradient norm, thus, SGD-MICE converges linearly in strongly convex L-smooth functions.

This python implementation of MICE is able to

  • estimate expectations or finite sums of gradients of functions;

  • choose the optimal sample sizes in order to minimize the sampling cost;

  • build a hierarchy of iterations that minimizes the total work;

  • use a resampling technique to compute the gradient norm, thus enforcing stability;

  • define a tolerance on the norm of the gradient estimate or a maximum number of evaluations as a stopping criterion.

Using MICE

Using MICE is as simple as

>>> import numpy as np
>>> from mice import MICE
>>>
>>>
>>> def gradient(x, thts):
>>>     return x - thts
>>>
>>>
>>> def sampler(n):
>>>     return np.random.random((n, 1))
>>>
>>>
>>> df = MICE(gradient , sampler=sampler)
>>> x = 10
>>> for i in range(10):
...    grad = df(x)
...    x = x - grad

However, it is flexible enough to tackle more complex problems. For more information on how to use MICE and examples, check the documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mice-0.1.31.tar.gz (899.1 kB view details)

Uploaded Source

Built Distribution

mice-0.1.31-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file mice-0.1.31.tar.gz.

File metadata

  • Download URL: mice-0.1.31.tar.gz
  • Upload date:
  • Size: 899.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.66.1 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for mice-0.1.31.tar.gz
Algorithm Hash digest
SHA256 10a747481e129f2369017df068bb371c109997501ee2df41e4b9f25cd6eab4e5
MD5 bf846bf24bad965c2f91463e8c0d9003
BLAKE2b-256 107871086b7529077859321d44ed5252a1d5dc52624d753399dee395e2b43f9c

See more details on using hashes here.

File details

Details for the file mice-0.1.31-py3-none-any.whl.

File metadata

  • Download URL: mice-0.1.31-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.66.1 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for mice-0.1.31-py3-none-any.whl
Algorithm Hash digest
SHA256 90c3e8c3716aee8bfec9f8f71fdadbc7e692168064984bda5f4d45690cff157a
MD5 19bfb81baaeb0e88dc9365f84d6f3c08
BLAKE2b-256 1d8df872b9c2c253303abc9686309aa24aaf7864fc2d6fb257d37681a2377ae4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page