WEBVTT

00:00.000 --> 00:04.660
Okay, looks like everybody's got a seat at this point pretty much.

00:04.820 --> 00:13.480
And I wanted to let you guys know that I will be putting the code on GitHub that goes along with the presentation that I'm giving.

00:13.480 --> 00:21.540
So if any of you are new to data analysis and want some code to get started with, that will be available on GitHub.

00:26.430 --> 00:36.510
And my talk will be a combination of different ways to explore... Oh, sorry about that.

00:36.510 --> 00:37.310
Okay.

00:40.500 --> 00:42.280
Oh, okay.

00:45.740 --> 00:46.960
Okay.

00:46.960 --> 00:56.400
So my talk is going to be a combination of why you should do exploratory analysis and how to do exploratory analysis.

00:56.420 --> 01:14.300
I'm not going to cover everything because that could take weeks, but just a couple of graphs to get everyone started and thinking about why we do exploratory analysis, why it's important, and what happens if you don't do it.

01:17.460 --> 01:27.920
So the biggest problem that I have seen with machine learning is not that we don't have enough algorithms to use or that we don't have enough techniques.

01:28.380 --> 01:31.500
It's that people don't want to start with the basics.

01:31.500 --> 01:33.500
They want to jump right to the exciting stuff.

01:33.500 --> 01:35.900
Oh, let's throw a neural net at it.

01:35.900 --> 01:37.780
Oh, that'll fix it.

01:38.460 --> 01:43.120
Rather than just looking at the basics of the problem.

01:43.480 --> 01:45.540
Kind of like eating your vegetables.

01:45.540 --> 01:51.360
People aren't super excited about vegetables generally, but they help make you stronger and healthy.

01:51.520 --> 01:56.200
And exploratory analysis can also help you make your data healthier.

02:01.980 --> 02:11.200
So some examples of why you want to do exploratory analysis or even just sort of think about what you're doing with your data.

02:11.720 --> 02:25.280
Because this article as an example, they were trying to identify criminals based on facial recognition.

02:25.280 --> 02:28.960
Not a specific criminal, just criminals in general.

02:28.960 --> 02:33.380
That doesn't really sound like a great idea if you think about it.

02:34.220 --> 02:41.100
Especially when you realize that, oh, hey, they weren't even comparing pictures from the same source.

02:42.300 --> 02:50.000
They were comparing mug shots to photos that they found on the internet of smiling people.

02:52.700 --> 03:00.940
So, yeah, I think most of you are probably familiar enough with data science to realize why that's a problem.

03:02.360 --> 03:12.600
But it's easy to just get so involved in what you're doing that you don't stop and think about, is this actually a good idea, what I'm about to do?

03:16.960 --> 03:18.780
And another example

03:21.900 --> 03:24.700
is this one I'm not as sure about.

03:24.700 --> 03:32.480
I think it's an interesting example because there are some diseases that have hyphens in the name.

03:32.480 --> 03:42.460
And it turns out having a bunch of hyphens in the title of your article has a negative correlation with how many citations your paper has.

03:43.700 --> 03:46.400
Well, this could be a thing.

03:46.920 --> 03:57.300
Or it could just be that longer titles generally have more hyphens and also are a more specialized article.

03:58.020 --> 04:05.880
So then it's going to be cited less because you're talking about a niche within medical research.

04:05.880 --> 04:07.820
So maybe, maybe not.

04:08.440 --> 04:11.460
A lot of interesting correlations out there.

04:11.860 --> 04:15.980
Something that I think needs to be looked into more.

04:15.980 --> 04:21.360
But just an example of why we need exploratory analysis.

04:21.360 --> 04:28.980
We need to figure out what's actually there, what might not be important.

04:35.210 --> 04:40.470
And the good news is that there's all sorts of Python packages out there to help you with your data.

04:41.810 --> 04:50.450
And I'm going to go through a couple of my favorites and show you guys some examples of what you can do with them.

04:53.680 --> 05:03.760
So I'm not going to cover a lot about feature extraction just because it's very specific to the kind of data you have.

