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.2.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.2-py3-none-any.whl (66.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moving_targets-0.4.2.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.2.tar.gz
Algorithm Hash digest
SHA256 3cf150d6ec24aa4d755e20fc90dd2c99db0985342a096cb675f2981c17b68633
MD5 3d4316757026d4c1554a2903f7941469
BLAKE2b-256 627d4840b89ff4fa79e5612e4cf79e11cb9d170ed2d297e2f2050addaae63fe7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for moving_targets-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a03b5add6e8bd8db676beb130eeffc51837ee082031ab8eb3bd5ac88d0829a9f
MD5 27282fe049af57193056fa323ba5f065
BLAKE2b-256 487d8b728599af8d8f9eab3f44b78c022ba631bce5d1277c46be5dba12f668be

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