Setting 3D Print Monitoring Thresholds from Material Cost: Where to Stop and When to Ask a Human

Pass the state of a running print to a decision model (a model that writes no text and returns a typed answer with its probability) and you get back the probability that the print has failed, a number between 0 and 1. The real question is where to put the threshold for 3D print monitoring. scikit-learn’s binary classifiers split at 0.5 by default, but should a 0.5 in the first hour of a five-hour print be treated the same as a 0.5 in the fourth hour? Stopping wastes the material and time spent so far; continuing pours the remaining time and material into a failed part. How costly each mistake is depends on how far the print has gone.
This article contains affiliate links. As an Amazon Associate, we earn from qualifying purchases.
This article sets the threshold from the cost of stopping by mistake and the cost of missing a failure, using the cost-sensitive decision rule from Elkan (2001) and the cost example from our earlier article on 3D printing costs. The conclusion: under our assumptions, the stop threshold equals the fraction of the print completed. Add a human check costing 100 yen and the range worth sending to a person appears only mid-print. The formula assumes the probabilities are accurate, though, and our runs on public dataset photos and official slicer settings produced cases where a high probability did not mean a correct answer. So we finish with how to check probabilities with the Brier score before using a threshold.
- A Probability Does Not Tell You Where to Stop
- Counting the Costs: Stopping by Mistake vs. Missing a Failure
- The Threshold Formula for 3D Print Monitoring: Elkan (2001), Equation (2)
- Working Through the Cost Example: The Threshold Moves with Progress
- When to Ask a Human: The Cost of One Check Sets the Middle Band
- The Formula Assumes the Probabilities Are Right
- Checking Probabilities with the Brier Score
- Operating It: Stop Decisions Do Not Replace Printer Safety Features
- Summary: Set Monitoring Thresholds from Both Costs and Calibration
- Sources
A Probability Does Not Tell You Where to Stop
This article mentions three decision model options: TypeSafe’s Jev, which reads text only; Cloudflare’s Clef-flash (Apache 2.0, released October 1, 2026), which reads images locally with Ollama 0.35.1 or later (on our PC it failed on Ollama for Windows, so we ran the Linux build in Docker); and models run on your own GPU through Ollama’s /v1/systemone. Question types are noul, choice, and score. A noul returns a single probability of “yes”; a choice returns every option’s probability plus confidence. Whether to stop can be phrased as the noul question “has this print failed?”, and we call its probability p.
A decision model’s job ends with the probability. scikit-learn’s guide splits classification into two problems: predicting class probabilities, and turning them into actions. The model handles the first; where to cut is up to you. If you decide nothing, a default applies: scikit-learn predicts positive when the conditional probability exceeds 0.5. As the formula below shows, 0.5 assumes both mistakes cost the same, which is not true mid-print. Returning probabilities is not unique to decision models; scikit-learn classifiers can, and we had Claude write probabilities as JSON in our own tests. The difference is that a decision model always returns them in a fixed form. Whatever the detector, choosing where to cut is left to you, and that is the subject here.
Counting the Costs: Stopping by Mistake vs. Missing a Failure
| Actual print | Stopped | Continued |
|---|---|---|
| Failed | Correctly stopped (no extra loss) | Missed (cost C_FN) |
| Not failed | Stopped by mistake (cost C_FP) | Correctly continued (no extra loss) |
C_FP is the cost of a false positive (stopping a good print) and C_FN of a false negative (missing a failure). Even a correct stop loses the material already used, but that loss happens whether you stop or not, so we count only what the decision changes and set correct decisions to zero. Only the electricity price below is an official figure: 31 yen per kWh including tax, the guideline unit price from Japan’s National Fair Trade Council of Home Electric Appliances (revised July 22, 2022), which is a guideline, not a tariff. Everything else is an assumption from our cost article.
| Item | Value | Type |
|---|---|---|
| Electricity guideline price | 31 yen/kWh (tax incl.) | Official guideline |
| Filament price | 3,000 yen per kg | Assumption |
| Material used | 80 g | Assumption |
| Waste and supports | 15% | Assumption |
| Average power | 120 W | Assumption |
| Print time | 5 hours | Assumption |
| Printer price and expected hours | 80,000 yen, 2,000 hours | Assumption |
| Component | Calculation | Amount |
|---|---|---|
| Material | 80 g × 3 yen/g × 1.15 | 276 yen |
| Electricity | 0.12 kW × 5 h × 31 yen/kWh | 18.6 yen |
| Machine | 80,000 yen ÷ 2,000 h × 5 h | 200 yen |
| Total | 276 + 18.6 + 200 | 494.6 yen |
That is 98.92 yen per hour (material 55.2, electricity 3.72, machine 40). Machine cost is an internal allocation, not tax depreciation. We also assume material is used in proportion to time, which is not true for every print; re-estimate per print if you can. Our cost article assumed a 10 percent failure rate and marked up direct costs by about 11 percent; that figure is an assumption too. Stop decisions exist to shrink that failure cost.
The Threshold Formula for 3D Print Monitoring: Elkan (2001), Equation (2)
If the model returns probability p that the print has failed, the expected losses are:
- Expected loss if you stop = (1 − p) × C_FP
- Expected loss if you continue = p × C_FN
Stopping is cheaper when p × C_FN is at least (1 − p) × C_FP. Solving for p:
p* = C_FP / (C_FP + C_FN)
Stop if p >= p*, otherwise continueCharles Elkan’s “The Foundations of Cost-Sensitive Learning” (IJCAI 2001, pp. 973–978) says each example should be predicted as the class with the lowest expected cost, weighted by the conditional probability of each class, and equation (2) gives the two-class threshold p* = (c10 − c00) / (c10 − c00 + c01 − c11), where c_ij is the cost of predicting i when the true class is j. Here c10 is stopping a good print (our C_FP) and c01 is missing a failure (our C_FN); with zero cost for correct decisions, equation (2) becomes our formula.
The direction makes sense: the higher the cost of a mistaken stop, the higher p* goes; the higher the cost of a miss, the lower it goes; when the two are equal, p* is exactly 0.5. TypeSafe’s noul documentation says the same thing: use 0.5 if you can act on yes and no alike, raise the threshold if acting on a false yes is expensive, and lower it if missing a true yes is expensive, for example a safety issue.
Elkan makes another point that fits this setup: when misclassification costs differ, rather than retraining on rebalanced data, train on the data as given and explicitly compute the optimal decision from the classifier’s probabilities. With a decision model you only write a question, so the decision step is the only part you control, and computing the threshold from costs follows that advice.
Working Through the Cost Example: The Threshold Moves with Progress
Assumptions: direct costs of 494.6 yen accumulate evenly at 98.92 yen per hour over five hours; a failed part is useless; without a stop you only notice failure at the end; a stop means restarting from scratch; correct decisions cost nothing extra; and a human check always decides correctly (used in the next section). With r as the fraction completed, a mistaken stop wastes what has been used so far and a miss wastes what is left:
C_FP = 494.6 * r (used so far, wasted by the restart)
C_FN = 494.6 * (1 - r) (remaining time, spent on a failed part)
p* = C_FP / (C_FP + C_FN) = r| Progress | Cost of a mistaken stop | Cost of a miss | Threshold p* |
|---|---|---|---|
| 20% (hour 1) | 98.92 yen | 395.68 yen | 0.20 |
| 50% (hour 2.5) | 247.30 yen | 247.30 yen | 0.50 |
| 80% (hour 4) | 395.68 yen | 98.92 yen | 0.80 |
Early on, a mistaken stop loses only one hour, 98.92 yen, while a miss wastes four more hours, 395.68 yen, so stopping above 0.20 minimizes expected loss. Late in the print it flips: a mistaken stop throws away 395.68 yen of work, while finishing a failed print wastes only 98.92 yen, so do not stop below 0.80. The same 0.5 means stop at hour 1 and continue at hour 4. Threshold equals progress only under these assumptions:
- If a person may notice the failure partway through anyway, the cost of a miss shrinks and the threshold rises.
- If a stopped print can be resumed, the cost of a mistaken stop shrinks and the threshold falls.
- If material use is not proportional to time, recount both costs at each point.
- Post-processing and the printer being tied up by reprints are not included.
For your own prints, write down the assumptions first, then put your own numbers into both costs. The formula stays the same; the amounts change with every print.
When to Ask a Human: The Cost of One Check Sets the Middle Band
Add a third action, notifying a person, with cost c_h per check and the assumption that a check always decides correctly. Asking a person beats stopping when c_h is less than (1 − p) × C_FP, and beats continuing when c_h is less than p × C_FN. The p values meeting both conditions form the band to send to a person:
Send to a person when: c_h / C_FN < p < 1 - c_h / C_FP
If the band is empty, deciding to stop or continue costs less than a checkWe set c_h to 100 yen, roughly five minutes at the 1,200 yen hourly rate assumed in our cost article; the 100 yen itself is our example.
| Progress | Lower bound c_h / C_FN | Upper bound 1 − c_h / C_FP | Send to a person |
|---|---|---|---|
| 20% (hour 1) | 0.2527 | −0.0109 | Never |
| 50% (hour 2.5) | 0.4044 | 0.5956 | 0.4044 < p < 0.5956 |
| 80% (hour 4) | 1.0109 | 0.7473 | Never |
At 20 and 80 percent there is no band, because one of the two mistakes costs less than the 100 yen check. At 20 percent a mistaken stop loses only 98.92 yen, so stopping and reprinting is cheaper than checking; at 80 percent a miss wastes only 98.92 yen, so finishing is cheaper. Mid-print both costs are 247.30 yen, and only when p sits near 0.5 is a 100 yen check worth it. Cheaper checks widen the band; whether you can look right away when notified changes c_h, so set it for your situation.
Deferring a decision to another means has a classic reference: C. K. Chow’s 1970 paper “On Optimum Recognition Error and Reject Tradeoff” (IEEE Transactions on Information Theory) studied optimal reject rules and the tradeoff between errors and rejections. TypeSafe’s noul docs also say middle values can go to a person rather than either code path. Our calculation just sizes that middle band from material and checking costs.
How costly a human check is depends on whether you can see the print right away. A USB webcam pointed at the printer lets you check from your screen instead of walking over.
The Formula Assumes the Probabilities Are Right
So far p has meant the actual probability that the print has failed at that moment. Expected loss p × C_FN only makes sense if, of all prints labeled 0.8, about 80 percent really have failed. If only half of them have, no amount of care with the threshold will make the expected loss match reality. Agreement between probabilities and observed frequencies is called calibration. scikit-learn’s guide says a well-calibrated binary classifier labels samples around 0.8 such that about 80 percent are positive, and warns that some models estimate class probabilities poorly.
Vendors say they work on this. TypeSafe trains Jev with a reinforcement learning method it calls RLCD to return calibrated decisions; Cloudflare says Clef’s post-training combined a Brier loss to refine calibration. Both are vendor claims, and whether they hold for your questions and data must be checked separately. TypeSafe itself says calibration describes a population of predictions, not each answer. Below are two runs we did on October 7, 2026, each condition once, so the results do not generalize, and Jev was not part of either.
Image classification: Clef-flash was right on fewer than half of its 0.8-plus answers
The first run classified 50 defect photos (10 per type, chosen at random, resized to a 1024 px long edge) from the public FDM 3D Printing Defect Dataset (Hu and colleagues, MIT license) via its Hugging Face copy. The photos were taken by the dataset authors on the printer during (or right after) printing, with defects created on purpose. Types: Cracking, Layer_shifting, Off_platform, Stringing, and Warping; every photo had a defect, and there was no “no problem” option. A local Clef-flash on Ollama and claude -p (Sonnet 5.5) each saw every photo once.
| Model | Correct | Top probability ≥ 0.8 | Correct among those | Brier (multiclass, 0–2) |
|---|---|---|---|---|
| Clef-flash (local Ollama) | 25/50 | 21 | 10 | 0.751 |
| claude -p (Sonnet 5.5) | 41/50 | 18 | 16 | 0.379 |
Clef-flash got only 10 of 21 high-probability answers right, and its mean top probability was 0.654 when right versus 0.641 when wrong. It also labeled all 10 Off_platform photos and 27 of 50 overall as Stringing. Excluding two augmented images in the sample, it was right on 9 of 20, the same pattern. This question picks a defect type rather than whether to stop, but it is still an example where probability and correctness did not line up; feeding such probabilities into the threshold formula would make computed and actual losses diverge. Details are in the defect classification article.
Settings checks: without recommended values, average confidence fell to 0.066
The second run judged slicer setting mistakes before printing. We built the answer key from Bambu Studio’s official profiles (P1S, 0.4 mm nozzle) and prepared 42 combinations of filament, nozzle temperature, plate, and bed temperature: 18 with no problem, 18 with the nozzle 20 °C outside the range, and 6 with an unsupported plate. These went to a local Nimble 9B on Ollama three ways, asking “may this print start?” (noul) and “what is the problem?” (choice) with one English wording.
| Input | Start? (noul) correct | Problem (choice) correct | Average choice confidence |
|---|---|---|---|
| JSON + recommended values | 33/42 | 38/42 | 0.777 |
| Japanese request + recommended values | 24/42 | 39/42 | 0.716 |
| Japanese request only | 18/42 | 17/42 | 0.066 |
Without recommended values, choice accuracy fell to 17 of 42 and average confidence to 0.066, moving in the same direction. But Ollama’s confidence measures how concentrated the distribution is, and the docs say it is not the probability of being right, so low does not mean wrong and high does not mean right. The two questions also disagreed: with the Japanese request and recommended values, the choice correctly named the nozzle temperature in all 18 nozzle cases, yet the noul answered “start” for all 18. With answers that can point in opposite directions, feeding the noul probability straight into the formula is risky. On the same 42 combinations claude -p was perfect with recommended values and got 34 right without them. See the slicer settings article.
Checking Probabilities with the Brier Score
Glenn W. Brier of the US Weather Bureau introduced his score for probability forecasts in 1950 (Monthly Weather Review 78(1), pp. 1–3). The original definition is multiclass: over n occasions, each event falls in one of r classes; for every occasion and class, square the difference between the forecast probability f and E (1 for the class that occurred, 0 otherwise), sum, and divide by n. It runs from 0 (perfect) to 2 (worst). For two classes it is usually halved to 0–1; scikit-learn’s brier_score_loss returns 0–2 for multiclass and halves binary scores to 0–1 by default (multiclass support since version 1.7). Always state the scale.
Brier noted that the score rewards honest probabilities: a forecaster who cannot be certain is encouraged to state probabilities without bias, and one with no skill to state the climatological frequency. scikit-learn describes it as a strictly proper scoring rule. Baselines are easy to compute: always 0.2 across five classes gives 0.8 (0–2 scale); always 0.5 in a binary case gives 0.25 (0–1 scale). Clef-flash’s 0.751 on balanced classes barely beat 0.8, far from claude -p’s 0.379.
A low Brier score does not guarantee good calibration; scikit-learn warns that a poorly calibrated model can score well through strong discrimination. So also bin by probability and compare each bin’s mean probability with the observed rate, which is what a reliability diagram plots. Compare against the mean probability in the bin, not its lower edge. In our image run, Clef-flash’s 21 answers at 0.8 or above averaged 0.929 but only 10 (0.476) were right; claude -p’s 18 averaged 0.896 with 16 (0.889) right. With about 50 answers, finer bins are too small to read.
Steps before using a threshold
- Collect examples with known answers, labeled by the state at that moment: was the print failing then? Label from photos reviewed later, not from whether the print failed in the end, or earlier healthy moments get counted as failures.
- Ask the model the same question and log every probability, using the wording and input format you will use in production.
- Compute the Brier score with its scale and compare with a baseline. With a failure rate b in your records, always answering b scores b × (1 − b) on the 0–1 scale (0.09 when b is 0.1), a stricter baseline than 0.25.
- Bin by probability and list count, mean probability, and observed failure rate. Make sure bins near p* and the human band have enough examples and agree.
- If they do not agree, do not use the computed threshold as is. TypeSafe’s noul docs say to narrow the gap between yes and no thresholds if too many cases go to people, and widen it if too many wrong routings get through. scikit-learn’s calibration chapter covers correcting the probabilities themselves.
# rows: list of (probability p, 1 if failing at that moment else 0)
def brier_binary(rows):
# binary Brier score on the 0-1 scale (original 0-2 scale divided by 2)
return sum((p - y) ** 2 for p, y in rows) / len(rows)
def band(rows, lower, upper):
picked = [(p, y) for p, y in rows if lower <= p <= upper]
n = len(picked)
if n == 0:
return 0, None, None
return n, sum(p for p, y in picked) / n, sum(y for p, y in picked) / n
b = sum(y for p, y in rows) / len(rows) # observed failure rate
print(brier_binary(rows), "baseline 0.25, or", b * (1 - b))
print(band(rows, 0.4, 0.6), "count, mean probability, failure rate")Checking a model on your own labeled examples before trusting it is the core of evaluating AI systems. A book on engineering applications with foundation models walks through building those evaluations.
Operating It: Stop Decisions Do Not Replace Printer Safety Features
- At the start of a print, compute C_FP and C_FN for each point in progress from that print’s direct cost and time.
- Set c_h, the cost of one human check, for your situation.
- Each time the model returns p, compare it with the threshold and human band for the current progress.
- Log each decision and whether the print was actually failing at that moment, and keep updating the Brier score and the per-bin count, mean probability, and failure rate.
lower = c_h / C_FN
upper = 1 - c_h / C_FP
if lower < p < upper: notify a person
elif p >= p*: stop
else: continueBecause the bounds divide by C_FN and C_FP, this form works only when both costs are above zero, between 0 and 100 percent progress. Elkan assumes a wrong decision always costs more than a right one and notes that if this fails for one class, assigning every example to the same class is optimal. To cover the endpoints with one rule, compare the three expected costs directly, (1 − p) × C_FP for stopping, p × C_FN for continuing, and c_h for asking, and pick the smallest. A non-empty human band always contains p*, so outside it p* alone decides.
Put thresholds on p, not on confidence, because confidence formulas differ: TypeSafe’s choice confidence is (p_max − 1/n) ÷ (1 − 1/n) and uses only the top probability, while Ollama’s is 1 − H(p) ÷ ln(N) and is explicitly not the probability of being right. For the example probabilities in Ollama’s docs (0.0125, 0.9781, 0.0093), the entropy formula gives 0.8908 (the docs show 0.8906 because the probabilities are rounded) and TypeSafe’s gives 0.9671, so confidence values cannot be compared across providers. A noul returns one probability and no confidence at all. API charges per call can also be added to expected loss; we did not include them, but they add up as you check more often.
Most important: a decision model does not replace the printer’s own safety features. Thermal runaway protection must keep working on the printer side regardless of the model, and a missing stop answer does not mean the print is safe. Treat stop decisions as an aid for reducing material and time losses. Nor does this calculation say whether unattended printing is acceptable: it counts only material, electricity, and machine costs, not losses like fire, which are not the kind of thing you trade off with probabilities and thresholds. For how to read printer state, see the printer state article.
Summary: Set Monitoring Thresholds from Both Costs and Calibration
- A decision model returns only the probability; where to stop is up to you. The default 0.5 assumes both mistakes cost the same.
- Set the threshold with Elkan’s equation (2) and zero cost for correct decisions: p* = C_FP / (C_FP + C_FN).
- With our cost example (31 yen/kWh is an official guideline; the rest are assumptions), 494.6 yen spread evenly over five hours and a restart after any stop, the threshold equals progress: 0.20, 0.50, and 0.80. Different assumptions break this.
- With a 100 yen human check, of the three points we computed, a human band appears only at 50 percent (0.4044 to 0.5956).
- The formula assumes accurate probabilities. In our runs Clef-flash was right on only 10 of 21 answers at 0.8 or above, and Nimble 9B’s average confidence fell to 0.066 without recommended values while its noul and choice answers sometimes disagreed.
- Before using a threshold, check the Brier score (with its scale) and per-bin counts, mean probabilities, and observed rates on examples labeled by the state at that moment. Put thresholds on probability, not confidence.
- Stop decisions are an aid to reduce losses, not a replacement for printer safety features.
When adding a probability-returning AI to print monitoring, the order is: check how well the probabilities hold, count the costs, then compute the threshold. The formula fits on one line; the work is in checking the probability and the amounts you put into it.
Sources
- Charles Elkan, The Foundations of Cost-Sensitive Learning, IJCAI 2001
- Glenn W. Brier, Verification of Forecasts Expressed in Terms of Probability, Monthly Weather Review 78(1), 1950
- C. K. Chow, On Optimum Recognition Error and Reject Tradeoff (IBM Research)
- scikit-learn: brier_score_loss
- scikit-learn: Probability calibration
- scikit-learn: Tuning the decision threshold for class prediction
- TypeSafe Docs: Noul
- TypeSafe Docs: Confidence
- Ollama Docs: System One
- Cloudflare Blog: Introducing Clef
- National Fair Trade Council of Home Electric Appliances: FAQ (Japanese)