05:03.760 --> 05:08.750
For my dissertation research, I used inertial sensors.

05:09.480 --> 05:12.320
So I dealt a lot with time series data.

05:12.320 --> 05:15.790
That is completely different from language processing.

05:16.490 --> 05:20.210
So how you extract features from your data.

05:20.610 --> 05:27.630
Look within whatever area of research you're doing, but also other areas that might have similar data.

05:27.630 --> 05:35.170
When I did my research, I used a lot of papers that were from the aviation industry.

05:35.290 --> 05:49.370
Because it turns out it's a lot more important to keep a plane upright while it's flying through the air than it is to make sure that you know the exact position of grandma's ankle when she's walking around the house.

05:49.590 --> 05:54.270
So there's been a lot more research for aviation applications.

05:54.270 --> 06:02.790
So had I just looked in medical journals, I would have missed a lot of valuable information about how to deal with the data from these sensors.

06:03.610 --> 06:10.870
So just something to keep in mind that you don't have to stick to exactly the application that you're using something for.

06:16.500 --> 06:21.370
And another thing to keep in mind with feature extraction.

06:23.120 --> 06:31.100
So for categorical data, there's really two different kinds of categorical data.

06:31.100 --> 06:36.220
Some of it is in order, some of it not really so much.

06:36.220 --> 06:50.320
And I've seen these mixed up and people will try and turn nominal data into numerical data.

06:51.360 --> 07:00.160
It can work if you look at it and you see if there's some sort of correlation, put it in a specific order.

07:00.380 --> 07:02.480
I mean there's always exceptions.

07:02.480 --> 07:21.960
It is specific to the data you use, but in general if you haven't explored your data, you probably don't want to take something like colors, like what's someone's favorite color, and just randomly say, oh zero is going to be blue and one is going to be red,

07:21.960 --> 07:24.800
without looking at your data first.

07:30.910 --> 07:42.050
And another thing that I just wanted to mention was binning, because I've seen that done a variety of different ways.

07:42.410 --> 07:50.810
When something is not continuously distributed, it's probably worth looking at your data before you make your bins.

07:52.970 --> 08:07.370
I'm going to use an example of the Titanic data set from Kaggle, just because there's so many different options out there for code to analyze it already.

08:07.370 --> 08:17.510
Once you get familiar with that particular data set, then looking at the different ways it's been reanalyzed is a good way to get started with visualization.

08:17.510 --> 08:38.690
I think that's how I decided to get started looking into different kinds of visualization, so I'm going to use the same example here, except for a couple of different graphs that don't really lend themselves well to the data from the Titanic data set.

08:44.980 --> 08:56.470
So the first thing that I usually do is just use describe, and that will work on your numerical data sets.

08:56.470 --> 09:12.030
A good way to get started, find out how many things there are, some standard information, very easy to do, worthwhile information.

09:16.720 --> 09:21.740
The next thing is pandas profiling.

09:21.820 --> 09:27.900
If you haven't heard of pandas profiling, it's really great.

09:30.240 --> 09:32.220
Please use it.

09:32.220 --> 09:34.220
It gives you so much information.

09:34.220 --> 09:40.380
It can be overwhelming if you're not used to doing data analysis, but it's a great place to get started.

09:40.380 --> 09:47.480
You get a bunch of different graphs with distributions of the different features that you have.

09:47.480 --> 09:48.960
It will give you warnings.

09:48.960 --> 09:56.720
I've put an example up on the screen of what happens when you run pandas profiling on the Titanic data set.

09:59.970 --> 10:04.170
So definitely pandas profiling, great way to get started.

10:05.090 --> 10:12.310
It won't necessarily tell you everything you need to know about your data though, so that shouldn't be the only thing you do.

10:12.310 --> 10:18.190
It just sort of gives you a direction to figure out what you might want to explore further.

10:23.970 --> 10:29.310
So the cons of profiling, the output is HTML.

10:29.610 --> 10:32.090
I normally use spider.

10:33.330 --> 10:38.370
Spider is not super happy about HTML files.

10:38.370 --> 10:41.670
You can save it to a file.

