Editing
Semi-Supervised Learning
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''FixMatch implementation:''' <syntaxhighlight lang="python"> import torch import torch.nn.functional as F def fixmatch_loss(model, labeled_x, labels, unlabeled_x_weak, unlabeled_x_strong, threshold=0.95, lambda_u=1.0): # Supervised loss on labeled data logits_labeled = model(labeled_x) loss_supervised = F.cross_entropy(logits_labeled, labels) # Pseudo-label on weakly augmented unlabeled data with torch.no_grad(): logits_weak = model(unlabeled_x_weak) probs_weak = F.softmax(logits_weak, dim=-1) max_probs, pseudo_labels = probs_weak.max(dim=-1) # Mask: only use predictions above confidence threshold mask = (max_probs >= threshold).float() # Consistency loss: predict pseudo-label on strongly augmented version logits_strong = model(unlabeled_x_strong) loss_unsupervised = (F.cross_entropy(logits_strong, pseudo_labels, reduction='none') * mask).mean() return loss_supervised + lambda_u * loss_unsupervised </syntaxhighlight> ; Semi-supervised method selection : '''Image classification''' β FixMatch, FlexMatch, FreeMatch (confidence threshold scheduling) : '''NLP''' β UDA (Unsupervised Data Augmentation), pre-train then fine-tune (BERT approach) : '''Graph data''' β Label propagation, Graph Convolutional Networks (GCN) : '''Small labeled set (<100 samples)''' β Mean Teacher, MixMatch : '''Production setting''' β Self-training with pseudo-labels (simple, scalable) </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information