Skip to main content

it's implimentation of multiple loss

Project description

In multiple loss package you get two loass functions.

  • multilabelloss.
  • contrastiveloss.

multilabelloss

Create a multilabelloss which can help as when we working on multilabel classification model. meaning of multilabel classification is that:-

  • develop a single model that will provide binary classification predictions for each of the num_class

  • In other words it will predict 'positive' or 'negative' for all class.

how to use tf-multilabelloss

from multiple_loss.multilabelloss import MultilabelLoss
predictions = Dense(len(num_class), activation="sigmoid")(x)
model = Model(inputs=base_model.input, outputs=predictions)
model.compile(optimizer='adam', loss=MultilabelLoss(num_class),metrics=['binary_accuracy'])

contrastiveloss

contrastive loss function use when we are working on Siamese networks.

Siamese networks :- A Siamese networks consists of two identical neural networks, each taking one of the two input images. The last layers of the two networks are then fed to a contrastive loss function , which calculates the similarity between the two images. Each image in the image pair is fed to one of these networks.

if you want to know more about contrastive

from multiple_loss.contrastive_loss import contrastive_loss_with_margin
rms = RMSprop()
model.compile(loss=contrastive_loss_with_margin(margin=1), optimizer=rms)
history = model.fit([tr_pairs[:,0], tr_pairs[:,1]], tr_y, epochs=20, batch_size=128, validation_data=([ts_pairs[:,0], ts_pairs[:,1]], ts_y))

installation

pip install multiple-loss==0.0.7

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

multiple_loss-0.0.7.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

multiple_loss-0.0.7-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file multiple_loss-0.0.7.tar.gz.

File metadata

  • Download URL: multiple_loss-0.0.7.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for multiple_loss-0.0.7.tar.gz
Algorithm Hash digest
SHA256 71e315fbcdb57bfaf905d10d76e9d099c31f53d1837edac7e1d684282a91daa8
MD5 628b33534f0ddf1ed9848011e34359f9
BLAKE2b-256 e5c5ae08f66527bcb1fcfdd259e3a2444b2357ad7dc617e244fca802701795b4

See more details on using hashes here.

File details

Details for the file multiple_loss-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: multiple_loss-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for multiple_loss-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 db19b8b311ba0d48e1a3e1c9420f821287538cc69926b6a6d6520c7c989a81a0
MD5 a8785ee6471427bb34a7e93e3c386fee
BLAKE2b-256 3e140d7f0336fa5574909eed723cbe45337fd441409ccf3691e8c41063a9169d

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