10:41.810 --> 10:44.270
That's pretty much your only option with spider.

10:44.430 --> 10:50.530
If you use it with Jupyter notebooks, then it's going to be a lot easier.

10:56.330 --> 10:59.610
But definitely worth using.

10:59.610 --> 11:10.390
I'll even open up Jupyter notebooks, even though it's not what I usually use, just to look at something in pandas profiling real quick before I get started.

11:14.950 --> 11:21.870
So once you use pandas profiling, get an idea of what might be interesting.

11:22.430 --> 11:29.030
Then, if you have time series data, it's good to start with just a simple graph.

11:30.190 --> 11:39.130
This graph is from the data analysis that I did as part of the data science boot camp that I went to.

11:40.250 --> 11:55.240
And I realized partway through my project at the data science boot camp that, oh, hey, I was classifying data that had come from two different wards of a hospital.

11:55.590 --> 12:06.630
And I realized, oop, I'm pretty sure that they had two different kinds of sensors on the patients in the two different wards.

12:06.630 --> 12:21.670
And that was kind of a problem, because I was classifying based on what sensor they were using instead of if the patient was actually in the cardiac ward of the hospital or not.

12:22.290 --> 12:33.590
So that was unfortunate for my project, but at least I didn't think that I actually had something that was super exciting and useful.

12:33.590 --> 12:39.830
And then it turns out, oh, hey, I was just classifying an artifact of the different machines that were used to collect the data.

12:41.330 --> 12:50.190
So, yeah, I'm telling all of you guys about my very embarrassing story, just so that you know that everyone has these stories.

12:50.290 --> 12:52.770
If they say they don't, they're lying.

12:56.150 --> 13:18.450
So, yeah, if I had started with doing some of these graphs, just a simple graph of the data from the two different groups that I was trying to classify, I could have saved myself a lot of time, and then it would have been early enough into the boot camp that I could have picked a different project and not had to tell potential employers that,

13:18.450 --> 13:20.230
oh, hey, here's this analysis I did.

13:20.230 --> 13:29.930
I think it might actually just be a giant steaming pile, but it's what I did, because I figured it out too late to start a new project.

13:35.520 --> 13:40.400
So, heat maps.

13:40.400 --> 13:42.720
Everyone loves heat maps.

13:44.020 --> 13:55.080
I like using them to help show data to people that are not necessarily data scientists.

13:55.380 --> 14:05.040
It can be a good way to see what might be interesting and correlated, but also it's easy for someone that's not super technical to understand.

14:05.040 --> 14:07.020
So, I am a fan of heat maps.

14:07.020 --> 14:14.720
I realize that not everyone might be, but I do find value in them.

14:15.580 --> 14:24.680
And it's also part of Panda's profiling, so you get one of those without having to really do any extra analysis.

14:25.680 --> 14:28.980
Oh, well, that's not great.

14:28.980 --> 14:29.840
Okay.

14:30.660 --> 14:43.480
But another thing that I like is violin plots, especially if you have a binary classification, because then you can put your two classes on either side and see if they are similarly distributed.

14:45.240 --> 15:01.160
So, this example is from the Titanic data set, and you can see that, okay, this data is definitely dependent upon age, which makes sense.

15:01.160 --> 15:04.780
They put all the children on the lifeboats first.

15:04.780 --> 15:08.480
Well, especially the male children, it looks like.

15:09.520 --> 15:20.220
But, yeah, if you look back at the heat map between survival and age, there's not really much of a correlation.

15:20.540 --> 15:38.160
But then if you start breaking it out into different ages versus just age, then you can see, oh, hey, I might should make my bins according to where these probabilities are.

15:38.240 --> 15:43.420
So, that's what I was talking about with looking at your data first before you decide to bin it.

15:43.580 --> 15:57.800
Because this one, if you had just taken the youngest and the oldest and divided it into a certain number of groups, you might have not had the best classification based on the probabilities that are in there.

16:01.340 --> 16:07.480
So, I prefer to look at data before just randomly assigning it to bins.

