Skip to main content

Moving Targets: a framework for constrained machine learning

Project description

Moving Targets

Moving Targets is novel hybrid technique which can be used to inject external constraints and domain knowledge into any machine learning model. The algorithm is based on an iterative schemes that alternates between two steps: a learner step, which is in charge of training the machine learning model, and a master step, which refines the model predictions by projecting them into the feasible space, so that the model can be learnt again on these adjusted targets. Since the model is general-purpose, it can address any type of learner and constraints, given that these constraints lead to a solvable constrained optimization problem (see the original paper for details).

How To Use

You can install the Moving Targets' library via pip by pasting this command in your terminal:

pip install moving-targets

The library contains various classes and utility functions, but the core of the algorithm can be found in the MACS class, which needs both a Learner and a Master instance in order to be instantiated — additional parameters such as the initial step or a list of Metric objects may be optionally passed as well. Once the MACS object has been built, it can be used as a classical machine learning model along with its methods fit(), predict(), and evaluate().

A predefined set of learners, metrics, and callbacks can be found in the respective modules. Instead, as regards the master, you will need to extend one of the template ones in order to formulate your constrained optimization problem, even though the master formulation is facilitated by a set of predefined loss functions and backend objects that wrap some of the most famous constraint optimization solvers — e.g., Cplex, Gurobi, CvxPy, etc.

More specific tutorials to learn how to use Moving Targets can be found in the examples module.

How To Cite

If you use Moving Targets in your works, please cite the following article:

@article{Detassis2020,
  title={Teaching the Old Dog New Tricks: Supervised Learning with Constraints},
  author={Detassis, Fabrizio and Lombardi, Michele and Milano, Michela},
  journal={arXiv preprint arXiv:2002.10766},
  year={2020}
}

Contacts

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

moving_targets-0.4.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

moving_targets-0.4.0-py3-none-any.whl (66.7 kB view details)

Uploaded Python 3

File details

Details for the file moving_targets-0.4.0.tar.gz.

File metadata

  • Download URL: moving_targets-0.4.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.2

File hashes

Hashes for moving_targets-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8a64d8686344f80326d87990b90961a6525d29f9d7c61741928a1ef63c3e47e1
MD5 c1e9829af23a16fb1e3e706843e63e42
BLAKE2b-256 2b9236627bc064f46d665095a2cde79daf1b63bc5c8d6a5b0bb73b83abd83664

See more details on using hashes here.

File details

Details for the file moving_targets-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for moving_targets-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca4a460dfd2e506d3d4b64b80ff4b31e2eb1474dbcb360f03a66b2bc8b7e7855
MD5 d73bf37471257dad66760acb4c02bdf7
BLAKE2b-256 b29834c8bbed594361f32a5db1f859fd68cefcd8e1a048538b0fa5b2e17b1815

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