Lab 11: Flag Accounts for Credit Review

ACCTG 6155, Fall 2026, Week 11. Due Sunday, November 15, 11:59 PM MT. One notebook, one upload. Plan on about 3 hours.
The AI tutor on this page knows which exercise you are reading. Paste what you have into the box at the bottom, then ask. Show it your attempt first.

You are the analyst at Summit Gear Co. Last week you predicted how long each account takes to pay. This week the credit team asks a different question about the same 2,200 accounts: which ones are likely to default, so a credit analyst can review them before the next order ships on terms? A review costs about $400 of analyst time. A default the team does not see coming costs about $2,000 after recoveries. An AI tool can write the fitting code. You choose the predictors, check that each fit ran, and recommend a cutoff to the credit team with what it costs.

Open Lab 11 in Colab

Then choose File > Save a copy in Drive and work in your copy. The copy that opens from the link does not save your work. If your U of U Google account cannot open Colab, a personal Google account can.

Before you start

The data

The target is defaulted: 1 if the account's receivable was written off as uncollectible during the period (the 12 months that follow its start), 0 if it was not written off in the period (this lab says "did not default"). Every predictor is measured as of the start of the period, so the review list can be made then. About 20% of the accounts defaulted. That share is the base rate. Calling every account "will not default" is the flag-nobody benchmark: it is right about 80% of the time and catches no one, and every model this week is compared with it.

You choose the predictors. Your list must include prior_late_count and discount_rate, and may add any of the other eight Week 10 candidates and segment. days_to_pay, industry, customer_id, tenure_months, region and defaulted stay out, and the notebook says why if you try one.

The three steps

  1. 1Specify and fit

    Choose your predictors, have the AI fit the logistic regression, read two odds ratios, and turn one account's columns into a probability.

    All 2,200 accounts
  2. 2From a probability to a call

    Refit on the training rows, flag test accounts at a 0.5 cutoff, and count the four kinds of call.

    Fit on 1,760, judge on 440
  3. 3Choose a cutoff

    Find the cheapest cutoff on the training rows, score it once on the test rows, compare train and test AUC, and decide.

    Choose on 1,760, score on 440
The split is fixed and stratified, so the test rows keep about the same share of defaults as the whole table and everyone scores the same 440 accounts. The deck uses a different random split, so your held-out numbers will differ from the slides' even with the same predictors. That is expected.

The three exercises

Exercise 1: Specify and fit 34 points

Written: Model definition. Five lines, one each.

  • Target: the column, and what 1 and 0 mean
  • Predictors and units: each predictor you chose, and its unit
  • Why each belongs: one reason per predictor
  • Look-ahead check: would you have each value at the start of the period, when the review list is made?
  • Benchmark to beat: the flag-nobody benchmark, and how often it is right

Graded on (12 points): All five lines filled. The target says what 1 and 0 mean. Each predictor has its unit and a business reason, not "it was significant". The look-ahead check says why each value is known at the start of the period. The benchmark names the flag-nobody accuracy.

Written: Your interpretation. Three to five sentences.

  • Read two odds ratios in credit terms, holding the other predictors fixed. One of them must be prior_late_count.
  • Give the probability your model assigns to account C-01182, and say what it means for the credit team.

Graded on (12 points): Two odds ratios, one of them prior_late_count, read as multipliers on the odds with the other predictors held fixed, and matching your output. The probability for C-01182 from your output, read for the credit team.

Exercise 2: From a probability to a call 32 points

flaggednot flagged
defaulted true positive: caughtThe review catches it in time.costs the $400 review false negative: missedThe loss goes through.costs $2,000
did not default false positive: a review that was not neededAnalyst time on a good account.costs the $400 review true negative: clearedNo review, no loss.costs nothing

Precision is the share of flagged accounts that defaulted (the left column). Recall is the share of defaults the model flagged (the top row).

Written: Your interpretation. Two or three sentences.

  • Compare your model's accuracy at 0.5 with the flag-nobody accuracy on the same test rows, with both numbers.
  • Say why the two are so close.
  • Say what precision and recall show that accuracy does not.

Graded on (14 points): Accuracy at 0.5 and the flag-nobody accuracy on the same test rows, with both numbers. Why they are close. What precision and recall show, each defined correctly.

Exercise 3: Choose a cutoff 34 points

