This library contains 9 modules, each of which can be used independently within your existing codebase, or combined together for a complete train/test workflow. To compute the loss in your training loop, pass in the embeddings computed by your model, and the corresponding labels. The embeddings should have size (N, embedding_size), and the labels should have size (N), where N is the batch size. The TripletMarginLoss computes all possible triplets within the batch, based on the labels you pass into it. Anchor-positive pairs are formed by embeddings that share the same label, and anchor-negative pairs are formed by embeddings that have different labels. Loss functions can be customized using distances, reducers, and regularizers. In the diagram below, a miner finds the indices of hard pairs within a batch. These are used to index into the distance matrix, computed by the distance object. For this diagram, the loss function is pair-based, so it computes a loss per pair.

Features

  • Customize loss functions
  • Use loss functions for unsupervised / self-supervised learning
  • Required PyTorch version torch >= 1.6
  • Development is done on the dev branch
  • Code is formatted using black and isort
  • You can specify the test datatypes and test device as environment variables

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow PML

PML Web Site

Other Useful Business Software
Cut Cloud Costs with Google Compute Engine Icon
Cut Cloud Costs with Google Compute Engine

Save up to 91% with Spot VMs and get automatic sustained-use discounts. One free VM per month, plus $300 in credits.

Save on compute costs with Compute Engine. Reduce your batch jobs and workload bill 60-91% with Spot VMs. Compute Engine's committed use offers customers up to 70% savings through sustained use discounts. Plus, you get one free e2-micro VM monthly and $300 credit to start.
Try Compute Engine
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of PML!

Additional Project Details

Programming Language

Python

Related Categories

Python Machine Learning Software, Python Diagram Software

Registered

2022-08-02