So my name is Rich Rang. I am a director of data science at Sophos. This is a joint presentation between myself and Dr. Ethan Rudd, who's sitting in the back there. And I'm going to talk to you a little bit about facial recognition systems. So who am I and why am I qualified to stand up here and berate you about this topic? I have a PhD in statistics from the University of California at Santa Barbara. And I've spent about the past eight years working at the intersection of machine learning, security, and privacy. Ethan has his PhD in computer science from the University of Colorado. And he has a long list of accomplishments, particularly in the facial recognition field. This is the Sophos data science team. If you like security and you like data science, then maybe you should come talk to me after this. We're always looking for people. So let's end up the pitch. So this talk, this is sort of the outline. We're going to go on a real crash course for image classification. We're going to talk about specifically how the facial recognition problem differs from the standard image classification problem and how that leads into differences in training and processing images. A brief note about how bad the situation really is as far as facial recognition and privacy. We're going to do an absolute sprint through some of the attacks that you can launch against facial recognition systems. And then I'm going to do sort of an anecdotal look at transferability of those attacks. So if you train an attack on one system and you deploy it against another system, what actually happens? Spoiler, the results are not great. So I'm supposed to tell you three things that you should remember so that when you nod off and start thinking about lunch in about 10 minutes, you have some takeaways. If you remember nothing else, facial recognition systems are different from general image classifiers. They're solving different kinds of problems. This means the pipeline is different. The models are structured differently. And you have different opportunities for attacks, but some existing attacks that work really well against images. Image classifier systems are not as feasible. Building facial recognition systems is really easy. There are off-the-shelf open source systems you can grab that are really quite good. Cloud-based solutions like Amazon has one. They are extremely cheap and very easy to use. Reliable evasion of facial recognition, particularly in the wild, is still really difficult. We don't have any good solutions to it. And a mask is the best solution that I've been able to come up with, unfortunately. So crash course and image classification. This is assuming a little bit of background, but hopefully not too much.   So hundreds of pictures of airplanes, hundreds of pictures of dogs, frogs, and horses. And you use it to train a classifier. The basic building block is something called a convolution. It's a patch that you stride over an image. And it learns to pick out different things like edges, corners, curves, and points.  And then you typically put a standard sort of classification network at the very end. The very last layer is usually something called a softmax layer. And that basically just assigns a probability to each class. So if I put in an image of a car and it's well trained, it might come out the other end and say, I am 99.9% certain that this is, in fact, an image of a car. How do you train it? I am going to gloriously skip over a lot of the details because they don't actually matter with modern deep learning frameworks. Basically, you randomly sample the data. You get some image. You feed it through this randomly initialized network. And you get a classification out. When you start, that classification is going to be absolutely terrible. It's not going to have any idea about anything. And so it's going to quite happily tell you that a picture of a car is equally likely to be a car, a horse, a dog, a bird, et cetera. That's fine because what you do is you take that mistake and you basically tell it how to fix that mistake. You error correct all of the weights. This error correction usually takes the form of something called back propagation. And you just do this until it works. So this is the very 50,000 foot overview of this problem. Great. So now we're going to go ahead and we're just going to go do it for faces, right? Easy peasy. Except there is one small catch to this. Actually, there's several small catches, but this is the first of many catches that will trip us up along the way. So we really only care about faces, right? So what I've got here is I've got, from a facial recognition standpoint, I've got some stuff that's interesting for a certain narrowly construed definition of interesting at least. And then I've got a bunch of stuff that's not interesting. I don't really care about the context in most cases. All I want is the face. So step zero, we do something called a bounding box, a landmark and alignment.  We identify key landmarks. This is, in many cases, going to be the center of each eye, the tip of the nose, the corners of the mouth. And those landmarks serve as reference points to a second stage, which is going to tweak the image a little bit so that it's in a standard orientation. Think of it as sort of setting up an ID photo style tab or an ID photo style photo or Christ, an ID photo style tile for each image. So everything's nice and vertical and it's aligned and you don't have any like Boston Terrier head tilts going on. There's plenty of tools to do this. They're all really well-trained. You can, again, dig them up online.  I also should note that alignment is actually not needed for all models. There are a lot of models that are trained to handle multiple alignments. Okay, so now we can get faces out. That's great. Now we're gonna do it for faces, right? We actually have a problem and circled in red is the problem right here. We have built into most of these basic image classification models two assumptions that do not hold in facial recognition. So we've got a fixed number of classes that we know about ahead of time and we have what you call a closed world. So no matter what input you feed to this model, it's always gonna tell you that it's one of those outputs. So if I train this recognition system on image tiles right with say 10 people, I can show it a thousand different people that it's never seen during training and the model will still try to assign some probability to just the 10 faces it was trained on. This is obviously not ideal because if we presented a face that's not in the training set, we vastly increase the likelihood of a false positive. If we only care about identifying say two or three people and we only have four or five images of each of those two or three people, we have nowhere near enough training data to actually train a classifier, right? These image based classifiers take tens or hundreds of thousands of samples to really learn an effective representation. So we could maybe fix that by saying, hey, let's throw thousands of people in there because I've got tons of faces. Thank you, Facebook. But then we end up with a bunch of classes that we don't care about and we end up with maybe some gradient issues. Down the road, if we've got our 10 people that we train the model to identify and then we add another 10 people that we wanna find later, suddenly we have to retrain the model, which can be really, really time consuming and expensive depending on how you do the retraining. Okay, so that's not gonna work. So what can we do to fix it? The first idea for dealing with a large or an unknown number of classes is something called a matching network. So you feed instead of one face, you feed two faces into it and the model's only job is to say, are these two faces the same person? So this is great because now suddenly I can feed all the faces I have into it, right? I've got 10 faces of this person so I feed it whatever the 90 different combinations of pairs of faces and I say, make sure you classify these as the same person, take all of the different faces and say, make sure you classify these as different people. And then when I want to actually detect certain people, I get the face tiles of the people I want to identify. I take the face tiles of the people I'm trying to match up to it and then I just run it through and I say, hey, are these people the same or different? So I've essentially separated the data required for training the model from the data required to do the recognition step. So good news, bad news. The good news is, again, it's super easy to register new faces to add them to the list of faces that we want to detect down the road. You just get the photo and you stick it in a database somewhere so that you can run it through the model later. The bad news is this means you would have to run this model against every single face in your registered database. For deep learning models, this can be apocalyptically expensive to do if you're trying to identify a thousand different people. That's a thousand samples you've got to run through for every face you're trying to identify. This will not scale. It works great on toy problems. You definitely don't want to do it beyond that point. Okay, so now we're going to do a second fix. And the second fix is we're going to run the network just once over each face and we're going to learn what's called an embedding. So an embedding is basically just a way of taking a face tile and turning it into a list of numbers. The list of numbers you can think of as defining a point in a really high dimensional space. The way you're going to train the network is to take two faces from the same person and tell the network you should make similar embeddings for these two people, right? These two faces should have these lists of numbers that under some distance metric are very close to each other. If I give it two faces from different people, it should separate them by a lot. It should be able to say the distance between those two vectors should be very dissimilar. So visually you might end up with something like this, right? So this is a sort of a made up two dimensional embedding. I have a query face that I have circled in red there. And basically I've got clusters, I've got distances. This face is closest to that cluster. So I say that that face probably belongs to that person. If you can imagine if I had another face that was way off in the middle of nowhere, maybe I would say that's too far from any cluster to actually be classified as my face of interest. So when you have an embedding and a distance, the good news is at that point you can put aside the deep learning sledgehammer and you can just use existing deterministic algorithms for fast nearest neighbor detection. So you get your embedding, you find nearest neighbors and you're done, you've got your match. So there's an important difference on data here. And this is a subtlety that I think needs to be appreciated. You don't actually need to know who a person is to train on their face or enroll them. You just need to be able to say, I've got 10 people, 10 photos of one person and I've got another 10 photos of another person. They're distinct photos. I don't have to know who they are, right? It's not like an image classifier where I have to be able to say, this is definitely a photo of a cat and this is definitely a photo of a dog. You just say, I've got 10 photos of this one person subject A and I've got 10 photos of this other person subject B and so on. Doing this, collecting this data is super easy. I invite you all to consider all of the photos you have uploaded to Facebook or Twitter or Instagram or TikTok or yes, FaceApp. If you've done that, there are ways to essentially sort of say, yeah, these are probably the same people. You can enroll all that in your training data and you're done. You can put together a janky homebrew if you like. People like to carry around phones with their wifi turned on and you can scrape their Mac address, right? And say, hey, I've got this photo that correlates to this Mac address. That's probably the same person. So collecting the data is actually super, super easy especially if you are social media. So we got a couple of different kind of operational scenarios or modes of operation for this. In the training, we have the gallery. So the gallery is gonna be the people that I actually want to recognize. These are the people that I wanna be able to tag. Then I've got the training data which can be a whole bunch of other people where I don't necessarily wanna identify them later. I'm just gonna use them to train these models. And then in probes, I've got subjects. So the people I'm going to try to match to the gallery, I've got known faces. Known faces are ones that the model has been trained on but may not be people that I actually care about identifying later. And then I have unknown faces. So faces that have never been seen during training and they're not of people that are in the gallery. This is an important point that I'm not gonna have a huge amount of time to go into detail. But knowing, having a training set that's representative of the population you want to be able to identify is actually really important. If you have a bias in your training data like in most facial recognition systems that are out there today and it's biased towards a particular ethnicity, towards gender, towards a particular age group, it's not gonna work very well for people outside of that ethnicity, gender or age demographic. So having a good representative training set is actually really important to make these systems work well. So this actually, this plot or figure comes from Ethan's paper which is giving it the link down there. Okay, so recap. Facial, we've got two models that go into this. We've got the facial detection model which is what's gonna draw the box and give you the attribute markers. And then you've got the face embedding model which is what's gonna take that face tile and turn it into your embedding vector. The important thing is this is done separately from actually enrolling the faces that you want to identify later. So you've separated the training data out from your actual life detection data. Faces you want to detect don't actually have to be available when training the models, right? I can train a model on photos of people who were born years before anyone I want to identify popped up. Then when you find people that you want to identify, you enroll them by generating the embedding and then you're back to the nearest neighbor search. Okay, so the short version. You find crop possibly aligned faces with a localization model. You take those crops, feed them through an embedding model if you're registering them. So I've got someone that I want to find later. I'm gonna save that vector along with the label of their name. Sometimes I'll form templates if I want to sort of shrink that set again. So that might be something like finding a convex hole that contains all of the faces or finding a median of all of the embedding vectors. Then recognition is you're just gonna find the nearest embedding or the nearest template to the unlabeled embedding that you're trying to say, hey, who is this person that I've got a photo of and is that somebody that I want to recognize? Okay, a brief digression. Welcome to how I love this GIF. This is I'm a sucker for dog GIFs. Future is already here. It's just not evenly distributed. It actually is pretty evenly distributed because if you want to build facial recognition models, there are plenty of models that are available online. I'll be putting these slides up later so don't like rush to get a photo of the URLs. Don't worry about it. Pre-trained models and model training code is widely available online. Data is also widely available. People are starting to get a little bit twitchier about this. Microsoft recently pulled down its Celeb A data, but you still have things like labeled faces in the wild, the Kaiser Webface data, and then facerec.org slash data sets hopefully provides you with just about any data set you might want. Some of these you will actually have to write to the academics that did the work, but usually they'll be quite happy to just send it off to you. If you're too lazy to do that, even then Amazon's recognition works really well. There was a Washington Post article that said that a county in Washington state was actually running its entire facial recognition system off of Amazon's recognition for about seven bucks a month. So it's fast, it's cheap, and it works reasonably well. Okay, so now that we're all depressed about how widespread this is, let's talk about how we can evade it, right?  So the first thing to keep in mind is when you look at the academic literature, a lot of papers that say, hey, we're attacking facial detection models are actually attacking sort of this softmax type model that's closer to an image detection model. So if you're gonna go out and reproduce some academic research, probably do a quick sanity check, look through the model, make sure that they're using something that's closer to facial recognition as it gets deployed in the wild. So plan your attack, right? Think about your capabilities. Can you attack the model training? Probably not, but if you can, data poisoning is a great thing to think about here. If you can get a copy of the model somehow, right? Let me stick it on an open share or an unprotected S3 bucket. Grab it and do an offline attack, right? You can do white box attacks on that. If they offer you an API or an endpoint that you can query, right? You can send lots of queries to it and you can do what's called a black box or an online attack. Different in facial recognition, enrollment is sort of like a second mini training step. If you can enroll new faces, you can think about possibly I could poison it, right? I enroll new embeddings with the wrong label and that'll confuse it when they go to do this nearest neighbor search. You can use something like this person does not exist general adversarial networks and possibly just do a resource exhaustion attack, right?  Again, there is a nearest neighbor search in this and even with computational tricks to speed up nearest neighbor search that is still a somewhat expensive process. So potentially if you can actually modify the enrollment step, you could bog it down at that point. If you can alter data in flight between the localization model and the embedding model, you could actually do a face-only attack, right? Just modify only the face chip and do some sort of attack on that that will cause it to misidentify. If you can read the data in between the two models, you can try and attack the detection stage, the bounding box.  So this is pretty straightforward. I am already behind where I wanted to be so I'm not gonna talk about it. This is on easy mode. I will talk a little bit about this. This is surprisingly hard except the field is moving fast, life comes at you fast. Yesterday at the talk there was a presentation from someone who actually did this. They broke this. So the reference is there. Again, I'll post these slides online later. They have actually broken the bounding box and detection attack. Pretty, it's a nice hack. You should definitely check out this paper if you're interested in that. And then finally, there's the black box attack. This is perhaps unsurprisingly a pretty, pretty tricky to do. Realistically, you're not gonna know, right? You don't know if your photo's being taken and analyzed. You don't have any detail about how that system actually works. And even if you try to dodge it or evade it, you're not gonna be able to get feedback, right? I suppose you could go down to the casino floor and ask them really nicely if they recognized you when you had the funny glasses on. I wouldn't put good odds on them actually letting you get away with that. So, white box attack. Really high level outline. These are usually done with what's called gradient based methods for these deep learning models. There is the fast gradient sign method. I believe that's good fellows. There's saliency. I believe that's paper nose. Links are both there. The idea is basically you're using gradients produced by the model to find the most sensitive input features. So, individual pixels within the face tile. And then you're gonna figure out how I can modify those pixels in a way that it will drive the model towards a poor classification. So, I did a really lazy implementation of this. I basically just treated the perturbation as a PyTorch variable. I made up an L1, L2 penalty. I sort of set a prediction gap. So, I said evade it by this much, but no more so that it doesn't go off and find the most bizarre facial deformation it can do. And then I just backprop to my way to glory. So, use your built in optimization toolkit using a built in optimizer within PyTorch. So, if you do a gradient based white box attack on only the face chip, you end up with these results. So, walking you through this, it's kind of busy. In the upper left is the perturbed version and the original version of my face. So, if you stare at it, if you look at it really closely, you can see some minor differences between the two. But if I only showed you the one on the left, the perturbed one, you'd probably say, yeah, that's actually a pretty clear, pretty clean photo of your face. Below it, the three panels below it are the red, blue, and green channels showing what the white box attack actually modified, which pixels and which channels. And then on the right hand half, the test image is the one that is sort of, hey, can we identify this person? And then the next three photos left to right, top to bottom are the images in the registration set and the scores. So, in this case, it said, yeah, I definitely look like Alvaro Nubola. I've got a sort of a similarity score of 0.65. The second highest similarity score was to my own face with glasses instead of without glasses and a similarity score of 0.45, right? So basically the short version of this is the white box attack worked. I was able to modify that specific image, those specific pixels to actually give me an effective evasion. So, outline of a black box attack. You can try proxy models. This essentially means you feed a whole bunch of data to the model that you're trying to attack. You get the outputs from that and you train a model to reproduce it. For a reason that I'll talk about in a few minutes, I'm skeptical that these will work terribly well against facial recognition systems, but if somebody knows differently, I welcome your input on that front. So, in a lot of cases, we might not know which data we need to train which proxy model, right? We've got two models in that pipeline that we're trying to match up and it might not be obvious how to do it. So, black box optimization. I just use a genetic algorithm because everyone loves a good genetic algorithm. I treated the perturbation as an umpy array and then I GA'd my way to glory, right? So, if you're interested and you care about it, I use the mu plus one where basically I just permute a single and make a new population member each time, score it and it kicks out the worst one if it beats the worst member of the population. So, again, same results, same ring of things. The main difference here is you can see the perturbation is in fact a little bit noisier. It still looks pretty good, right? But it's not perfect and you can see the channel differences down beneath have been impacted much more severely. These are all on the same scale as the previous image. But again, it actually has successfully managed to evade it. So, against the face chips, only white box and black box attacks are pretty direct, pretty straightforward to do. If you do a genetic algorithm, the results are definitely much more of a mixed bag. So, this is end to end and instead of doing just the face chip and running it just through the embedding, I take the full photo, I run it through the entire system and I look at the difference. And in this case, you can see that my implementation, at least I don't claim that it's necessarily the greatest one out there. It actually does introduce a lot of noise. So, it is recognizable, right? The photo on the left is still recognizably me, but it definitely clearly has been tampered with in some form. But again, it does successfully evade. So, points to consider if you are launching these kinds of attacks, white box is the gold standard. This is the easiest way to do it. If you can do a white box attack, you should definitely do that. Black box attacks also work, but you're gonna be hammering that model API and eventually someone's gonna be like, hey, this dude has uploaded over a thousand almost identical images to my API and keeps getting like different results out of them. What the hell's going on, right? So, it's not exactly subtle. So, what about transferability? This gets back to the proxy model attacks, right? So, if I train a model on one system and I learned to evade one system, does it actually work on a different one? So, I'm using this paper, accessorized to a crime. I do not mean to pick on them. They did a very good job, wrote an excellent paper on using real world adversarial evasions against the VGG face model. Because they did such a good job and they provided such good information about how the model and attack was constructed, it made it easier for me to look at transferability. So, this paper is excellent. If it seems like I'm being critical of it, I'm not. I'm doing something that they did not consider in their paper. But basically, what they've got here is they've got these fancy little glasses frames and you can see that basically the model does not identify the correct person and I've identified the gentleman on the top row as being Carson Daly and the woman in the bottom row as being Russell Crowe on the basis of these funky glasses frames. Okay, so you know who would win.  And basically, this is, again, not that what their paper did is bad or doesn't work, but that transferability is a real headache with these kinds of evasions in these models. Basically, the short version is no. So I've got six panels on the left, six panels on the right. The upper left panel is the perturbed panel. So that's what the evasion put on it. The panel below is the target who this evasion was supposed to be attacking. And then I've got the top four face chips from a registered training set that I made up. This is me using MTCNN and Sphereface, which was a couple of slides back to actually do this evasion. So what they did worked really great on the VGG face model. What I, you know, yellowed together from pre-trained models on GitHub it actually did not successfully evade. If you throw it into Amazon's recognition demo, take the same photos. Again, it does not give you a successful evasion. Finally, I got the glasses. The goggles, they do nothing. I got the glasses and I printed them out myself and I tried them and it actually worked, right? On my kind of bad pre-trained model. So it reclassified me as the gentleman in the upper right of the four-plot image with a very slight edge over the target image. But again, I put it up through Amazon's recognition demo and it did essentially nothing. Okay, so wrap up. I'm a little over time. I apologize. I do know that I'm standing between you and lunch. Facial recognition is not normal image classification. Facial classification and recognition tools are out there. They're publicly available. You have pre-trained models available on GitHub. These differences make a lot of these attacks harder, but there are also new potential attack surfaces. So again, gradient-based attacks are your gold standard. They're gonna be pretty hard to deploy in practice. Exhaustion attacks are something I don't think I've seen anyone contemplate before, but again, if you know of research on that front, please let me know. I'd love to hear about it. And if you can tamper directly with embeddings, so screw around with the registration step, this is probably your best bet on an attack surface, right? Map the wrong embedding to the wrong label and have it identify the incorrect person. So finally, if you wanna take a screen, this you might actually wanna take a screenshot of if you don't wanna wait for me to put the slides up. I have a ready to rock pre-trained system. This is MTCNN and Sphereface. It is available on Google Colab. There is a preview tiny URL that you can look there so you can see that I am indeed sending you to Google Colab and not somewhere else. The QR code should send you to the same place. This should work if someone wanted to try it like during lunch and come back and yell to me if the permissions on the notebook are not set right, please do so. That would be awesome. I've tried it myself, it seems to work.  You open the link, you do file, open in playground mode, then it'll tell you that it won't save any changes unless you save a copy to your own account. It will take up a few megabytes in your Google Drive account. So if you're up against the wall on space, maybe don't do that. Anyway, I am contractually obligated to make you stare at the slide for exactly three seconds and I will now be happy to take any questions. In the back. I have seen, so the question was there is some work that uses IR light to essentially do real-world, real-time adversarial perturbations on faces to try to mess up recognition. I know there's a lot of proof of concepts. I think Naomi Wu actually did one.  That was awesome. So there is work in that vein that's been done. I did not look at it specifically for this because I was focusing, trying to focus on stuff that was a little lighter lift. Please. I'm sorry? What about the juggalos? Yes, so one of the things that these models do tend to look at is sort of like light and dark patches and reflections. So yeah, juggalo makeup does indeed evade a lot of facial recognition systems. I am not part of that culture so I don't really know what makes a good juggalo face so I didn't want to sort of step on anyone's toes. But yeah, look up juggalos and facial recognition. You'll find some good articles. I'm completely serious. It's exactly the kinds of perturbations that will screw up a good facial recognition system. So it's worth checking out if you're into this stuff. Do you have the Amazon recognition system? I literally have no idea what they have trained on. I wish I did, but I don't. I'm sure Amazon has access to a substantial corpus of high-quality, relatively unbiased training data though. Yeah, it would shock me if they didn't. You mentioned you used a genetic algorithm to make a proxy attack. Mm-hmm. So what is that genetic algorithm? Oh yeah, so super high level. The question was what does a genetic algorithm mean? So a genetic algorithm is sort of a bio-inspired type of thing. The idea is basically you have a population of solutions and then you generate a new solution by combining elements from a couple of high-performing solutions, maybe making a couple of random tweaks and rescoring it to see if it actually improves on anything.  The Wikipedia page is actually really good on it. It's got a good description of how they work and a couple, so it does, I think, have a section on the mu plus one approach that I used, which is nice because the mu plus one approach actually lets you put really tight controls over your query budget. Mm-hmm, yes. That, so the question is can you detect whether or not a general adversarial network face is a general adversarial network face or a real live human face? The answer to that is yes, probably. I know that there's been a lot of work on detecting that sort of stuff. It's not something that's really in scope for this facial recognition thing. One thing that is promising is using those generative models to try and poison your training data or perhaps that's the resource exhaustion attack I was mentioning before.  The countermeasure to perturbation attacks is use an unpredictable model at this point. Yeah, no, it's an excellent question. Like being able to think of this defensively in terms of what if people are using facial recognition as like a backstop biometric, for instance, and then perturbation attacks are essentially like a way to evade this biometric identification. Again, I know that there is academic work that's going on in this area. I am less familiar with it, so I don't wanna give you an answer because I'm probably gonna get it wrong. But yeah, people have actually looked at ways to make image classification models more robust to adversarial perturbations. You can probably transfer a lot of that to this setting, but I don't know offhand of work that specifically addressed that. So I don't think we have any talks in here, so I'm happy to stay in chat if people want to, but we are definitely over time, and if y'all wanna grab some lunch, go for it. Thanks again.


