-data = FileAttachment("df_scores@1.csv").csv({ typed: true })+data = FileAttachment("df_scores.csv").csv({ typed: true })
viewof replace = Inputs.range([100, 2000], {label: "Repair amount", step: 100})
viewof repair = Inputs.range([1000, 10000], {label: "Repair amount", step: 1000})
Plot.plot({ y: { grid: true }, x: { grid: true, label: "Threshold" }, marks: [ Plot.lineY(data1, { x: "threshold", y: "FP-cost", tip: true, stroke: "red", strokeWidth: 3 }), Plot.lineY(data1, { x: "threshold", y: "FN-Cost", tip: true, stroke: "darkblue", strokeWidth: 3 }), Plot.lineY(data1, { x: "threshold", y: "Total-Savings", tip: true, stroke: "green", strokeWidth: 3 }), Plot.dot(["FP-cost", "FN-Cost", "Total-Savings"], { x: () => data1[i].threshold, y: (d) => data1[i][d], fill: "black", r: 5 }), Plot.ruleY([0], { strokeWidth: 5 }) ] })
## Spec I would like to make calculations using the slider inputs times the column values to create a new graph like the one above. I.e. if the sliders are changed, the curves will change. Calculations are as follows: fp_cost = false_positive * replace(slider value) fn_cost = false_negative * repair(slider value) tp_cost = true_positive * replace(slider value) total_savings = (true_positive * repair(slider value)) - tp_cost - fp_cost