16:11.890 --> 16:16.230
And another thing that I like, pair plots.

16:16.910 --> 16:23.210
And pair plots are great because you can see how two variables are related.

16:23.210 --> 16:40.750
This is not the best example of a pair plot, but you can sometimes see just, okay, all it really takes is those two variables to separate out your classes, if you're lucky.

16:40.750 --> 16:54.290
That happened with the pair plot for my dissertation research, but unfortunately that one was really large and I wanted to keep this consistent with showing you guys the same data.

16:55.670 --> 17:05.270
But it's not necessarily that if you don't see a separation on a pair plot, you won't be able to classify your data.

17:05.270 --> 17:08.690
It's just, if you see it, that's good news for you.

17:08.730 --> 17:15.950
Your life just got easier because you know that, oh, hey, these two variables definitely can show you something.

17:21.050 --> 17:22.170
Okay.

17:23.530 --> 17:33.530
And here is a little more of me showing you guys just how terrible my idea at the data science boot camp was.

17:33.530 --> 17:34.510
Okay.

17:34.890 --> 17:41.030
Because if I can't be an example, at least I can be a terrible warning for all of you.

17:41.590 --> 17:53.750
So this drift feature that was the most important when I used a tree-based classifier, that was when I did that midline.

17:55.110 --> 18:00.670
So back, oh, I should have put these two slides next to each other.

18:04.870 --> 18:05.870
Okay.

18:05.870 --> 18:14.410
So here when I did that midline correction, so that orange line, I took that out and then you get the green one.

18:14.410 --> 18:26.330
So that orange line, the standard deviation of that line was the most important feature that I found for my project.

18:26.530 --> 18:38.150
The thing that I took out to try and make the two different datasets the same, yeah, that was my most important feature.

18:38.150 --> 18:49.310
Because one of the datasets had already been normalized and had that midline correction and the other did not.

18:49.310 --> 18:57.330
So, yeah, that was a frustrating experience for me.

18:57.330 --> 19:02.790
But at least I found it out before I went any further with it.

19:03.190 --> 19:05.450
So I can't really complain.

19:05.710 --> 19:19.910
And, I mean, I did learn something from going to the data science boot camp because now I know the importance of doing much more EDA much earlier before I have to commit to an idea.

19:24.750 --> 19:30.430
So, yeah, that was my boot camp experience.

19:30.430 --> 19:40.950
I would say if you are thinking about going to a data science boot camp, they might tell you not to pick a project before you go there.

19:41.210 --> 19:45.950
Definitely find some data you're interested in and look into it a little bit first.

19:45.950 --> 19:55.270
Try to avoid doing what I did and realizing your project is a steaming pile when it's too far in to switch.

19:59.570 --> 20:08.170
So, yeah, that just my rant on data science boot camps, but...

20:08.750 --> 20:09.850
Okay.

20:11.530 --> 20:23.070
So, this was another thing that I did while I was at the data science boot camp because I needed to get results that didn't look too terrible.

20:23.710 --> 20:29.490
So I just threw a bunch of classifiers at my data because I was running out of ideas.

20:29.730 --> 20:42.990
I'm not saying that it's a bad idea to try a bunch of different classifiers, but at least look at your data first so you don't end up in the same situation that I was in.

20:47.060 --> 20:51.260
And in this case, yeah, there were a bunch of ones that were overfitting.

20:51.260 --> 20:54.560
I should have also used more data.

20:56.220 --> 21:01.060
But it was a learning experience.

21:08.480 --> 21:18.920
And here's another graph with me just telling you guys how terrible my idea was.

21:18.920 --> 21:23.620
So, yeah, really high training accuracy, really low test accuracy.

21:23.620 --> 21:27.300
I was overfitting and it was so bad.

21:29.740 --> 21:38.340
But... I at least was able to look at false positives versus false negatives.

21:38.700 --> 21:43.480
Since this was a medical application, it's a little bit different than security.

21:43.480 --> 21:55.100
For medicine, we really, to miss anything, like saying that, oh, hey, someone that's having a cardiac event is fine is real bad.

