facebookresearch / Context-Aware-Representation-Crop-Yield-Prediction
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 242 units with 4,881 lines of code in units (84.2% of code).
    • 4 very long units (516 lines of code)
    • 12 long units (791 lines of code)
    • 66 medium size units (2,127 lines of code)
    • 61 small units (892 lines of code)
    • 99 very small units (555 lines of code)
10% | 16% | 43% | 18% | 11%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py10% | 16% | 43% | 18% | 11%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT51% | 32% | 4% | 9% | 1%
data_preprocessing/sample_quadruplets28% | 22% | 25% | 11% | 12%
crop_yield_prediction/plot48% | 0% | 30% | 20% | 0%
crop_yield_prediction0% | 20% | 70% | 4% | 4%
crop_yield_prediction/models0% | 16% | 41% | 23% | 18%
data_preprocessing/rescaling0% | 26% | 45% | 20% | 7%
data_preprocessing/postprocess0% | 15% | 76% | 8% | 0%
data_preprocessing/preprocess0% | 0% | 64% | 27% | 7%
data_preprocessing/merge0% | 0% | 100% | 0% | 0%
data_preprocessing/plot0% | 0% | 32% | 67% | 0%
crop_yield_prediction/dataloader0% | 0% | 0% | 64% | 35%
crop_yield_prediction/utils0% | 0% | 0% | 35% | 64%
data_preprocessing/utils0% | 0% | 0% | 16% | 83%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def crop_yield_train_cross_location()
in crop_yield_train_cross_location.py
155 19 9
def crop_yield_train_semi_transformer()
in crop_yield_train_semi_transformer.py
142 21 9
def generate_training_for_counties()
in data_preprocessing/sample_quadruplets/sample_for_counties.py
114 21 12
def plot_loss()
in crop_yield_prediction/plot/plot_loss.py
105 16 1
def crop_yield_train_cnn_lstm()
in crop_yield_train_cnn_lstm.py
97 19 9
def crop_yield_train_c3d()
in crop_yield_train_c3d.py
92 19 9
def generate_training_for_pretrained()
in data_preprocessing/sample_quadruplets/sample_for_pretrained.py
88 16 14
def cdl_upscale()
in data_preprocessing/rescaling/cdl_upscale.py
73 31 6
def _train()
in crop_yield_prediction/models/deep_gaussian_process/base.py
62 16 11
def train_attention()
in crop_yield_prediction/train_cross_location.py
57 9 24
def train_attention()
in crop_yield_prediction/train_semi_transformer.py
57 9 24
def generate_no_spatial_for_counties()
in data_preprocessing/postprocess/combine_multi_vars.py
57 15 9
def run()
in crop_yield_prediction/models/deep_gaussian_process/base.py
53 9 4
def eval_epoch()
in crop_yield_prediction/train_semi_transformer.py
53 12 7
def _predict()
in crop_yield_prediction/models/deep_gaussian_process/base.py
51 11 12
def reproject_us_counties()
in data_preprocessing/rescaling/us_counties.py
51 11 3
def combine_by_year()
in data_preprocessing/postprocess/combine_multi_vars.py
50 18 3
def eval_epoch()
in crop_yield_prediction/train_cross_location.py
49 10 7
def eval_test()
in crop_yield_prediction/train_semi_transformer.py
48 12 13
def generate_monthly_average()
in data_preprocessing/preprocess/lst.py
48 23 4