← Back to Pull requests

Pp/cpc ctc stats #5

Merged
petropusz merged 4 files (375 lines) on Mar 06, 2021 21:20 UTC
View on GitHub
petropusz petropusz commented on Feb 27, 2021 20:37 UTC
Author

Added option to capture data for future visualizations (save them across different epochs during training, or just see what is produced after the training) - representations, CPC predictions and CPC-CTC alignments

Example run that saves data each 2 epochs for 33% of provided 'capture dataset':
python train.py --pathDB /pio/scratch/1/i283340/MGR/zs/ds2 \
--pathTrain /pio/scratch/1/i283340/MGR/zs/sometries/ds2part.txt \
--pathVal /pio/scratch/1/i283340/MGR/zs/sometries/ds2part.txt \
--pathCaptureDS /pio/scratch/1/i283340/MGR/zs/sometries/ds2part.txt \
--captureDSfreq 33 --captureEachEpochs 2 \
--pathCaptureSave /pio/scratch/1/i283340/MGR/zs/capture/try2 \
--saveRepr --savePred --saveAlign \
--pathCheckpoint /pio/scratch/1/i283340/MGR/zs/checkpoints/cpcctc_tests2 \
--file_extension .flac --n_process_loader 2 --max_size_loaded 40000000 \
--batchSizeGPU 16 --nPredicts 8 --CPCCTC --CPCCTCNumMatched 12 \
--CPCCTCSelfLoop --CPCCTCSkipBeg 1 --CPCCTCSkipEnd 2

Diff: 375 lines (+301 / -74) across 4 files Reviewer: janchorowski Review duration: 10123m
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.43) × (1 − Review Confidence (0.92)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 375 lines diff across 4 files
0.43
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.92 · 3 substantive comment(s)
0.92
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
91%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.355
Real PR Conversation Timeline
5 items
janchorowski janchorowski commented on code on Mar 06, 2021 01:07 UTC
Code Review
cpc/criterion/soft_align.py:1
@@ -323,4 +323,16 @@ def forward(self, cFeature, encodedData, label):
         outLossesD = outLosses.detach()
         losses = losses.mean() / outLossesD.sum() * outLossesD
 
-        return losses, outAcc
+        captureRes = None
+        if captureOptions != None:
+            for o in captureOptions:
+                assert o in ('pred', 'align')
+            captureRes = {}
+            if 'pred' in captureOptions:
+                # need to remove 'predict self loop' stuff from captured data
+                captureRes['pred'] = predictions[:,:,:,1:]

I am unsure about this [1:] at the end - is it to skip the self-loop?

janchorowski janchorowski approved these changes on Mar 06, 2021 01:12 UTC
Approved Reviewer

Please double-check the 1:.

It seems that right now half of training loop can be switched off, shall we have two functions?

Anyway, please merge once you verify the above.

petropusz petropusz commented on code on Mar 06, 2021 21:17 UTC
Code Review
cpc/criterion/soft_align.py:1
@@ -323,4 +323,16 @@ def forward(self, cFeature, encodedData, label):
         outLossesD = outLosses.detach()
         losses = losses.mean() / outLossesD.sum() * outLossesD
 
-        return losses, outAcc
+        captureRes = None
+        if captureOptions != None:
+            for o in captureOptions:
+                assert o in ('pred', 'align')
+            captureRes = {}
+            if 'pred' in captureOptions:
+                # need to remove 'predict self loop' stuff from captured data
+                captureRes['pred'] = predictions[:,:,:,1:]

Yeah, I was removing it as it's not really a prediction, but forgot it would spoil alignment indices - fixed, now self loop is also saved in predictions

petropusz petropusz commented on Mar 06, 2021 21:20 UTC
Author

Yeah, another function seems better - I just didn't want to have entirely separate run file with constructing all stuff from args and went a bit too far in "everything together" direction; updated

Reviewers
Assignees
petropusz petropusz
Labels
risk: low confidence: 91.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 42.9% (MEDIUM) · Higher = larger blast radius
42.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 91.8% · Lower = rushed or shallow review
91.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 3.5% · Safe to merge
3.5%