21:55.100 --> 22:01.200
Better to accidentally say, oh, hey, someone might be having a cardiac event when they aren't.

22:01.240 --> 22:06.540
So this is a little bit different than security.

22:08.160 --> 22:12.000
But... yeah.

22:13.940 --> 22:14.580
So...

22:17.700 --> 22:21.840
Does anyone have any questions?

22:22.360 --> 22:23.440
Because...

22:25.180 --> 22:27.100
I could just keep on going.

22:27.100 --> 22:29.180
But... okay.

22:29.620 --> 22:30.700
I guess...

22:58.850 --> 23:06.770
So for that, there's a bunch of different techniques you can use.

23:06.770 --> 23:08.570
You could do...

23:11.410 --> 23:17.910
dimensional reduction, so combining those features, seeing what features end up being combined.

23:18.930 --> 23:19.470
But... yeah.

23:19.470 --> 23:22.270
I was just showing some ways to get started.

23:22.390 --> 23:27.670
Definitely just looking at two variables together is not the only thing you want to do.

23:27.670 --> 23:34.490
If two variables is all you need to start getting it separated, then that's really good.

23:34.630 --> 23:38.110
But that's not how it usually works.

23:40.350 --> 23:41.190
Sorry.

23:41.190 --> 23:44.350
Did I answer your question?

23:44.810 --> 23:45.030
There

23:57.250 --> 24:02.690
are a bunch of different techniques for that.

24:03.410 --> 24:11.590
Principal component analysis, lasso, sorry, I'm drawing a blank on all of them.

24:11.590 --> 24:14.730
But yes, there are definitely ways to do that.

24:14.730 --> 24:23.010
And then, again, one option you can use is running it through a tree-based classifier.

24:23.010 --> 24:31.010
That might not be what you end up using in the end, but it can show you if there are multiple variables that are important.

24:31.010 --> 24:41.310
So for this one, it showed there wasn't just one or two standout variables that, okay, that's the one that was really predicting what was going on.

24:43.630 --> 24:49.990
So as far as if you want to visualize it, that could be an option, looking at that feature importance.

24:57.470 --> 25:03.990
Oh, he was asking about when there would be more than two features that would be important.

25:06.090 --> 25:30.590
So I was just, because I'd shown the pair plot, which only shows two features combined with each other, but a lot of the time you're going to have a combination of more than two features that will end up being what you use to predict whatever it is that you're classifying.

25:31.090 --> 25:34.370
So yeah, there are other techniques beyond what I showed.

25:34.370 --> 25:41.610
This was just more of a starting to think about your data and please, please think about what you're doing.

25:41.610 --> 26:03.850
And if there's bias in your data before it was even collected, like the example that I gave of my data science bootcamp project, where it turns out I was just checking to see which kind of sensor had been used to collect the data versus what I was trying to do.

26:03.930 --> 26:13.530
There's so much bias data out there and it's easy to not really think about where the data came from.

26:13.870 --> 26:16.090
Is this a good idea?

26:16.930 --> 26:18.770
And that sort of thing.

26:22.550 --> 26:30.870
Like the, sorry, I keep on coming back to this, but it's just, it's so bad.

26:32.110 --> 26:40.810
Like this, like if they would have just thought about, oh hey, why am I trying to separate criminals from non-criminals?

26:42.750 --> 26:54.550
I feel like if they just spent a little more time thinking about that, maybe they wouldn't have put that out there and now everyone's seen it and sort of makes fun of it.

27:01.950 --> 27:02.810
Okay.

27:02.810 --> 27:02.810
Oh

27:09.850 --> 27:12.970
yes.

27:16.350 --> 27:30.390
There are a lot of people I've seen that skip EDA because they either don't know how to do it or they just get really excited about their project and want to just go straight to classification.

27:42.790 --> 27:49.530
So I think EDA is so easy that there's not really any excuse to skip it.

27:49.530 --> 28:01.710
Like you're never going to look back at a project and say, I really wish I hadn't spent that hour or two looking into my data to make sure that it's what I think it is.

