• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Crypto Currency
  • Technology
  • Contact
NEO Share

NEO Share

Sharing The Latest Tech News

  • Home
  • Artificial Intelligence
  • Machine Learning
  • Computers
  • Mobile
  • Crypto Currency

Proven example of Zero-Shot demonstrating its raw power

January 16, 2021 by systems

In the Zero-Shot classification task, the input to the model is constructed as Premise/Hypothesis pair such that Premise is the Text itself & Hypothesis has a template of “this example is {}” for each Candidate Label.

Example:
Text
: Two militants killed as Army foils infiltration in J&K
Candidate Label: [‘defence’, ‘politics’, ‘sports’]

The input to model is constructed in this manner:

Premise : “Two militants killed as Army foils infiltration in J&K”
Hypothesis 1: This example is about defence.

Premise : “Two militants killed as Army foils infiltration in J&K”
Hypothesis 2: This example is about politics.

Premise : “Two militants killed as Army foils infiltration in J&K”
Hypothesis 3: This example is about sports.

We can clearly see that the Hypothesis 1 entails the Premise.

For each Premise/Hypothesis pairs the model outputs logits for over the three categories i.e(entailment, contradiction or neutral). Only the values of entailment score is SoftMax over the entire Candidate Label such that its values sums up to 1; The max probability value is the output label prediction made by the model.

For this example, model outputs entailment for defence label with max probability score.

In the example below we will see how to use HuggingFace Zero-Shot pipeline to categorize news headline into any one of the 3 Candidate Label i.e(‘politics’, ‘defence’, ‘sports’’). For this, I collected 1037 news headline by web-scraping news website’s /Defence section.

All of the collected headlines with defence tag serve as labelled data, thus allowing us to evaluate the effectiveness of prediction.

After Inferencing the output prediction has 763 defence, 268 politics & 6 sports related headlines . Below we take a look at some predictions and try to guess the cause of interpretation?.

Filed Under: Machine Learning

Primary Sidebar

Stay Ahead: The Latest Tech News and Innovations

Cryptocurrency Market Updates: What’s Happening Now

Emerging Trends in Artificial Intelligence: What to Watch For

Top Cloud Computing Services to Secure Your Data

The Future of Mobile Technology: Recent Advancements and Predictions

Footer

  • Privacy Policy
  • Terms and Conditions

Copyright © 2025 NEO Share

Terms and Conditions - Privacy Policy