TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
Live and (Machine) Learn: Cognitive Services and Vue.js
1.
2.
3.
4. W E L I V E O U R L I V E S I N C R E A S I N G L Y O N L I N E
5. W E L I V E O U R L I V E S I N C R E A S I N G L Y O N L I N E
6.
7.
8.
9.
10. B U T T H E O N L Y
C O N S T A N T I S C H A N G E .
11. C O N S U M E N T E N B O N D - E N E R G I E V E R G E L I J K E R
12. – S A F I A N O B L E , P H D ,
A U T H O R O F A L G O R I T H M S O F
O P P R E S S I O N
“People are using search engines rather than
libraries or teachers to make sense of the world
we’re inhabiting.”
17. " M A C H I N E L E A R N I N G
G I V E S C O M P U T E R S
A B I L I T Y T O L E A R N
W I T H O U T B E I N G
E X P L I C I T L Y
P R O G R A M M E D ”
A R T H U R S A M U E L , 1 9 5 9
35. O N C E A C R I M I N A L ,
A L W A Y S A C R I M I N A L
• 68% become re-offenders within 3 years,
77% in 5 years
• People report to finding it hard to fit back into “normal”
life once being in prison for a while
• Employment becomes more difficult
S O U R C E : U S D E P A R T M E N T O F J U S T I C E
36. C O M P A S
R I S K A S S E S S M E N T
Recidivism Score is used to determine whether someone
will commit another crime within two years.
S O U R C E : P R A C T I T I O N E R ’ S G U I D E T O C O M P A S S C O R E S
37. @sarah_edo
S O U R C E : M A C H I N E B I A S , R I S K A S S E S S M E N T I N C R I M I N A L S E N T E N C I N G
42. W H A T M A K E S C O M P A S F A I L ?
• No transparency
• It doesn’t adapt over time
• People use it without asking questions
• Including whether this is the right place
for an algorithm at all.
C A N O N L Y E V A L U A T E T H E
P A S T
S O U R C E : W E A P O N S O F M A T H D E S T R U C T I O N
43. @sarah_edo
“I don’t like the idea myself of COMPAS being the sole
evidence that a decision would be based upon.”
-Brennan, co-creator of COMPAS
44. P E O P L E W I L L
S A Y
A L G O R I T H M S
C A N ’ T B E
B I A S E D .
B U T A L G O R I T H M S A R E
W R I T T E N B Y P E O P L E .
45. A C X I O M , A D A T A B R O K E R A G E
• Had an average of 1500 data points for 500 million
consumers, including the entire adult population of the
United States
• That was in 2012.
• That’s just one company.
S O U R C E : T E C H N I C A L L Y W R O N G
46. W H A T D O E S
F A C E B O O K T H I N K
A B O U T M E ?
Science
Wine
Do it yourself
Toys
Software Developer
Animated Movies
Cloud computing
The Oatmeal
Neuroscience
Dogs
3d computer graphics
Trench Coats
Mermaid
Navy
James Patterson
Knitting
Shoes
Sports
47. • Facebook uses these tags to drive directed ads
• You can use it to target on demographics, including
race
• Buying a house- limited to races
• Illegal under the Fair Housing Act of 1968
• Once pointed out, Facebook fixed it
S O U R C E : T E C H N I C A L L Y W R O N G
49. – S A R A W A C H T E R - B O E T T C H E R ,
A U T H O R O F D E S I G N F O R R E A L
L I F E
“It’s not that digitizing the world is inherently bad.
But the more technology becomes embedded in all
aspects of life, the more it matters whether that
technology is biased, alienating, or harmful”
82. M L I N M E D I C I N E
• Sophia Genetics is training algorithms to diagnose
diseases through DNA analysis
• All4Cure is a social network for cancer patients where
patients can enter diagnosis and treatment so that it
can be analyzed
• HealthMap algorithm spotted an ebola outbreak 9 days
before the World Health Organization
S O U R C E S : S I L I C O N A N G L E , G E E K W I R E , A N D N E W S W E E K
83. M L I N M E D I C I N E
• HealthMap algorithm spotted an ebola outbreak 9
days before the World Health Organization
0
25
50
75
100
# Infected
89. W H A T H A P P E N S
W H E N
T H E Y ’ R E O F F L I N E ?
B U T …
90. @sarah_edo
backgroundSync && Service Workers
• Alert them when they are offline
• When they’re offline, queue the messages
• When it’s back up, send them out
(even if the browser tab is closed)
93. @sarah_edo
Register the service worker when a request is made
requestButton(type) {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./service-worker.js').then((registration) => {
return navigator.serviceWorker.ready;
}).then((registration) => {
registration.sync.register(`request-${type}`).then(() => {
console.log('%c sync registered', 'font-size: 16px; …’);
}).catch(function (error) {
console.log('Unable to fetch resources.');
});
...
}
94. @sarah_edo
Create the sync event
self.addEventListener('sync', event => {
let type = event.tag.split('-')[1]
console.log(
`%c sync event fired: request ${type}`,
`${styles} background: #00449e; color: #cdecff;`
)
event.waitUntil(fetchResource(type))
})
95. @sarah_edo
Fetch the URL, and postMessage back to the clientconst fetchResource = resource => {
fetch('//jsonplaceholder.typicode.com/users')
.then(response => {
return response
})
.then(text => {
const message = {
response: text.status,
resource: resource
}
self.clients
.matchAll()
.then(all => all.map(client => client.postMessage(message)))
})
...
96. @sarah_edo
updateRequest(response, type) {
if (response === 200) {
this.responseSuccess = true
this.messageQueue.push(
`You successfully sent a message: <span>${type}</span>`
)
}
},
Let them know when it’s successful
97. A S K Q U E S T I O N S
M O S T I M P O R T A N T …
I want all of you to take your phones out and hold them in your hands. The next thing I want you to do is pass your phone to the person on your right.
Got it? Okay, hold that phone in your hands, look at it, feel it.
It's a little distracting, isn't it? You almost can't look at the phone in your hands because you're thinking about your phone in someone else's hands.
The reason why we feel that way is because we live so much of our lives in this digital space. Those phones that we have are an extension of ourselves. Pete Smart makes this point when he talks about designing for Human-Computer Interaction, where he explores our relationship with technology. We’re going to talk about this today, too, but with less of a focus on the device, and more about our entanglement with the increasingly complex systems governing our relationship to our own information. You can give your phones back.
There are a lot of different takes on the impact of living our lives increasingly online. If you’re in this room, chances are that as we started to adopt things digitally, we as web developers, were excited! Chances are the people in this room saw the potential of representation online and thought: "What are the possibilities here? What can we build? What can we make?".
First we have geocities, which was a bastion of unbounded creative internet explosion, I mean. Cmon, this is glorious
Then we have myspace, which some might remember. Everyone was friends with Tom, and actually in putting this talk together, I revisited mine, which was like a time capsule of terrible bangs, my old art pieces, and weird photos of me in a bathroom? I guess it was a phase.
And some of us started because we wanted to be leet hackers, so good at programming that our fingers are literally on fire
Whatever our interests were, the internet allowed us to share our lives, and express ourselves in the most creative, bizarre, and interesting unique ways that only a collectivity of human minds could imagine.
But, the only constant is change.
Soon we had SO MANY ways of being represented online and so many people were online that we needed to automate these tasks, systems that could analyze, build, tag, and sort for us.
As things get more complicated what we start to realize is, all of our lives are these summations of these digital models. We become pieces of other people's algorithms. And that means we might be summarized in a single way.
These inaccuracies start to be reflected in what we learn, what we believe in. They become our societies, our education.
Tech can be magical in this way!
Just like any other software we write, the more magic it contains, the more we can’t see into ways it might fail.
I’m Sarah Drasner, known on twitter as Sarah edo,
I work for Microsoft, eh? Eh?
And today’s talk is called Live and Machine Learn
In this talk we'll explore the paradigm shift that machine learning can bring. First we’ll talk a little on a very high level about how machine learning works. Then things will get a little dark here for a minute while we talk about some of applications of machine learning that have gone south, but don’t worry! We’re going to come up for air and explore some great things you can do with Azure cognitive services in your web applications. We’ll even talk about some good things you can do with web applications in general!
So let’s talk on a very high level about what machine learning is, and we’ll kick it off with a quote, by the fella who coined the term.
We’re programmers, we’re all familiar with if/then statements.
So, what if those conditions for all of the if/then statements become too complicated?
I mean REALLY too complicated.
If you’re building a program to understand that this pug is a pug, and a kitten is a kitten, you don’t necessarily want to program an if statement for every single pixel here, plus every possibility of pixel configuration for every pug photo- I mean that’s not how our brains work is it? So how do you program it?
Well, you want to teach it a certain…
Puggliness. Your want your model to learn the essence of pug.
In truth, there are a few ways to do this. Sometimes, like the example above, we can tag a set of data and your model will use this supervised dataset to distinguish between these classes, this can help it learn better. This is called supervised machine learning.
But! Other times, we don’t know the answer! If I asked a computer what these pugs would look like if they were bred together with a stegasaurous…
…well, that’s not really a thing! There’s nothing it can check against, so we’ll use an unsupervised process.
Let’s dive into supervised because it’s the easiest to explain in the time we have and pretty common.
And in truth, even within Supervised Machine Learning, there are literally thousands of algorithms you could use. Among these, convolutional neural networks are probably most common… but genetic is probably the easiest to explain to give you the base concepts, so we’ll start there.
So let’s explore a simple toy model, in order to make a pug/kitten sorter, we first build a an algorithm that builds algorithms. It will build many of these, and they will set out to do their best sorting. At first, they are bad at it. Not just bad, but terrible.
But we’ve built another function to check this. It will take some tagged data and check if we have a pug, or a kitten for every given scenario. The ones that get it wrong, are thrown away. The ones that get it right, circle back to the builder, which builds more based on what was successful. Now, this might seem hacky and imperfect, and that’s because it is.
If we did this once, twice, or three times, it would fail. But we do this thousands of times.
And we don’t have a small amount of conditions, either- we build up all the gradients that make up an eye. Then we match this against other eyes. Then we match that against likelihoods of snouts.
In fact, our own classification system of animals (genus, kingdom, phylum), is a very small and human-comprehensible system composed of these types of rules.
But the part I want you to remember is this, as we talk further today. That point where we check? You can see how that’s a very important part of this. If we do have the ability to check if the data is right, we must do so and keep on checking.
Another very important part here is the data that it’s fed. If I only gave this these pug pictures it was trained on, I mean that would be correct! They are pugs! But it might fail a test in the future trying to find our true pug. The type of data we train on is really vital to the accuracy of the answer we’re seeking.
So let’s explore some of the ways we’ve failed with machine learning as a cautionary tale. I’m calling this section, “The Road to hell is paved with good intentions”
Because none of what I’m showing you now was created with the intent to disrupt society- quite the opposite! These are very well-meaning examples that failed. But their failure is good for us to explore because we can use that to learn from our mistakes.
So, let’s say you need to patrol a city for crime but don’t have enough units to cover the space completely. It might make sense to figure out where all the crime is happening, and just have some patrol units focus on the area of the most activity.
But the problem is, not all crime is equal. To get enough data to get an idea you have to include nuisance crimes (in which no one is hurt- like homelessness, or panhandling) with the violent crimes like rape and murder.
But rape and murder don’t tend to be clustered this way, it takes a lot more data to build an area, which is why the nuisance data is included. Another issue is that nuisance data tend be in poorer areas. Which leads to more policing, because then we have more data on the poorer areas as well. If a model gets into that feedback loop, it will start to be blind to the rape and murder that happens in more affluent areas.
This is what the software PredPol does, which we use in the United States, and it’s an example of bias sample in machine learning
And even our analysis of who ends up in this system uses machine learning.
When most defendants are booked in jail, they respond to a COMPAS questionnaire. This is fed into a system that evaluates a risk level for criminals and is used in the length of their sentencing.
An evaluation of more than 10,000 of the people who were analyzed by COMPAS over a two year period found that the risk scores showed a pretty startling difference. Black defendants would have scores fairly evenly matched across the board, 1 meaning no risk, and 10 meaning they should have a very long sentence.
Whereas the white risk assessments look quite different. Many were assessed at 1, steadily decreasing to very few at 10.
But what if that’s just valid data? You might ask.
Except, upon analysis, it’s not really. The study showed that blacks were twice as likely to be labeled a higher risk and not re-offend. While their white counterparts were labeled not as risky as they were.
There are more, too. The list really goes on.
These kind of algorithms don’t only effect black people. Zilly is a construction worker who stole a piece of equipment and sold it for parts because he was low on cash. Since then, he’s turned himself around, going to church events, volunteering. He mentions that his score does not reflect that any of these things he does to better himself as a person, and it therefore not a great measure of whether he’d commit a crime again.
The book Weapons of Math destruction covers some of these key tenants
Brennan, one of the co-creators of this technology, did not actually build the technology with the idea of using for sentencing. But that’s the strange thing about some of this tech- once it’s out in the world, the adoption can be a bit out of our hands. As anyone who maintains an open source project might acknowledge, once you put something out there, it can be used for a lot of things you might not have foreseen.
This is why it’s critical for these types of technologies to be transparent, in order to not be abused. They can not be magical.
This doesn’t only happen to criminals. Machine learning is now incorporated into a ton of tools we use every single day. Our data is mined and resold, and it’s used to give us information about how we see the very world around us.
Using a chrome extension called “What Facebook Thinks You Like”, I could find some of the ways that these systems had tagged me. This ranges from very true, and maybe obvious. To strange? And false? And some lols like Mermaid? Trench coats? There’s nothing wrong with any of these things, they just don’t describe me. It actually had my political affiliations wrong as well.
^
Another key problem with this, that you might have guessed, is you don’t tell facebook your race. They’re targeting based on ethnic affinity, which is decided by the same algorithm that thinks I’m into mermaids. Now, I’m not coming down on Facebook in particular, all companies and machine learning algorithms have the potential for these types of problems.
And the issue with this is that what you’re seeing- what you’re consuming on a day to day basis- is filtered. And that filtration system can be fallible at best and illegal at worst. It might not mean houses, it can also mean only seeing studies and educational material based on what you already believe. Which, like the patrolling system, becomes a self-reinforcing prophesy
I’ve also personally seen this. At one point I worked for a company that was first starting to work with machine learning. They proposed an idea to surface content based on different demographics data. I had just happened to read about the legality of this particular use case that weekend- namely that it wasn’t legal. I brought it up, and people in the room realized that yes- this would indeed foster bias. But I was just an ordinary engineer on this project. But without saying something, we might have shipped with negative consequences.
These tales are pretty dark, but machine learning offers us a ton of amazing benefits as well! As my brilliant coworker, Paige Bailey says- “It's like the risk we take every time we get into cars or airplanes - they've completely transformed every aspect of life, and made so many things possible that would have been impossible before. But they're inherently dangerous, and can be seriously misused”
Ok, now that I’ve seriously bummed everyone out, let’s explore some of the wonderful applications of machine learning and what we can do with it.
As I mentioned, I work for Microsoft, and in Azure we have a thing called cognitive services. There is a specific API called the Emotion API. What it allows us to do is analyze things like pictures and videos and see what emotions it detects from what the computer sees.
It can be used to do things like this, which I built with three.js
And might not have any other use case beyond entertaining my 4 year old stepdaughter. Which can also be pretty magical, to tell you the truth.
But what if we put this to… useful use? I was mentoring a blind woman, and she mentioned to me that it was difficult when she was left out of the conversation on twitter, or other types of social media, and even news sites, by people not including alt tags with photos
So I used another cognitive services offering, the computer vision API to create this, which will not only analyze the photo and it’s contents, but also the words in the photo. Just to show how some of this works, we’re going to briefly dive into some code.
If you haven’t worked with Vue before, this is how we’re calling that method on this component. You can see we have a change event that calls the fileUpload method…
We’ll get the image from the user, and store it
Then you can see here using Axios for a simple call to the Computer Vision API, we can ask Azure’s cognitive services to analyze the image. It’s really so great that we don’t have to implement much overhead as web developers to use this service and get detailed analysis!
We’re using Azure cognitive services to analyze the image in two different ways one to see what the image contains, and one check for text within the image, and we’ll dynamically add the alt text to the image. I’m only showing one here for clarity but this demo is open source if you’d like to explore the code.
And now that this is built, I’m creating a chrome extension so that blind people can use it on any site they visit at any time.
This application of machine learning can help us bring more people into the conversation, and broaden our reach.
It's not perfect, but it's heading in a really good direction, where all of the sudden people who are left out of the story can now be part of it. That’s the amazing thing. That by being inclusive, you’re actually meeting business goals- it doesn’t mean excluding the people in the center, it means reaching a larger audience.
Now you see how Azure cognitive services can be used through a simple API call, but what if we want to dive into that abstraction just a bit? We can use LUIS, which is a machine learning-based service to build natural language through the use of custom models that can continuously improve. We can use this for apps, bots, and even IoT devices. In order to dive in, I’m going to show you a demo I made, but first, I need to give you a bit of context into why I think this is so important.
Many years ago, I worked as both a web developer and scientific illustrator for the Field Museum of Natural History in Chicago. I was getting on a bus, and the driver didn’t see me. He closed the door on my hand, and started to go, and only stopped when the people on the bus started yelling. I heard a pop in my wrist. I had torn a tendon in my right wrist, the wrist I used for drawing and my dominant hand in development.
I didn’t take the time off that I needed because I was a consultant at the time. I worked through the pain. I could talk about how difficult it was to make web applications at that time but perhaps it makes more sense to show you some of the art I was making at the time.
At first I found I couldn’t do the same kind of drawings anymore. These tight ballpoint pen drawings are tiny little pen strokes that build up a shade or gradient. They’re like cross hatching gone wild.
And then I had to do the hardest thing I’ve ever had to do.
I had to slow down.
You see, rest seems simple, it seems easy. But painful, imposed rest for months at a time is actually incredibly difficult. Doctors know this. So they have found a way to teach patients what they are doing to their own bodies to educate them in how to heal themselves. This process is called biofeedback.
The process of biofeedback is basically that you get hooked up to a machine, …
So, how can we apply this to cognitive services and the things we understand as web developers. My coworker Brian Holt and I worked on a project that connects a vue application LUIS, so that people can guide their own visualization based on how they’re feeling
We don’t have time to run through every piece of the application, so I’m giving you a bird’s eye view of what it looks like. We…
There are all sorts of other ways we can help people with machine learning! A few such examples in medicine include, but are not limited to:
Now I want to spend a second on that last one. 9 days is an incredible amount of lead time on an outbreak. Outbreaks grow exponentially, so by using machine learning in this case we adjusted the amount of people infected from here, to here. That’s amazing!
So, you might be saying to yourself, all of this is well and good, but I’m not a data scientist and I don’t work with machine learning. That’s ok! This subject- how technology shapes our lives- is very broad! It doesn’t necessarily need to be machine learning, let’s talk about some of the things we as web developers can do now, today, with that we already know!
We work every day on building applications for so many different use cases. What if we thought about some of the more generic tools we have and how they can be put to tasks that can help potentially save lives?
There’s a firehouse near where I live, and they have some sufficiently complex systems to help make sure that everything is online and functioning. I went out to their station to learn about how everything works and see if there was anything I could build that might help. Here’s what I learned:
When the fire truck goes out, it has to communicate with a dispatcher, which will help facilitate if they need more water, supplies, or backup.
The app is very simple, purposefully so- because they want everyone to be able to use it, quickly, at a glance, and there aren’t that many things they might need. For their use case, what they created is perfect.
But I asked a few questions, including, what happens if they're all sudden offline? What if they can't communicate?
Right now, currently, it fails. They’re just hosed. Get it? Hosed.
So, here’s our opportunity. What I did was create a really simplified version of their app, preserving the basic layout. But I made use of service workers and backgroundSync to…
Here’s what the application looks like.
We’ll register the service worker when a request is made. The service worker isn’t just a normal function. It has to be in a different javascript file, this detail is really important if you’re going to integrate them into an app.
We’re also going to pass in the type of event that was triggered, so we can submit, or queue, what the user requested.
Not shown here, we’ll also do some error handling for if it fails or the browser doesn’t support this feature.
After we’ve activated and installed the service worker, we’ll strip out the type from the event tag and pass it into a function that will process a fetch request whenever it gets connectivity
In that function, we’ll fetch our URL (a placeholder server in this case), and we’ll check if the response has happened, once it has, we’ll send a message back to the client with postMessage- we’ll send the response and the type of resource that was requested
Then we can alert the user when the request was finally sent
But the most important part of this demo is not the service workers, it’s where we started. We started by asking questions. I went to the firehouse, and asked questions, and listened. There were many times where I didn’t know if I would really have anything to offer. But by asking what happened in any given situation, we eventually arrived at a failure scenario that they could use the help for. WE HAVE TO ASK QUESTIONS. We have to ask questions at the beginning, like the firehouse application, and we also have to ask questions once it’s deployed, like the criminal scores. We have to keep evaluating where these systems are going, to make purposeful decisions to help people, and to course correct when they don’t.
I see a lot of tech that asks questions about how we can make our lives more comfortable. Which I appreciate! Heck I even make applications on the weekends for fun, like this cocktail finder.
But it seems to me I see a disproportionate amount of projects that focus inwards rather than outwards. Focused on serving people with money than asking what people might need real help. There are a lot of opportunities out there to help, and you might already have the training to make them. It takes a little imagination and exploration, but it can really pay off.
So, what I want you to think about going forward is this, that I truly believe that you’re some of the brightest minds of our generation. As you build these applications for the web, you are also building pillars and blocks that society rests on. You are crafting the shape of our digital lives. This could mean building new features, this could mean advocating for accessibility, and this could be as simple as raising your hand when you think something isn’t right. It's not just your job to create these projects and do as you're told, it's also your job to ask, are we building things correctly? Are we building the right things? And are we building them well for all the digital lives that we touch.