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.1.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

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

moving_targets-0.4.1-py3-none-any.whl (66.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moving_targets-0.4.1.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.14

File hashes

Hashes for moving_targets-0.4.1.tar.gz
Algorithm Hash digest
SHA256 cd18dded04247aae2a7f90d83ba1634b79411fcc74959d179509f57a8e76c555
MD5 c8440306fba938dc9ae8fb23c5ba78ae
BLAKE2b-256 203a36fba4f72cb46da7bd97f6f08f6d4b3e0600166a1d3a952cdf1143b77dec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for moving_targets-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35a53ac1fd2326f7d4a6a543ffece16264ea91c7c334cec67473a7b9f5fec5d0
MD5 9ad3ceb84b1d48432fd18bbe13c547ea
BLAKE2b-256 6580467a48e58fee531e1cf14e71700d5a25d80dc29e059c228bf55f91f7353d

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