28:02.290 --> 28:14.430
But there are plenty of times like my bootcamp project where I looked back and thought, I really wish I had spent more time looking into that project before I committed to it.

28:16.750 --> 28:17.470
Yeah.

28:17.470 --> 28:34.130
So that's sort of why I am now very passionate about EDA because I don't want to have any more of those experiences and I want to help prevent others from having that experience because it was fairly unpleasant for me.

28:34.790 --> 28:47.150
I mean, also I'm happy that I did discover it during the bootcamp and not try and submit it and get a grant and then realize after I told even more people about it.

28:47.150 --> 28:47.150
So

28:51.490 --> 28:55.050
but yeah, it would have been better if I'd found that earlier for sure.

28:57.430 --> 28:58.730
Okay.

28:58.730 --> 29:00.910
Oh, and your question?

29:09.880 --> 29:32.160
So to be honest, most of my experiences with medical data where there's not really an issue of ever having too much data because there's so much regulation around medical data and rightly so, we don't want medical records just being available freely on the internet.

29:34.180 --> 29:39.480
So in medical research, it's more a problem of needing to get more data.

29:40.260 --> 29:46.980
If you have tons and tons of data, then okay, number one, I'm jealous.

29:46.980 --> 29:48.720
I want your data.

29:49.530 --> 29:51.460
I want that problem.

29:51.980 --> 30:10.320
But also, you can always take a subset of your data to do some exploratory analysis with and then maybe do a couple of different comparisons to make sure that that subset you took is representative of the entire data set.

30:10.620 --> 30:17.760
If you want to do something like pandas profiling, running that on a very large data set is going to take quite a while.

30:17.840 --> 30:27.880
So you could take a subset, do a couple of basic comparisons to make sure that they are similar and then run that subset through your EDA

30:31.290 --> 30:33.790
to do more extensive analysis.

30:33.790 --> 30:42.270
Some of the things like the correlation coefficients can take a while if you've got a very large data set.

30:44.790 --> 30:54.350
But definitely taking that step to do that comparison of, oh, hey, is this subset comparative to the whole of the data set?

30:55.850 --> 30:57.810
That's valuable.

31:04.180 --> 31:05.260
Okay.

31:05.520 --> 31:07.680
Any other questions?

31:10.120 --> 31:11.640
Okay.

31:11.860 --> 31:14.560
How would you handle data that has sparsely populated

31:17.850 --> 31:18.970
features?

31:18.970 --> 31:22.310
Sparsely populated features.

31:22.630 --> 31:51.490
So for that, probably the best way to deal with sparsely populated features is to look into how language processing is done, because that is a common problem in language processing, because they will vectorize word strings, or strings, and then vectorize it.

31:51.490 --> 31:55.410
So one hot encoding of each word that is in a sentence, for example.

31:55.410 --> 31:58.910
So there is a lot of very sparse data in NLP.

31:59.770 --> 32:02.290
So I'm not super familiar with NLP.

32:02.290 --> 32:03.710
I don't want to tell you for sure.

32:03.710 --> 32:05.010
I do this and that.

32:05.010 --> 32:15.530
But even if you're not dealing with language data, I would say look at some of the different processes that are used for NLP.

32:17.410 --> 32:32.270
And, yeah, one of the things that is used for NLP is combining some of the fields so that then you don't have as many different dimensions that are sparsely populated.

32:34.410 --> 32:37.870
And there's a bunch of different ways to do that.

32:37.870 --> 32:40.330
It's going to be specific to your data.

32:40.850 --> 32:41.770
So,

32:47.940 --> 32:49.960
okay.

32:52.340 --> 32:57.340
Well, I guess that's all the questions.

32:57.960 --> 33:01.620
Thank you for coming to my talk.

33:01.620 --> 33:10.140
And hopefully, if I have even prevented one person from making the same mistake that I did, then I am very happy.

33:11.160 --> 33:19.520
Because it's really frustrating to get far into a project and then realize, oh, hey, I missed a fundamental flaw in my data.

33:23.060 --> 33:23.600
Okay.

33:23.640 --> 33:24.000
Thank you.

