Unlisted
Edited
Sep 7, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
y: { grid: true },
x: { grid: true, label: "Threshold" },
marks: [
Plot.lineY(data, {
x: "threshold",
y: "fp_cost",
tip: true,
stroke: "red",
strokeWidth: 3
}),
Plot.lineY(data, {
x: "threshold",
y: "fn_cost",
tip: true,
stroke: "darkblue",
strokeWidth: 3
}),
Plot.lineY(data, {
x: "threshold",
y: "total_savings",
tip: true,
stroke: "green",
strokeWidth: 3
}),
Plot.dot(["fp_cost", "fn_cost", "total_savings"], {
x: () => data[i].threshold,
y: (d) => data[i][d],
fill: "black",
r: 5
}),
Plot.ruleY([0], { strokeWidth: 5 })
]
})
Insert cell
Changed in base
-
data = FileAttachment("df_scores@1.csv").csv({ typed: true })
+
data = FileAttachment("df_scores.csv").csv({ typed: true })
Insert cell
Added in base
viewof replace = Inputs.range([100, 2000], {label: "Repair amount", step: 100})
Insert cell
Added in base
viewof repair = Inputs.range([1000, 10000], {label: "Repair amount", step: 1000})
Insert cell
Added in base
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 })
  ]
})
Insert cell
Added in base
## 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
Insert cell
Added in base
Insert cell