fastai Abbreviation Guide

As mentioned in the fastai style, we name symbols following the Huffman Coding principle, which basically means

Commonly used and generic concepts should be named shorter. You shouldn’t waste short sequences on less common concepts.

fastai also follows the life-cycle naming principle:

The shorter life a symbol, the shorter name it should have.

which means:

  • Aggressive Abbreviations are used in list comprehensions, lambda functions, local helper functions.
  • Aggressive Abbreviations are sometimes used for local temporary variables inside a function.
  • Common Abbreviations are used most elsewhere, especially for function arguments, function names, and variables
  • Light or No Abbreviations are used for module names, class names or constructor methods, since they basically live forever. However, when a class or module is very popular, we could consider using abbreviations to shorten its name.

This document lists abbreviations of common concepts that are consistently used across the whole fastai project. For naming of domain-specific concepts, you should check their corresponding module documentations. Concepts are grouped and listed by semantic order. Note that there are always exceptions, especially when we try to comply with the naming convention in a library.

 ConceptAbbr.Combination Examples
Suffix   
 multiple of something (plural)sxs, ys, tfms, args, ss
 internal property or methoddata, V()
Prefix   
 check if satisfiedisisreg, is_multi, is_single, is_test, is_correct
 On/off a featureuseusebn
 Number of something (plural)nnembs, n_factors, n_users, n_items
 count somethingnumnumfeatures(), num_gpus()
 convert to somethingtoto_gpu(), to_cpu(), to_np()
Infix   
 Convert between concepts2name2idx(), label2idx(), seq2seq
Aggressive   
 functionf 
 torch inputx 
 key, valuek,vfor k,v in d.items()
 other pairs of short scopep,qlistify(p,q) (same as python’s stdlib)
 indexi 
 generic object argumento[o for o in list], lambda o: o
 variablevV(), VV()
 tensortT()
 arrayaA()
 use first letter weight -> w, model -> m
Generic   
 functionfnopt_fn, init_fn, reg_fn
 processprocproc_col
 transformtfmtfm_y, TfmType
 evaluateevaleval()
    
 argumentarg 
 inputx 
 input / outputio 
 objectobj 
 strings 
 classclcl, classes
 sourcesrc 
 destinationdst 
 directorydir 
 percentagep 
 ratio, proportion of somethingr 
 countcnt 
    
 configurationcfg 
 randomrand 
 utilityutil 
 filenamefname 
    
 thresholdthresh 
Data   
 number of elementsn 
 lengthlen 
 sizesz 
 arrayarrlabel_arr
 dictionarydict 
 sequenceseq 
    
 datasetdstrain_ds
 dataloaderdltrain_dl
 dataframedftrain_df
 traintraintrain_ds, train_dl, train_x, train_y
 validationvalidvalid_ds, valid_dl, valid_x, valid_y
 testtesttest_ds, test_dl
 number of classesc 
 batchb 
 batch’s x partsxb 
 batch’s y partsyb 
 batch sizebs 
 multiple targetsmultiis_multi
 regressionregis_reg
 iterate, iteratoritertrain_iter, valid_iter
    
 torch inputx 
 targety 
 dependent var tensordep 
 independent var tensorindep 
 predictionpred 
 outputout 
 columncoldep_col
 continuous varcontconts
 category varcatcat, cats
 continuous columnscont_cols 
 category columnscat_cols 
 dependent columndep_col 
    
 indexidx 
 identityid 
 first elementhead 
 last elementtail 
    
 uniqueuniq 
 residualres 
 labellbl(not common)
 augmentaug 
 paddingpad 
    
 probabilitypr 
 imageimg 
 rectanglerect 
 colorcolr 
 anchor boxanc 
 bounding boxbb 
    
Modeling   
 initializeinit 
 language modellm 
 recurrent neural networkrnn 
 convolutional neural networkconvnet 
    
 model datamd 
 linearlin 
 embeddingemb 
 batch normbn 
 dropoutdrop 
 fully connectedfc 
 convolutionconv 
 hiddenhid 
    
 optimizer (e.g. Adam)opt 
 layer group learning rate optimizerlayer_opt 
 criteriacrit 
 weight decaywd 
 momentummom 
 cross validationcv 
 learning ratelr 
 schedulesched 
 cycle lengthcl 
 multipliermult 
 activationactn 
    
CVcomputer vision  
 figurefig 
 imageim 
 transform image using opencv_cvzoom_cv(), rotate_cv(), stretch_cv()
NLPnatural language processing (nlp)  
 tokentok 
 sequence lengthsl 
 back propagation through timebptt 

Company logo

©2021 fast.ai. All rights reserved.
Site last generated: Jan 5, 2021