Written: Your decision. One paragraph to the credit manager, about 150 to 250 words.

  • The cutoff you would hand the credit team, and why.
  • How it compares with the 0.20 break-even ($400 / $2,000), and why the two can differ.
  • What it costs on the test rows against 0.5 and against reviewing nobody.
  • What the train and test AUC comparison says. With 88 defaults in the test rows, a gap of several hundredths can come from the draw alone.
  • One thing this table cannot see.

Graded on (16 points): The cutoff from your training-row sweep. How it compares with the 0.20 break-even and why the two can differ. Its test cost against 0.5 and against reviewing nobody, from your output. A hedged reading of the train and test AUC. One thing the table cannot see.

Ask the tutor


The tutor reads this box and the exercise. It can explain a statsmodels call, an odds ratio or an error. It will not write your three helpers or your written answers for you.

What the tutor sees, and a prompt to copy into another AI tool

The preview shows the full prompt, including earlier turns of the conversation. Nothing on this page submits to Canvas.

What to submit

In Canvas, Lab 11 is a short quiz with one file upload and four short closing questions. The file is your notebook, run top to bottom. In Colab choose File > Download > Download .ipynb, rename it <uID>_lab_11.ipynb with your uID in place of <uID>, upload it to Lab 11, answer the closing questions, and submit the quiz.

Three checks before you submit

  1. Runtime > Restart session and run all. Every cell shows its output, and the Final check reads your latest work.
  2. The Final check prints RESULTS with no null in it, and every row is green.
  3. Your four written cells have your words in them, not the placeholder line.

Lab 11 check: 11 of 12 done

✓PREDICTORS: a list that follows the ruledone
✓logit_full: 2,200 rows, converged, your PREDICTORSdone
✓sigmoid: fixed exampledone
✓train and test: 1,760 and 440 rows, 88 defaults in testdone
✓logit_train: 1,760 rows, converged, the same termsdone
✓train_prob and test_prob: 1,760 and 440 probabilitiesdone
✓confusion_counts: fixed exampledone
✓accuracy, precision and recall at 0.5done
✓total_cost: fixed exampledone
✓cutoff chosen on the 1,760 training rowsdone
✓that cutoff scored once on the 440 test rowsdone
✗AUC: training rows and test rowsnot yet, see Exercise 3
RESULTS = {"predictors": [your list], "n_train": 1760, "n_test": 440, "test_defaults": 88, "base_rate": 0.1991, "or_prior_late": x.xxxx, "acc_050": 0.xxxx, "naive_acc": 0.xxxx, "precision_050": 0.xxxx, "recall_050": 0.xxxx, "cutoff_train": 0.xx, "cost_train_at_cutoff": xxxxxx, "cost_test_at_cutoff": xxxxxx, "cost_050": xxxxxx, "cost_nobody": xxxxxx, "train_auc": null, "test_auc": null}
Still to do: AUC: training rows and test rows (Exercise 3)
A sample Final check with one piece left. Your numbers replace the x's. Here the two AUC lines are still null and one row is red, so this notebook is not ready to submit. A red row names the exercise to go back to.

How it is graded

Lab 11 is worth 100 points, all of them for the notebook. The four closing questions are not graded.

ExerciseNumbers in RESULTSYour helper, on inputs you have not seenYour writingTotal
1. Specify and fita legal list, the fit, the prior_late_count odds ratio: 4sigmoid: 6model definition 12, interpretation 1234
2. From a probability to a callthe split, the refit, accuracy, precision, recall: 8confusion_counts: 10interpretation 1432
3. Choose a cutoffthe training-row cutoff, the three test costs, both AUCs: 8total_cost: 10decision 1634
Total100

A script reads the RESULTS your Final check prints. Because you chose your own predictors, it refits your list from the data and checks your numbers against that fit, so there is no single answer everyone has to match. If two cutoffs tie for the cheapest on the training rows, either one is accepted. The script also runs your three helpers on inputs you have not seen.

The four written cells are 54 of the 100 points. Each is read against the line under "Graded on" in its exercise above, and any number you quote is checked against your own output. An AI tool may write the fitting code. The points go to the predictors you chose, the checks you ran and the four written cells.

You may resubmit. Each new attempt starts empty, so upload the notebook again and answer the closing questions again. The latest attempt is kept, so a resubmission after the deadline replaces your on-time attempt and is marked late.