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.30.tar.gz (898.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mice-0.1.30-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mice-0.1.30.tar.gz
  • Upload date:
  • Size: 898.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for mice-0.1.30.tar.gz
Algorithm Hash digest
SHA256 cc7096f76dacbe9c52b2e228e55ebc7db63539d175825e85bd4aa1136075ae07
MD5 b7fa4545feaf2be0d46fdd2adef17851
BLAKE2b-256 77c98f0135b0a9d099b0c6073243274e5867b6dfa72548b871d265f987890afd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mice-0.1.30-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for mice-0.1.30-py3-none-any.whl
Algorithm Hash digest
SHA256 92f478328040a961e1e9d782663e476d08ed5cd86fa893e56c237ca2b948ae95
MD5 afeea58a3536396dfdc5bafa68daaafa
BLAKE2b-256 bcf663f7558f45592f9ad4b6fe237ccb023828569fd09a437b1b505bdcad88c6

See more details on using hashes here.

Supported by

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