My first RubyConf was RubyConf in San Francisco in 2009, and the closing talk of that conference was this monstrosity by Aaron Patterson and Ryan Davis. And if you haven't seen this talk, you should really go find it on Confreaks. It is a great way to spend half an hour, 45 minutes, because in this talk, Ryan and Aaron cover all of the crazy ideas that they came up with while riding the bus home from the Ruby class they were teaching in downtown Seattle. The fail bus, yeah, we re-banded that bus, the fail bus. And they share a whole bunch of perfectly reasonable code for perfectly unreasonable problems. And back in 2009, I was working at a startup, and my code was running on something that looked approximately like this. And now my code runs in some place that looks like this. So I was trying to figure out what talk to propose for this conference, and I thought I was sitting on the bus, fail bus, and I'm like, I should totally do another version of this talk. So I'm Masu Hamreley. The code for this talk is on GitHub. I'm Thagamizer and it's in the Stupid Ideas repo. I tweet at ThagamizerRB and my phone is over there so you can totally tweet at me during the talk because I love it when people do that and you won't distract me. And I blog at Thagamizer.com and that used to be, I blog very rarely at Thagamizer.com but now I'm paid to blog at Thagamizer.com so I blog there more often. I work for Google Cloud Platform. I'm a developer advocate and we do let you run Ruby on our cloud, oddly enough. So cloud.google.com slash Ruby. I'm gonna be running Office Hours tomorrow during the afternoon break down on level two. And if you have questions about running your code on Google Cloud or you just wanna know about Google Cloud, you can come talk to me. And because I work at a large company, unless otherwise stated, all code in this talk is copyright Google and licensed Apache V2 because lawyers. So now that all that's out of the way, time to get on with the Stupid. First idea, load testing. So the code in this section predates my time at Google and it predates my time coming to Ruby Conferences because it's really old. But that means that it's my copyright and it's licensed MIT.  I started my career in QA. And as part of QA at a small company and my boss would come and say, hey, can you load test this new feature? And I would say, okay, great. What parameters are you looking for? What's the ideal load you want this to have? What kind of specs should I run it against? And they're like, load test it. Just do the load testing thing.  So I had a Rails log of the scenario I wanted to run and that was from my local server. And I hadn't mechanized. And it turns out with those two pieces and not a lot of forethought, you can make a perfectly reasonable load testing framework. So why mechanize? Because it let me write out a script of code that was then going to run and I could inject user IDs or association IDs into that script so I wasn't rerunning the exact same scenario from my log over and over again.  So the big challenge of load testing is to make a whole bunch of computers do the same thing at the same time pointed at the same server. And if you can do that, you have load testing.  So what's the code look like for this? Well, let's be clear, it's not good. In fact, this is some of the oldest Ruby code that I've written that I haven't deleted yet. And by it not being good, I really mean that. I knew I had this code sitting around when I proposed the talk and I went to go pull it up to put it on the slides and this was the first line that I saw. So yeah, really truly the first line about files so here's the code, I'm probably not gonna be able to see it, it's okay. There's not much here. That's just some preamble to get the mechanized agent started up. That's me looping through the log file and matching against that horrible regex and all that horrible regex does is pull out the action, the controllers and the parameters from the Rails log. And then that right there is running out, writing out the code that will make mechanized do a post to the server based on what the action and the controller were. It happened to be that the project I was doing this for only had two primary actions for our entire application like 99% of our traffic went through those two so I just switched. There's a case statement there I think or an if. But it's pretty flexible. You have the action, you have the controller, you have the parameters so you could totally throw that stuff in for whatever your Rails app is. So that's great. Now I can programmatically run the website but that's still not load. How do you turn that into load? Well, parallelism.  Turns out very long time is actually pretty easy. You just put that around your script. So I've used this technique more times than I really want to admit such as the life of a QA engineer. You have a tool, you have a problem to solve and you're always gonna be running on the last minute. This works great. I'm guessing that some of you booked your travel here on our website that I use this technique to test. So the second part is how do I get a bunch of different computers running? Well, I used Bash. I wrote a Bash script that started up 30 versions of this script on a single computer and the first time I did this, I did it with commodity hardware that we had purchased on eBay.  But I didn't. And the second and third time we ran this technique, we used the cloud and the biggest disadvantage of using the cloud to do this is no toasty cheese sandwiches. So how do you deploy that? Well, I normally call this section deployment but really it was just low-scale hackery. And so basically what I did is I made a VM on a cloud provider. I got all my dependencies on there, got Ruby on there, put my code on there and then I hit the make more like this button a bunch of times. And then to start it up, I had to SSH into each of the servers to start the script up. And turns out when you do that, you can't do it all at once and so it takes a little while for you to get your whole load test suite running at full capacity.   First of all, you get no statistics or analysis. When we ran this, we had no idea of any of the agents we're timing out. We had no idea what our maximum capacity was beyond what we could get from the server logs. We didn't know kind of errors we were getting. Also, there are off-the-shelf tools to do this that I did not know about at the time. There are many of them. Apache Bench is a great example. So please don't ever do this unless it's for fun.   So I adored my boss and he and I were sitting over coffee one day at our office and he's like, I have this great idea for an interview question. Can we do sentiment analysis of Twitter using emoji? And I started proposing this talk. I'm like, hey, can I steal your interview question for my talk? He's like, sure. So I wanna thank my boss for letting me steal his question. And I also wanna say that if you were ever asked this question by my boss, the solution I'm about to present is not the right one. You will fail the interview with this. So if you're not familiar, sentiment analysis is the process of looking at a big pile of text and deciding if the general feeling of the text is generally positive, generally negative, or neutral. And it turns out it's really hard because we're human and we are not precise with language. For example, this sentence. If I said this sentence to you with a smile on my face, sure, I'd love to. It would be a positive sentiment. If your teenage son says it while rolling his eyes, it's probably not so positive. So it's hard to tell what the sentiment of this is. But we're not actually dealing with words, we're dealing with emoji. So we can probably divide these five emoji up into positive and negative. Maybe something like this, the heart, the thumbs up, the smiley face are positive, the pile of poo emoji, and the corns guy. I think the name is the imp, are negative. And yes, I did partly propose this because I wanted to be able to put the poop emoji on my slides for a good reason for once. But you know, if you think about it, maybe the heart is more positive than the thumbs up. So you can also do something like this. Put the emoji on a continuum and assign them points. And now I need a corpus of text to do my sentiment analysis against. So I'm gonna use tweets. And here's the code. First thing, I'm using the tweet stream gem because this allows me to do live streaming against Twitter. Here's my signing of points to a bunch of different emoji, just throwing it straight in a hash. This looks a lot better on this slide than it does in Emacs because I can't actually see the emoji in Emacs. And then here's the code that analyzes a single tweet to figure out a numeric sentiment for it. I'm just going through that hash of sentiments. If a tweet includes a given emoji or an un-given emoticon, I increment a sentiment integer by the appropriate number of points. Pretty simple. But that's only good for one tweet. If I want to do a whole bunch of tweets, like the tweets that are coming out about RubyConf today, I need a lot of computers. And that's where Rinda comes in. Rinda is an implementation of the Linda distributed coordination language. It's part of standard lib, so I didn't even need a gem for this. This was awesome because it made it much easier to deploy it. And Linda uses a shared tuple space to allow multiple processes, potentially multiple computers to communicate. And if none of those words made sense, I have a picture. So the tuple space is that cloudy thing. And a tuple, as far as Rubyists are concerned, is just an array because we're not Pythonistas. And then we have a bunch of workers and they can write things into the tuple space or read things out of the tuple space. So the server for Rinda is actually really super simple. That's all you need right there, four lines, and you have a tuple server that you can connect to. And I've made this slightly more complicated than it needs to be because I'm passing in the server, the URI as a command line per room. And to do this tweet analysis, I'm going to have three different types of workers and I'm going to walk you through basically how this works. So the fetcher brings in a tweet. It writes it into a tuple that has the tweet symbol as the first element of the array and then the text of the tweet is the second. And then it pushes that to the tuple space. The analyzer pulls the tweet out of the tuple space, calculates the sentiment and creates a sentiment tuple with sentiment as the symbol and an integer as the second entry in the array and writes that to the tuple space. And then finally the reducer reads all of the sentiment tuples and comes up with a total sentiment for the entire space. If you're familiar with MapReducePatterns, this probably looks very similar, it's a MapReducePattern. So here's the code, here's the fetcher, that's the kind of tuple it's going to write. And that's basically all the code you need to do this. I'm just writing to my tuple space after I create it with Rinda, the text of the tweet. Here's the analyzer or the mapper. Slightly more code here because I have to pull something from the tuple space. That's that first line with the arrow. I'm doing tuplespace.take, anything that starts with the symbol tweet and has a string as the second entry. It's pattern matching, I really like pattern matching languages. This is why I like prolog. And then the last line is writing the sentiment that I've calculated using that code I already showed to the tuple space. And that's what you're gonna get back. And then finally the reducer, its job is to pull all of those sentiment tuples out of the tuple space and then I'm just gonna write the total sentiment out to standard error. So you can see a tuplespace.take matching on the pattern, the symbol sentiment and a numeric and then writing it out to standard error. So that's all great, but I actually have to make this go on something other than my MacBook Air because it turns out that I can't actually do that much on my MacBook Air. And I was reading on Slack the other day that someone had been to a conference or every conference someone had been to this year had to talk about containers. So clearly containers are the right solution for this problem. So I'm using the Ruby latest container from Docker Hub and I'm gonna run this with eight containers on five VMs. And this is kind of a rough architecture diagram. There's one fetcher, there's one server, there's one reducer and there's a bunch of analyzers. And I work at Google and so I know Kubernetes because it's an open source project that started out of Google and has worked on a lot with the people in my actual office. And it takes care of managing all the container stuff so I don't have to worry about that. And so I ran this up with Kubernetes and it kind of made it look like this. I don't get to pick which VMs, different parts go on each gray boxes of VM, each colored boxes a container. But it turns out I don't care. And this isn't a Kubernetes talk. So I'm not gonna talk about how that works but if you would like to know the Kubernetes part I gave this exact same talk with a Kubernetes focus on Tuesday at KubeCon and that video should be online shortly and I'm happy to talk to you about it after the talk. So this is the part where I get nervous.  So if you can get out your phone or your electronic device of your choice and tweet an emoji at this hashtag at the end of the talk if I have time we will see what the sentiment of this room is. I've got this code all running in Google Cloud right now at this hashtag. Just tweet with that hashtag in there somewhere.  So yes, it will count each one of them.  Okay, I'm seeing more eyes.  So if you're not familiar Latin square is a very simple kind of logic problem and the idea is that you have a grid and then in each row and each column a symbol can only appear once. So this is a four by four Latin square and this is a seven by seven Latin square that was rendered in stained glass. This one happens to be at one of the colleges in Cambridge and was done in 1989. I saw it and I assumed it was gonna be much older because it was in Cambridge now but it's still pretty cool. Latin squares were named by Euler. Yes, that Euler because the paper he wrote about this used Latin characters for the symbols and they're simple. I'm here to show that I can't each and every one of you a piece of graph paper right now and say draw me a one by five or five by five Latin square and you can do it. But it turns out there's a lot of math and I am pretty much incapable of giving a talk without some math in it. So let's do some commonatorics because clearly 530 first day of the conference commonatorics time. So a four by four Latin square. How many four by four Latin squares do you guys think there are? Someone shout out an answer. There are that many, less than a thousand. So let's make it slightly bigger. Six, six by six. Turns out there are that many, almost a billion. Oh no, the numbers get bigger, trust me. So nine by nine Latin squares. Nine by nine Latin squares are interesting because it's kind of a degenerate, simpler version of Sudoku. It just has one less rule, right? So nine by nine Latin squares, there are that many. Which if you need help is that number in scientific notation and to put that in perspective there are fewer stars in the Milky Way than there are nine by nine Latin squares. But this isn't the biggest number I'm gonna show you. So first let's show, I'm gonna show you some code. I'm gonna use an approach like a sieve. If you guys have ever done the sieve approach to finding prime numbers, for example, it's the same idea.  And whatever comes out the bottom is your solutions. And I'm going to abuse array permute to do this. And the reason I'm doing that is because it's easy. I wrote this code up in about 10, 15 minutes. So here's the overall code to generate all the possible Latin squares plus a bunch more. First line, all I'm doing is figuring out the size. I'm gonna default to six unless I pass something else in. This line calculates all the permutations of an array that contains all the elements one to n or one to size. So if it was four, it'd be one, two, three, four plus all the permutations of that array. And stores that in an array called permutes. And this line creates all the permutations of the permutations of size n and prints them out to standard out, which means you end up with some n by n grids, which looks something like this. Now this one is not a Latin square because I have three ones in the first column. And it turns out that this algorithm generates this many items into the top of the sieve. So to simplify that a bit, and you're familiar with big O notation, it's big O of n bang bang, which is awesome. I laughed so hard when I figured that out and it's horrible.  So if you run that with size nine, you're gonna get approximately that many items into the top of the sieve, which is a big number, turns out. It's about twice as many as we need, or a little more than that. So this is the body of the method that checks the solution. Setting up some variables here, the size of the solution, and then an example array from one to n. That line right there checks that each row when it's sorted is equal to the example array, which is a fast and simple way to make sure that each and every number one to n shows up in that row. And then I use array transpose to rotate the array 90 degrees and do the exact same thing over again. And if it's correct, I'm gonna put the solution out to standard out. So how do I filter 10 to the 50th possibilities to find the ones that are actually and that 10 to the 27th that are actually Latin squares? Well, clearly scale.  I'm gonna use Rinda again. This is a tuple for a possibility. This is a tuple for a solution. And here's the server. It's exactly the same code as before. No, really, it's exactly the same code as before. And if I wanted to, I could run both these problems side by side using the same tuple space as long as the tuples they were writing didn't collide. I chose not to do that for a variety of reasons, but I could. So here's the generator. Basically the same code as before, just connecting to Rinda and then those last three lines are those lines I walked you through before lines I walked you through doing horrible things with array permute. Here's the checker. The line I've highlighted is pulling the possibility out of the tuple space and then I'm writing the solution into the tuple space and I'm also putting it out on standard out. So deployment. Turns out the same as before. Only I need more pieces. I actually need a lot more checkers than even on this. I ran this with 25 checkers and it took about 24 hours for it to get through all 10 to the 50th possibilities. But again, I used Kubernetes and it looked something like this. And most of you probably can't see this, but this is a screen cap of the logging console and cloud platform where I was running this. And the nice thing about that is that it pulls everything from standard out and standard error into my logs. And so what this is is this is a whole bunch of nine by nine Latin squares that it's outputting as arrays, 2D arrays. So this is the part that's scary. So back to the emoji. Let's see which side you guys are on. There we go. Oh, this is not good. So I'm gonna try to make this bigger for you, but it's okay if I can't. I'm gonna come sit here on the stage so I can look at the confidence monitor and see what the number came out as. So of two minutes ago, the sentiment was negative 2,334. That is how the live demo worked and it worked. So I'm gonna be thankful to the demo gods today. So this is a keynote and I've actually got a little bit of time left.  So were any of the things I talked about in this, were any of the ideas I talked about in this talk useful? No, none of them were useful. If you have these problems, I would love to talk to you because if you need to generate nine by nine Latin squares, I wanna know where you work. Were any of these ideas well engineered? Well, my original intention was to do these things as well engineered as Ryan and Aaron did in their talk with full test suites and everything else. But if you go check out the repo on GitHub, you'll find out that I did not do that because they weren't really well engineered. Were any of these the correct tool for the job? No, they're off the shelf tools for doing sentiment analysis.  And there are numerous published algorithms for doing Sudoku or Latin squares and solving them efficiently. Something that is much better than Big O of N Bang Bang. What, Big O of N Bang Bang? Was it fun to hack these together? Yeah, it totally was. Instead of do the simplest thing that could possibly work, I went for do the stupidest thing that could possibly work. And best of all, it was fast. All the render code you saw, all the Ruby code, totaled took me less than three hours. The deployment took a lot longer because it turns out I don't actually understand networking all that well, but I did learn it and I got it working. And one of the things I noticed while working on this talk is that we're really spoiled now with regards to how much computing power we have access to. I work at a place that's famous for that, but I also carry around the equivalent of four processors in my bag most of the time and that doesn't include my phone.  Ah, whatever. Can a pile of disks in one data center and some processors in another data center be a computer? I'm starting to think so. And a lot of folks are talking about how the limits of what we can compute is getting bigger. The data center is the computer and it makes it possible to do a lot of amazing things and a lot of really stupid things. So the moral of this talk shouldn't be distributed systems are fun and easy, but really that is not the moral of this talk.  Enjoy your code. So thank you. I explicitly want to say thank these four guys, Ryan Davis, Scott Windsor, Eric Hodel, and Brian Dorsey. Without them, this talk wouldn't have happened. Eric was the one who tried to help me finally understand how Rinda was actually working. Scott helped me understand how Docker containers talk to each other and how to get a container's IP, which is gross, in the official Docker way. And Ryan helped me figure out a less gross and more Ruby-based version of this and Brian Dorsey is one of the developer advocates on the Kubernetes team and he was able to help me with the Kubernetes parts of this. And because it's me, I have stickers and information about Google Cloud and of course I have dinosaurs, which I wasn't gonna break into until I finished my talk. If you have comments, questions, you can email me at thagamizeratgoogle.com. I am inordinately proud of the fact that I managed to get that. Or you can tweet at me at thagamizerrb. And I think I've got some time for some questions if you have some. Questions, yes. I have not tried the emoji thing with TensorFlow. I actually wrote this talk a month and a half ago and I did not know that TensorFlow was gonna be open source this week, but I'm going to.  TensorFlow is a machine learning library that Google open sourced on Tuesday of this previous week. And it's out as Apache V2. You can download it. You can try to do your machine learning and computational analysis with it. Other questions. So the question was, does Rinda handle the parallelism for me? For example, when I say tuplespace.take, does it actually pull it out of the tuplespace? And the answer is yes. Rinda handles all of that for me. It handles it in a way that makes sense if you understand that it was done in the simplest way that could possibly work, but it's a little bit obscure. Basically what happens is the client sends a message to the server saying here's the pattern and here's a port in a URI where you can send me something back. And it just does that over again and it takes it out of the tuplespace once it's been assigned to a specific client. Other questions. Awesome, thank you guys.


