Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomihod committed Mar 5, 2024
1 parent d957115 commit a1d2d69
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 10 deletions.
20 changes: 10 additions & 10 deletions flor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ <h1>Employee Theft Detection</h1>
<p>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.

<p>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.
<p>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.

</div>

Expand All @@ -93,17 +93,17 @@ <h1>Employee Theft Detection</h1>
<h3>Ground Truth</h3>

<p>Our assumption is that 30% of the employees in Oceania have either stolen merchandize or have attempted to steal it <wee class='sick'>a</wee>.
The other 70% of them did not <wee class='well'>b</wee>.
The other 70% did not <wee class='well'>b</wee>.

</div>


<div>
<h3>Model Predictions</h3>

<p>In a perfect world, employees who commit or tried to commit larceny <bg class='sick'>flagged as ones
requiring an additional
investigation</bg>, and only employees who are are not at risk of stealing would be <bg>
<p>In a perfect world, employees who commit or tried to commit larceny are <bg class='sick'>flagged as ones
requiring additional
investigation</bg>, and only employees who are not at risk of stealing would be <bg>
flagged
as not requiring an
additional investigation</bg>.
Expand All @@ -119,7 +119,7 @@ <h3>Model Mistakes</h3>
<p>The model might make a mistake and not flag an employee who is at risk being a thief<wee class='sick bg-well'>c</wee>.

<p>Or the opposite: the model might flag an employee as one at risk <wee class='well bg-sick'>f</wee>, 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.
</div>


Expand All @@ -128,7 +128,7 @@ <h3>Never Miss a Potential Employee-Thief...</h3>

<p>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.

<p>We can evaluate this model by counting the number of employees who are correctly and incorrectly flagged
as employees at
Expand All @@ -144,7 +144,7 @@ <h3>... Or Avoid Unnecessary Investigations?</h3>

<p>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.

Expand Down Expand Up @@ -202,7 +202,7 @@ <h3>Putting it all Together</h3>

<p>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.


<div class='metrics'></div>
Expand Down Expand Up @@ -306,7 +306,7 @@ <h3>Credits</h3>
<script src='/annotations.js'></script>

<script src='/students.js'></script>
<script src='/sel.js'></script>
<script src='/flor/sel.js'></script>
<script src='/slider.js'></script>
<script src='/mini.js'></script>
<script src='/metrics.js'></script>
Expand Down
159 changes: 159 additions & 0 deletions flor/sel.js
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit a1d2d69

Please sign in to comment.