From a1d2d69b5752ed188a5ea418c30dbf8246ba3241 Mon Sep 17 00:00:00 2001
From: shlomihod <6306135+shlomihod@users.noreply.github.com>
Date: Mon, 4 Mar 2024 20:26:18 -0500
Subject: [PATCH] fix typos
---
flor/index.html | 20 +++---
flor/sel.js | 159 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 169 insertions(+), 10 deletions(-)
create mode 100644 flor/sel.js
diff --git a/flor/index.html b/flor/index.html
index 2e4f9e9..4a2b0b4 100644
--- a/flor/index.html
+++ b/flor/index.html
@@ -84,7 +84,7 @@
Employee Theft Detection
Having received numerous complaints that its system is making ‘bad decisions’ in the Oceana region, FLOR revealed a surge in employee merchandise theft in that region that was distorting inventory predictions.
FLOR designed an Automated Decision System (ADS) using machine learning for identifying employees at higher risk of stealing.
-
Based potential sources of information, the system will automatically decide which employees should be subject of a face to face investigation, to determine the likelihood that they are in fact engaging in larceny.
+
Based on different sources of information, the system can automatically decide which employees should be subject of a face to face investigation, to determine the likelihood that they are in fact engaging in larceny.
@@ -93,7 +93,7 @@
Employee Theft Detection
Ground Truth
Our assumption is that 30% of the employees in Oceania have either stolen merchandize or have attempted to steal it a.
- The other 70% of them did not b.
+ The other 70% did not b.
@@ -101,9 +101,9 @@
Ground Truth
Model Predictions
-
In a perfect world, employees who commit or tried to commit larceny flagged as ones
- requiring an additional
- investigation, and only employees who are are not at risk of stealing would be
+ In a perfect world, employees who commit or tried to commit larceny are flagged as ones
+ requiring additional
+ investigation, and only employees who are not at risk of stealing would be
flagged
as not requiring an
additional investigation.
@@ -119,7 +119,7 @@
Model Mistakes
The model might make a mistake and not flag an employee who is at risk being a thiefc.
Or the opposite: the model might flag an employee as one at risk f, while in
- fact they have not and have not attempted stealing and and no additional investigation is required.
+ fact they have never stolen attempted stealing and thus no additional investigation is required.
@@ -128,7 +128,7 @@ Never Miss a Potential Employee-Thief...
One approach would be to have the model flag employees at risk of being thiefs “aggressively”, such that close calls would
be decided as
- “at risk”, and so the model will rarely miss an employeeat at risk of being thief.
+ “at risk”, and so the model will rarely miss an employeeat at risk of being a thief.
We can evaluate this model by counting the number of employees who are correctly and incorrectly flagged
as employees at
@@ -144,7 +144,7 @@
... Or Avoid Unnecessary Investigations?
On the other hand, company’s resources would be allocated to cases where no further investigation is
required,
- resulting in wasting money, maybe more importantly, in unnecessarily burdening employees who are
+ resulting in wasting money. Maybe more importantly, it might burden employees who are
not truly at
risk.
@@ -202,7 +202,7 @@
Putting it all Together
Now it is your turn to decide (1) which data sources to use and which to exclude; and (2) how
aggressively the model is
- when flagging a call about an employees at risk of stealing.
+ when flagging an employee at risk of stealing.
@@ -306,7 +306,7 @@ Credits
-
+
diff --git a/flor/sel.js b/flor/sel.js
new file mode 100644
index 0000000..796ad41
--- /dev/null
+++ b/flor/sel.js
@@ -0,0 +1,159 @@
+/* Copyright 2020 Google LLC. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+
+window.makeSel = function () {
+ var s = c.width / (nCols - 2) - 1
+
+ var personSel = c.svg.appendMany('g', students)
+ var rectSel = personSel.append('rect')
+ .at({
+ height: s,
+ width: s,
+ x: -s / 2,
+ y: -s / 2,
+ // fillOpacity: .2
+ })
+
+ // .at({ fontSize: d => d.isMale ? 26 : 34, dy: '.33em', textAnchor: 'middle' })
+ var textSel = personSel.append('text.weepeople')
+ .text(d => d.letter)
+ .at({ fontSize: d => d.isMale ? 34 : 42, dy: '.33em', textAnchor: 'middle' })
+ .st({ stroke: d => d.isSick ? dcolors.sick : dcolors.well })
+
+ addSwoop(c)
+
+ var botAxis = c.svg.append('g').translate(c.width + 150, 1)
+ var truthAxis = botAxis.append('g.axis').translate([0, 0])
+
+ truthAxis.append('text').text('Truth (stole or attempted to steal))')
+ .at({ textAnchor: 'middle', fontWeight: 500, x: s * 2.65 })
+
+ truthAxis.append('g').translate([45, 22])
+ .append('text').text('Yes').parent()
+ .append('text.weepeople').text('k')
+ .at({ fontSize: 34, x: 22, y: 5 })
+ .st({ fill: colors.sick })
+
+ truthAxis.append('g').translate([95, 22])
+ .append('text').text('No').parent()
+ .append('text.weepeople').text('d')
+ .at({ fontSize: 34, fill: colors.well, x: 22, y: 5 })
+ .st({ fill: colors.well })
+
+
+ var mlAxis = botAxis.append('g.axis').translate([220, 0])
+
+ mlAxis.append('text').text('ML Prediction (flagged at risk)')
+ .at({ textAnchor: 'middle', fontWeight: 500, x: s * 2.8 })
+
+ mlAxis.append('g').translate([35, 22])
+ .append('text').text('Yes').parent()
+ .append('rect')
+ .at({ width: s * .7, height: s * .7, fill: lcolors.sick, x: 28, y: -17 })
+
+ mlAxis.append('g').translate([100, 22])
+ .append('text').text('No').parent()
+ .append('rect')
+ .at({ width: s * .7, height: s * .7, fill: lcolors.well, x: 28, y: -17 })
+
+
+
+ var fpAxis = c.svg.append('g.axis')
+
+ // fpAxis.append('rect')
+ // .translate(nCols*s - 20, 1)
+ // .at({
+ // fill: lcolors.well,
+ // x: -82,
+ // y: -12,
+ // width: 56,
+ // height: 28,
+ // // stroke: '#000',
+ // })
+
+ // fpAxis.append('text')
+ // .translate(nCols*s - 20, 1)
+ // .tspans(['False', 'Negatives'], 12)
+ // .at({textAnchor: 'end', x: -s/2 - 10, fill: colors.sick})
+
+
+ // fpAxis.append('text')
+ // .translate(nCols*s, 0)
+ // .tspans(['False', 'Positives'], 12)
+ // .at({textAnchor: 'start', x: s/2 + 7, fill: colors.well})
+
+
+ var sexAxis = c.svg.append('g.axis')
+
+ sexAxis.append('text').st({ fontWeight: 500, fill: '' })
+ .translate([-15, -30])
+ .text('Adults')
+
+ sexAxis.append('text').st({ fontWeight: 500, fill: '' })
+ .translate([-15, -30 + students.maleOffsetPx])
+ .text('Children')
+
+
+ var brAxis = c.svg.append('g.axis')
+ var cpx = 0
+
+ brAxis.append('path')
+ .translate([-15, -20])
+ .at({
+ stroke: colors.sick,
+ fill: 'none',
+ d: ['M -3 -3 v', -cpx, 'h', students.fSickCols * students.colWidth, 'v', cpx].join('')
+ })
+
+ brAxis.append('path')
+ .translate([-15, -20 + students.maleOffsetPx])
+ .at({
+ stroke: colors.sick,
+ fill: 'none',
+ d: ['M -3 -3 v', -cpx, 'h', students.mSickCols * students.colWidth, 'v', cpx].join('')
+ })
+
+ brAxis.append('text').st({ fontWeight: 500, fill: colors.sick })
+ .translate([-15, -30])
+ .text('Sick Adults')
+
+ brAxis.append('text').st({ fontWeight: 500, fill: colors.sick })
+ .translate([-15, -30 + students.maleOffsetPx])
+ .text('Sick Children')
+
+
+
+
+ return { personSel, textSel, rectSel, fpAxis, sexAxis, brAxis, truthAxis, mlAxis, botAxis }
+}
+
+window.updateSel = () => {
+ sel.rectSel.at({ fill: d => d.grade > d.threshold ? lcolors.sick : lcolors.well })
+ sel.textSel
+ .st({
+ strokeWidth: d => d.grade > d.threshold == d.isSick ? 0 : .6,
+ })
+}
+
+
+
+
+
+
+
+
+
+if (window.init) window.init()