Well, good morning, ladies and gentlemen, and welcome to the first day of Genetic Genealogy Ireland. My name is Morris Leeson. I'm one of the many volunteers with the International Society of Genetic Genealogy, which is free to join. You're all very, very welcome here. I'd like to thank our sponsors, Family Tree DNA, for sponsoring this two-day lecture series. And we have 12 DNA lectures set up for you that will teach you about every aspect of genetic genealogy. So you're all very welcome. And it gives me great pleasure to introduce our first speaker, Andy Hockwriter. Now, Andy is a genetic genealogist and lecturer who manages multiple DNA surname projects and has successfully applied DNA to trace several related family branches of his own family tree overseas. He instructs continuing education courses in basic and advanced genetic genealogy at two community colleges in Maryland and helped facilitate the genetic genealogy module of the online genealogical research course at Boston University. So to tell us about DNA for beginners and how DNA can be used as a wonderful additional tool for your genealogical research, please give a warm welcome to Andy Hockwriter. Thank you. I don't know, is anybody else hot in here? I'm feeling it, you know, standing up here, the heat sign. I want to welcome you all back to our past conference here. And I want to thank Morris Gleason for inviting me to speak. He may have second thoughts after today, but we'll do the best. So I want to talk about DNA, and especially for beginners. So we're going to talk about some basics. And before I start, I have a confession to make. I have no Irish ancestry. So you can tell by my name, Hockwriter, that's not at all Irish, it actually is German. But on my mother's side, I do have some English and Scottish. So I'm fortunate also in that my mother had two marriages. Her first marriage, she was Canadian, and it was to a Thomas Edgar Wilson. So I was able to track them back to Northern Ireland, and I have had just a wonderful, both a fascinating and frustrating time doing Irish genealogy. The lack of records always kind of promotes the use of DNA so that you can find relatives, where the records are lacking, the DNA may put you on the right path. So the thing about genealogy, depending on how long you've been doing it, there's been a traditional path. And that is using your records and documentation, prony and such, talking to your older family members, relatives who have stories about where they came from or who was who. And that comprises a part of the toolkit for us as genealogists. So what's happened? Well, DNA has happened. It's gotten more and more sophisticated so that we can use that as a part of our DNA toolkit. And it's the application of a DNA test, the genetics to finding relatives and genetic relationships. So I'll tell you a little bit about my personal projects. I was able, using the Bishops' Archives in Germany, to trace my paternal ancestors back to about 1650 using documentation. And after that, I did visit the village my grandparents came from. And I met relatives, but they all came down through a sister of my grandfather. And therefore, there were no hookwriters. There were hand hours and prems and other family names, but no hookwriters left in this village. And even though I'm meeting the relatives, I'm still very kind of just heartened that I could not find a hookwriter, somebody with that name, in the village. So they've been missing for a while from my matches and such. So I started a YDNA SERP project for the hookwriters at Family Tree DNA. And I tested my relatives. And yes, we were all related. And there was no question there. But as I tested more people in the United States and across Europe, I tested hookwriters in Hungary, Slovakia, Austria, Germany, none of them were related. They were completely different haplogroups. And so there was no common origin. I found out that we all originated along different lines. So I did not find, I still using DNA did not find any hookwriter relatives up to a point. And I'll get back to my story of woe and frustration and finally enlightenment towards the end of this briefing. So the popularity of DNA has been promoted by a lot of things, television shows, back to your past. The scientific discoveries keep coming. And you can't pick up the newspapers without seeing something new happening in the field of genetics. And it's affected us in many ways, you know, because people are concerned about privacy. They're concerned about ethics and the law starts to change, you know, to protect your privacy and that. So some of that is very good.  So how about a show of hands, how many people in this audience have DNA tested? I think that's about 100%. I don't think I should ask who hasn't tested. So you're in the beginner class. Okay. I know there's a lot of questions always about, okay, I got my DNA test. Now what? What's the next step? And I'll tell you right now if you keep coming to these lectures over the next two days, there are other speakers here who will talk about the different types of DNA and the techniques that you use to find relatives and how to take that next step. But today I am just going to talk about DNA for beginners in some kind of a foundation for all of us. Well, did you know that you have two family treats? You have your genealogical family treat. And this is all your ancestors that you, whether you can identify them or not, but if there were a name in this chart for every little box, those are all your ancestors who contributed to you coming into existence today. Well, the other type of family treat is the genetic family treat. And these are the ancestors that you got your DNA from that who passed DNA. And not all of them, not all your ancestors were able to pass DNA because some of it is limited and it becomes, it just disappears. So in the chart, the gray areas might represent your genetic ancestors or family treat. And the genetic treat is a subset of your genealogical treat. And you can have two siblings who have exactly, of course, the same genealogical treat, but they do not have the same genetic treat. They got a different set of DNA from your parents than you did. And there will be differences between you and even a sibling, a close sibling. So as I mentioned earlier, some answers tend to drop off and it may be different between two siblings, what DNA they inherited and what they didn't. Now just, I don't want to bore everybody with high school biology, but I just find this amazing, you know? I think my old slides used to say around 50 trillion cells and they've gotten more precise.  That's the, can you imagine, you know, doing that type of thing? The wonder of it all is that we are so similar. And I have, you see different estimates. Some are 99.5% similar. Some are 99.9% similar. I prefer the higher number because it emphasizes the similarity between people. You can look around this room right now and any differences in eye color, hair color, ethnicity and all of that is based on that 1 tenth of 1% of difference in our DNA. Okay, so DNA actually exists in a couple places in our cells. And it exists in the nucleus and then it exists outside the nucleus. So this is a picture of the breakfast I had this morning, the eggs I ate. And that's basically what a cell looks like. You've got the middle part which would be compared to a yolk and that's the nucleus. And then you have this area that might be the white of the egg on the outside. That's the cytoplasm. Within the cytoplasm you have these mitochondria and they're small energy producing organelles that contain its own set of DNA. But most of our DNA is in the nucleus. That's where the chromosomes are located. Something here, okay. So if we're looking at the chromosomes, you know they're in the nucleus of the cell. And if you pull one out and you start to unravel it, you start seeing the double helix. And the double helix of course is made up of rungs like on a ladder. And those are actually pairs of your base pairs that are recognized by the letters A, T, G and C. And you always have the A's pairing with the T's and the G's pairing with the C's. And if you remember back to, we had a little memory jog and that is straight lines with straight lines and curves with curves. So that's how the base pairs line up in your chromosomes. And that's what they're counting when they're looking at what your DNA is. So I mentioned that there's different types of DNA. So within the nucleus, you have men have the Y chromosome. And also there's the other chromosomes that you have which are called autosomes.  So besides the Y which a man has, a man would have one Y and one X chromosome, females would have two X chromosomes. And I mentioned those little energy producing units outside the nucleus of the mitochondrial. They have a very small structure of base pairs but that's unique type of DNA. And I'll talk about inheritance patterns for all of these also. Now I'd be remiss not to say that there's some things that you should consider before you take a test. And that's what, that's those surprises you're always reading about in the newspaper. You know, basically you got to be prepared for a surprise. And DNA testing can reveal many things, family secrets, somebody's adopted, somebody's illegitimate, your brother's not your brother or your father's not your father and such. Unexpected relationships, you get an email from somebody who said I'm adopted but I think we're half brothers or something like that. Unexpected ethnic makeup, I mean that's for a lot of people, I'm 100% Irish and then you find out you've got some Turkish or Asian or African in there. So always be prepared for the different surprises that can come out. And certain companies will provide medical information to you based on your test. The other thing is you've got to be concerned about exposing your personal information. I mean people are concerned about privacy. All the companies, all the legitimate companies certainly take steps to try to protect you just as well. But how many of us use credit cards or we're on Facebook and they're selling information about our buying habits and such. And lastly is, you know, your DNA is not just your DNA. You share some of that DNA with your siblings, with your cousins, with your parents. And once your DNA is out there, some of that information can inform on other people also. Okay, so what happens when you want to take a DNA test?  The first one they present to you is called the Terms of Service. And that is not a voluntary form. That is, you must sign that or they won't test you. It's telling you what, it's presented to you at the time of purchase. You've got to sign it for them to even develop your DNA. And it sets out their conditions on how they're going to use. Now, they all admit that the DNA is yours, but people worry that it's going to be sold or something to a pharmaceutical company. Well, in this case, all the companies say, okay, we will use your DNA to develop better tools for comparison with shared matches and such. It's the second document that is voluntary that if you want to participate in some kind of medical research or such, that's the form that you release your DNA for. And normally, it's not something to worry about because even if you sign that and you're participating and they sell it to a pharmaceutical, it's not your individual DNA. They aggregate it, I was going to say aggravate it, but they aggregate it and it goes in combined with others. So they're looking at age parameters and such to develop better drugs. And it has been proven that drugs that are developed based on DNA testing are better, they work better and such. So some of this concern is overdeveloped and I wouldn't worry about it. But those are the documents you get when you want to test. Okay, so one of the things I tell people is, you know, there's a lot of companies out there and they ask me, what's the best? Well, I tell them there's not a best company. It's always based on what your priorities are, what your objectives are, and that's how you choose a company. Now, right out here today is, in fact, this conference is hosted by Family Tree DNA. And that tends to be for a company that is for more serious people. I think you get better responses from your shared matches. They also offer, in addition to your autosomal test, the comprehensive why DNA testing and mitochondrial testing. So that's not offered at the other companies. All the companies offer what's called autosomal and I'll explain that in the coming slides. So another one that's out there is 23andMe. They started with an emphasis on medical testing, providing your medical carrier status on certain genes and certain SNPs or mutations. And you actually can go there and only take a test for ancestry, your ancestry so you learn about your ethnicity and such. Or you combine that and get the ancestry test plus the medical information and you pay a little bit more. Okay, ancestry. Ancestry is known for their huge database. I mean, there's somewhere between 15 and 20 million kids in their database. So this is for people who want to maintain a family tree, make connections and figure out of the common ancestors with your matches. And you might have better hits. But I tell people that it's a U.S. company.  And if you don't have colonial roots in the U.S., like me, my grandparents were all pretty recent arrivals in the United States. I don't get that many. I'm looking for comparisons and shared matches in Europe. And so some of the other companies might offer you better matching in those terms. Family tree, as I said earlier, they're here. They're building their tremendous database of Irish results. And I don't see Martin in the audience, but there are people here who run that with Morris. And it's helping a lot of us, not just here in Ireland, but those U.S. Irish people who have Irish ancestry. OK, another one is MyHeritage. And they're kind of a, I want to say a newcomer, but they're like ancestry. Ancestry also, besides their DNA, they offer digital documents that you can look at, census records and birth records and such. MyHeritage started out the same way. It's actually a company that's based in Israel. And the founder started it to help the Jewish people who had European ancestry. So they tend to have a bigger European group in their database. And they're actually giving ancestry a good run for their money because they came out with some excellent tools to analyze your DNA. And it's up the game for all of them. So, you know, these are all legitimate companies that have good tools. Now, a British company is living DNA. And they're the new kid on the block. But their ancestry is based on the study that was done of the people of the British Isles. And what impressed me was the fact that they actually get it down to maybe county level that some of your DNA has originated out of. And like I mentioned earlier, my father's side was German. But my mother's side, her father came out of Bristol and they were Bryces. And they're all based in Somerset and that. So for me, it was interesting to get that side of my family DNA. And I'll mention more about ethnicity and how underdeveloped it is still. OK, so what do you get when you take a test? And you'll probably all know that you get your raw data. And what is that? That's all those positions on your chromosomes and the values. So you can see up here, there's those base pairs, T's and G's and C's. That's all the specifics that you have. And it's in your raw data file. So you can download that and actually look at it. But it's not easy. It's alphabet soup. And that's what you use the company to help sort out and make sense of. The other thing is that you get either your ethnicity, which comes from your autosomal results, or you get deep ancestry, which comes from Y DNA or mitochondrial DNA. And that is where do your ancestors come from? It's a good guess on where they come to from. But the most important thing you get is a match list. Your relatives on how much DNA you have with them. That's where the gold is. That's what you want to work and figure out what the relationships are with these matches. And where is that common ancestor that passed down DNA to you and that match? And so you get a match list, something like this, that tells you how many matches you have at that company. OK, so now we're going to talk a little bit about the different types of DNA. And the Y DNA, as I said, is inherited by a man. And it's strictly along the male ancestry. It goes back along one line. And it traces back to an original founder. And it's passed down generation after generation from father to son. OK, so the Y chromosome has a lot of base pairs. So they can select which ones have some variation and then compare it to other males and see how close you are related to them. And it can only be used to trace the male line.  Now the unique thing about Y is that it's a standalone chromosome. It doesn't recombine with anything else. So it lasts a long time. It can get passed down many years with very minor mutations. And you do see some mutations in it. Now, and that works very well if you have a surname project. Because that Y chromosome is coming down along with that surname in a traditional surname when you're passing from father to son, the surname as well as the Y DNA. OK, so when we're looking at Y, there's actually two types of tests that you can take. One is called a stir test and another is called a SNP test. Now the stir, that is short for short tandem repeat. And SNP is a single nucleotide polymorphism, which is actually just a fancy term for a mutation. So think of SNPs as mutations. OK, so here's a Y DNA. And you'll see that this pattern, this repetition of the pattern G8TA is repeated there. There are certain sections of the Y DNA chromosome that has repetitions going on of those base pairs. So in this case, this repetition is repeated three times. So it has a value of three. We say that the stir value at that location is three. Now, stirs are used to predict your haplotype, those other people that you are related to. And it usually represents a more recent evolution. Those stirs might differ even between a father and a son, something rather than a stir value there of three. The son had an additional one, so he has a value of four. That can happen, but the more closely you're related, they say it's a genetic distance. And if you have a genetic distance, no differences, a genetic distance of zero, that means you're very tightly related. Now, the other type of marker or DNA test that they have is called the SNP. And a SNP only happens at one location on the chromosome. And that is a change that happens. And so you can see here that you have a C and a G in the top row. And that morphs or mutates to a T and an A. And those represent branching of your Y chromosome. And the SNPs represent what we call haplogroups. And I'll explain that in just a minute also. But those are ancient origins. Those are where you have this mutation and it just represents another branch of the Y DNA tree. It happens infrequently, but there's a lot of testing now going on that does show that some SNPs can be more recent. So they're finding more use for this. They're identifying newer SNPs that have happened maybe in the last couple hundred years rather than a couple thousand years or 10,000 years. OK, so when you get your results back for the Y, this is what you're going to see. This is, I want to make sure I don't mess with, ah, there, OK. So you see that that's the position where those repetitions occur. That's one position, that's another and another. And they count up how many repetitions. So in this case, there were 13 here, there were 25 repetitions there. This is what the testing company compares to other men to see how close you are. And they may look at this and say, OK, you know, you have, you are this closely related to this other person based on the number of differences in this table. Now, one of the things I'll mention, this is a table with, I believe, 67 markers tested. You can test for 37, which would go down through, what, about this? That's, OK, and have only 37 or 67 or up to 111 positions. And if you take what's called the big Y, that's like the ultimate Y test, you'll actually have up to 700 STIRs provided to you. Right now, the comparisons are only go up to about the 111 level to compare you to a different person. OK, so this is then what you get when they're comparing and it tells you who your matches are. So in this case, the names are blanked out here, but this is somebody, I, whoops, I hit too many, I'm sorry, this is somebody who I represent that says 67 markers. We, in 67 markers, I have no differences with this person. So actually, this is my brother, so we have no differences there. This one is probably a first cousin, we have a distance of one. That means that somewhere along this, well, this was 111 markers, so somewhere along there we have one difference. And those are very tightly packed, but you can tell how closely you're related to somebody based on these genetic distances. OK, so now the other type of markers are these mutations, or SNPs as we call them, and they're telling you about what ancient group you belong to, your males, where they descended from on the journey out of Africa and populating the world. So every time, as I mentioned, you had a mutation occur, it divided and turned into a new branch of the tree. So A divided, and then you had A and B, and then B divided, and then you had A, B, and C. So that type of thing was going on through history, and these are determined by what they call a terminal SNP. What's the last mutation that you have? So here is, this looks like it could be a pedigree tree, but it's a pedigree tree of the different types of haplogroups.  The branches broke down over the years, and look at that, about 65,000 years ago, 45,000 years ago, 40, and some of the more recent ones. I'm an E1B, so I'm up here, it's an older branch, but ours are more recent, and most of Europeans are R1As, or R1Bs, and you might wind up there, or under another type of haplogroup. And they're designated using letters and such. So as I mentioned, each mutation then divides into a branch, and those branches are sometimes called subclades. And here's my branch, and you can see how complicated that gets. They're adding letters and numbers out, and now they've kind of taken an abbreviated approach. What that E1B, yada, yada, yada represents is actually my termosnip, which is E-V13. V13 is the end of that, E is my haplogroup. Plain as mud, is it? Okay, so as I mentioned, haplogroups represent the genetic group that you descended from.  The maternal haplogroup represents your mother's side and how they descended over time. Okay, so as I mentioned earlier, they're represented by different letters and numbers, and they're defined by the mutations that broke those branches off. Okay, so the trouble, though, all the tests had their advantages and disadvantages. Okay, the why is great for certain things like studying surnames and such. It helps to break down some of those paternal questions. You've got a very common name like Wilson or Smith, and you want to know, all right, what branch of Wilson's do I belong to? There are studies out there that have projects out there that have studied these things and can place you in the group that you belong to, back to maybe an early ancestor, and cut through a lot of that for you. One of the things that Ken revealed, as I mentioned earlier, is family secrets, and that is what they used to call NBPs, or NPEs, non-paternal events. Well, that's kind of a mystery, what is a non-paternal event? Now they're using the term MPE, which is a misattributed parentage, and that is, all right, my father's not my father, it's somebody else. Okay, limitations is that women cannot take the test, and they have to find a qualified or a suitable tester to do it for them, and many lines have only daughters, so we call that daughtering out, but you lose that Y chromosome, and you have to work your way back to an earlier ancestor, and then work collateral lines coming down to find somebody that has the Y that you need. Okay, mitochondrial, that's the other DNA in your cell. That goes back strictly along the maternal line, and it is passed down from the mother to all children. So both men and women have mitochondrial DNA, and though you can take that test and you can compare your maternal ancestry with each other. So it has a unique DNA structure, it's circular, and it's made up of three sections, the coding region, and two hypervariable, which means fast-changing areas, and they have different degrees of testing, but you want to take the full sequence test if you want to do anything with genealogy, and it's only really, it's a very small structure, compare that to the 57 or 59 million base pairs in the Y, there's only 16,569 base pairs in the mitochondrial structure, so you want to have all of them tested so that when you compare yourself to somebody else, you're looking at every one of those locations. Now fathers don't pass down any of their mitochondrial, it only comes from the mothers, and it doesn't recombine and mutates very slowly, in fact it mutates slower than Y DNA does, and therefore it's used a lot of times with this to determine the ancient DNA of some of these skeletons that they find, because there's a lot of it and it hasn't mutated. The same thing with them, you have a pedigree of the different mitochondrial haplogroups or maternal haplogroups going down, I'm an H, so I'm down here, but you could be any one of those, and they evolved over centuries or millennium from a, and you might call it the female Eve in Africa, and as the mutations occurred, the new branches broke off from each other, so that's what I am. So when you look at your results for the mitochondrial, you'll get something like this, and they have reference sequences that they compare it to. Now this is the point where I say, okay, depend on your testing company to give you this information, you're not going to go through all those 16,000 results, you're going to look at something like this that tells you what they compare you to the reference model, which was T, and I'm a C, so I have a change there. Now sometimes the reference model didn't have a value, I have a C at that location, and then sometimes the reference sequence has a value, and I have none. So this is what they do to everybody, and then they compare you and they can tell you how close you're related to this other person. A mitochondria, because of that small number, does not have the variety or the variability that they can compare people to. You might be related to a match, no genetic distance, a genetic distance of zero. That means you match on all aspects, but you don't know if your common ancestor is 100 years ago or 500 years ago or 1,000 years ago. That's how slowly it changed. So it's a much harder DNA test to use for genealogical purposes. So the two types of reference models are the Cambridge reference sequence and what's called the reconstructed sapiens reference sequence. And if you test at family tree DNA, it gives you both. So like I mentioned, there are advantages and disadvantages to mitochondrial tests. Basically, you're looking at taking a full test, so you've got all of those. It will tell you your haplogroup, both men and women have mitochondria, so they can both test and compare your results to each other. But as I mentioned, the distance, you won't know how far back that common ancestor, much harder to identify. Okay, so the popular one now is autosomal. All the test companies give this type of test. And sometimes it's called a cousin test because it involves everybody, not just back along the male line here or the female line, but all those aunts and uncles and cousins in between. Okay, so this is the DNA that is in the 22 autosomes or the 22 other chromosomes that you have. And that represents a great amount of our DNA, about 95%. They don't test at all. They test various numbers and then do the comparison. Now, characteristic-wise, you get 50% of your DNA from each parent. And it does recombine, so that can really throw off a lot of things. As I mentioned earlier, you may be very different from your sibling. But this is the most popular test now. The recombination can throw it in. You want to phase your data if you can test a parent or a paternal cousin to help you identify what side that DNA comes from. So this is a kind of an illustration of all these ancestors and how it mixes coming down to you. Advantages are it provides the widest range of connections or relationships to you, both men and women have autosomal DNA, so they compare the results. And the disadvantage or the issues that you have to work with is that it recombines randomly. So you have to identify whether or not a relationship is on the paternal side or maternal side. And it doesn't last forever. You get a certain amount from your ancestors, but it dissipates over a number of generations.  Okay, X is very unique because of the inheritance pattern. It's different than the other, it's different between males and females. They have different. So males get one X from their mother, females get two, one from each parent. And it's not the same as a maternal or mitochondrial test. It's a completely different test. So a lot of people confuse the two, but don't do that in your own mind, okay? And men inherit their X and they pass it on to their daughter, but not to their sons, okay? Okay, so this is the male pattern. And as you can see, he's getting the X from his mother's side.  And one of the helpful things is to look at your pedigree and then identify those ancestors that, according to that chart, will pass the DNA to you. And now here's the female, and they're getting an X from their father and from their mother. So they got more ancestors that they can determine where that X came from. And again, use a pedigree chart to determine those. Okay, very quickly on ethnicity. You get your ethnicity from the autosomal test, but you get deep ancestry from your Y and mitochondrial. They're based on what's called ancestry-informative markers. These are SNPs or mutations that have different frequencies with different regions of the world so they can determine that. Now, I will say that ethnicity is nearly impossible to predict. They're getting better by revising a lot of the reference populations, but each company has different ways of determining your ethnicity. They use different reference populations, different matching thresholds, and different algorithms to determine that. And it's constantly changing. Those who have tested at ancestry probably have seen that. All of a sudden, your ethnicity changes to a vast degree because they've improved it. Okay, so with my own research, I was able to test somebody from Buffalo, New York, and I found out that his ancestors came from Tonnesburg, which is near my grandfather's village, and the research back into the records showed them connecting in Moosebac, an ancestor in the 1700s who moved from Moosebac to this other village. And when I went to the phone book, I found this hook writer. They spell it T-H-E-R, I spell it T-E-R, so I was not hitting that because I just did not think of the variety of ways it could be spelled. And so here's what comparison you can see how close we are. These are my cousins that I found who are hook writers and we are seventh cousins. Autosomal will not show that relationship. This was only through the why that showed that. So I want to thank everybody for this suffering through my and you don't have to invite me back next year, but thank you very much. Thank you very much, Andy. Now, before you go away, we probably have time for a few questions. Oh, does anybody have any questions for Andy? Yeah, we have a lady here. National Geographic was set up as a scientific test or a scientific project. And initially, Family Tree DNA was the lab that developed everything and you could transfer it and it depends on what kid he took. Afterwards, they brought in a different company Helix and those results do not transfer well into Family Tree DNA. If it's an older kid and it was done by Family Tree, you could transfer it to Family Tree DNA and you get the benefit then of matching. He can look at his other people that he matches with. Okay, yes, you should have gotten some results by the transfer. You doesn't show up as having certain values and you're getting that matching because then you don't have to take another test. Yeah, well, if you want to stop down, I'll be at the booth downstairs and we can pull it up on my laptop and we can take a look at it together. Sure, cool. Anybody else? Michael here, 23andB does a little bit of a chart of Y. That's correct. How does that Y compare with the Y test on MDNA? They come up with your HEPA groups for the Y and the mitochondrial based on SNP testing. It's not comprehensive like they do at Family Tree DNA. So they'll give you maybe even a higher level HEPA group in your subcite but not the deep ancestry that you would get with a comprehensive test. They'll do the stir testing at Family Tree DNA which gives you very definite results whereas these are the SNPs, the mutations. They'll do a number of them, target ones that kind of predict what happens with your UI input maternally and paternal. But did each one have to come down from a certain extent on the Y type of mutate, put your odds? Yes, and so you might come down this file but you don't have your terminal SNP which is much deeper. And it gives you more granularity when you're comparing to other men and men.  So it's more of a general prediction of what GERA is. Give an example of that. This will bring me back 4,000 years from the second. Whereas if I do my HEPA-TBNA and I do this Y test that will give me a SNP every 100 years. But that will bring me back to the current standard of the big difference. We had another question. Gentlemen, here we are in the blue. Then James, that'll be the last one. It's an observation. I'd like to photograph what you said with cousins. I've done a similar thing. I've got so many differences from me in the two steps in the shape of Y. And I've got a couple. You have to use a couple Y. Yes. Oh, my God. But we have to discover that there's no other sort of connection between parents. If we do enough cousins right to the side, a couple of them can find together. That's a good point. And they really promote using and adding autosomal to your Y to give you more of that. I've done a few projects and I've done a few projects and I'm surprising the number of them. Yeah, yeah. And that test is the cheapest. They're always on sale. And it adds so much more. And it gets more clarity, certainly, to more recent relationships. And thank you for sharing. We have to call it a day there because we've got people waiting outside to go in for the next lecture, which will be Martin McDowell's Bally-Carrie DNA project. So please can we show our appreciation, Randy Huffriner. Thank you very much. So we'll start here in about two minutes.