Tuesday, December 2, 2014

Papers - Proposals to Publishing - Pt 1

I recently published my third first-author paper. It is always a great feeling when a paper gets accepted. As an academic researcher, papers are the primary product of my job. Yes, I have a “real job”. I get paid real money to perform a real service and I output a real product. And yes, this is a point I am defensive about. But to get back on track, this particular paper came out of my graduate work, so it is especially gratifying that it is published.

Publishing a paper is a lot of work. I suppose it is easier for some people or for some disciplines, but I have found it usually to take a significant amount of time and effort. Here is an outline of research from the proposal to the finished paper.

First you have to get an idea for your research project. Then you have to write proposals for either or both funding and data. This process itself can be quite intimidating, but it is often exciting. Writing a proposal is a good time to read papers/research from others and get ideas about what to investigate on your own. I often learn a lot at this stage. After you submit the proposal, it will usually take a few months before the results from the review committee are released. At that point, all you can do is wait - or, more realistically, busy yourself with all the other things you have to do.

Once time/funding/data have been granted you can start your actual research program. Going observing is one of my favorite experiences in astronomy, and maybe I can write up a how-to on observing runs in the future. But let’s say you go observing and collect a bunch of data. Then you get to go home and start analyzing, right? Wrong!

First you have to prepare your data. In astronomy we call this “reducing the raw data”. In other fields you might call it “cleaning the data”. You have to get rid of artifacts from the instrument(s) and perform calibrations so that you can interpret your data properly. The amount of time this takes is highly variable. It depends on several factors including what kind of data you have (imaging, spectroscopy, IFU), and also on how familiar you are with the instrument. It can help to have a pre-made pipeline for data reduction - or it can frustrate the bananas out of you trying to figure out how to run it.

After the data are cleaned you are ready for analysis! This can include an intermediate step, which is referred to by data scientists as “data wrangling”. You want to compare your measurements to some previous study, or mix data from two different sources. Often times these data are in various formats or calibrated to different standards. In order to make everything uniform, you have to perform transformations and/or recalibrate the data.

The analysis will obviously vary depending on the research program, but it might include spectral or image modeling, statistical analysis of data, error and uncertainty estimations, lots and lots of plots, etc. And after many long hours of work you get some results! In some cases this might reduce down to a single point on a single plot, or the results might span many pages of plots.

After all that work, you are ready to begin writing your paper. Some ambitious sorts may have already begun writing as they perform the analysis, but we’ll get to all of that next time on . . . Arbitrary Notations!

Kyle D Hiner

Tuesday, October 28, 2014

A Tour of an Active Galactic Nucleus

In my last post I showed an image of an active galactic nucleus. AGN are some of the strangest objects in the universe. Let’s take a tour and see what we find.

Here on Earth, far, far away from even the nearest AGN, what we often see in the sky are single points of light - objects that look much like stars. But these objects have very strange spectra. Spreading the light out over all its colors and wavelengths (spectroscopy), we see that these objects are not like stars at all. They have spectra that are very different from stars. Many show radio emission - not like stars at all. This led to these objects being names quasars - a mashup of ‘quasi stellar radio sources’.

Let’s see what happens if we get closer to the quasar. Astronomers have a couple ways of looking at objects in more detail. We can ‘zoom-in’ by getting better angular resolution; and we can ‘go deeper’ to see faint features in the object. If we do this, we often see that the quasars are just one part of an entire galaxy. It’s amazing - what we saw before - just one point of light - is brighter than the entire galaxy where it resides! And because astronomers like to classify and re-classify objects, we get to rename them. No longer are they ‘quasi-stellar’ - they appear in the center of entire galaxies. It’s a nucleus of a galaxy and it’s doing something, so a better name would be Active Galactic Nucleus (or Nuclei if plural). I know, we’re so creative :P

If we look a little more closely at the host galaxies, we can find entire swaths of gas that are ionized in a strange way. The atoms in the gas get ionized (loose electrons) when energetic photons (light particles) smash into them, and that happens around bright stars. But this gas is ionized in a way that stars can’t make happen. So what is ionizing this gas in the galaxies? It all seems to come from the active nucleus, so let’s get closer to that.

It is practically impossible to resolve the nucleus of AGN, but we can learn a lot about it using other methods. If we could zoom in, we would see some really funky stuff.

We’d see a large toroidal structure of dark, dusty clouds. Because the dust is shaped in a torus, like a doughnut or a fat bike tire, it blocks our vision of the very center of the AGN along some lines of sight, but not others. We think the torus isn’t exactly smooth - it’s more likely made up of lots of individual clouds that travel around the nucleus itself. There just may be fewer of these clouds around the polar regions of the AGN, allowing more light to pass through more lines of sight.

Within the torus we find the “broad line region”, where clouds are orbiting something very massive and very small at the center. These clouds can travel with velocities up to ten thousand kilometers per second. By comparison, the International Space Station travels at about 7.7 kilometers per second (thanks google), and the ISS flies all the way around the Earth in just 90 minutes. So these “broad line clouds” are traveling about 1000 times faster than the ISS.

Getting closer still to the center we find a very bright, very hot disk of material. This is the source of all the light energy that is shinning from the AGN. It is so hot that it glows in the ultraviolet wavelength range of the light spectrum. Just think - your cooking pan gets hot, but doesn’t glow. You’ve probably seen videos of hot metal on the internet that is heated to the point that it glows a bright orange color. And surely you’ve seen fires with blue flames. Well this gas is so hot that it glows in the ultraviolet.

But why is all this gas so hot and traveling with such high velocities anyway? Answer: Within the very center of the hot gas disk, there is a black hole. Not just any black hole - a supermassive one. As I mentioned in my last post, supermassive black holes can be up to a billion times more massive than our sun. And that black hole is pulling very hard on all the gas and dust in the disk surrounding it. The material of the disk is actually falling down onto the black hole itself, making it even more massive.

And if you zoom back out and think about all that gas and dust in the host galaxy that is experiencing the radiation from the active nucleus, you might think that supermassive black hole can have a big effect on the host galaxy. You might wonder if it affects the galaxy’s ability to form stars, or if it affects the shape of the galaxy in some way. And then you might have to get a PhD in astronomy to figure it all out . . . :D

That’s the tour of the AGN, see you next time!

Friday, October 10, 2014

Astro Notations: The M-σ Relation

This week I thought I would discuss the M-σ relation.

The M-σ relation is a puzzle of modern astronomy. You see, it shouldn’t exist, or rather - we don’t understand why it exists. The M-σ relation is a correlation between the mass of supermassive black holes (M) and the velocity dispersion of the stars in the host galaxy (σ).

What the heck does that mean? I hear you asking. Well I’ll tell you.

First, the stellar velocity dispersion. This is a measurement of the range of velocities that stars have while flying around the galaxy. An observer from Earth sees some of the stars flying toward her, while others are flying away, and many are traveling with velocities somewhere in-between directly toward and directly away. The range of those velocities is what we call the dispersion, and it is directly determined by the amount of mass within the orbits of the stars.

Now what about the mass of the black holes? Well, black holes are really, really massive. Some are so massive, they are dubbed supermassive, and those supermassive black holes rest at the center of nearly every galaxy in the universe. The supermassive ones have more mass than a million of our Suns, and some have more mass than a billion. A billion. And that means that they have a lot of gravity. Mass leads to gravity, and gravity binds galaxies together.

But as big as supermassive black holes are, they are nothing compared to the galaxies in which they reside. And all the stars and all the gas and dust in the galaxy (what we call baryonic matter) is still small compared to the dark matter in the halos of the galaxies.

But before this turns into a discussion about the largest structures of the universe, let’s scale back to the supermassive black holes. While those black holes are massive enough to influence the orbits of the stars that are very nearby, they are not massive enough to influence the orbits of stars that are further away in the bulge of the host galaxy. The galaxy is so much bigger than the black hole, that the black hole can only influence - can only pull on - the stars closest to it. And that is precisely why the M-σ relation should not exist.

We measure the velocity dispersion of the galaxy, which should not be influenced by the black hole, and we measure the mass of the black hole. When we examine the measurements from many different galaxies, we find that the more massive the black hole is, the bigger the velocity dispersion is in the host galaxies. But the galaxies are so much bigger than the black holes - how do they "know" about the mass of the black hole at the center? Why does that relationship even exist?

There are a couple explanations that might connect the supermassive black holes to the host galaxies. One involves smashing galaxies together and merging the black holes within them. The other adds a layer of feedback from black hole growth into the host galaxy. Neither of these ideas are definitively confirmed yet, but there is evidence for both. I’ll leave that for another day.

For now, check out this cool artwork of an active galactic nucleus. What is it? Where did it come from? What is it doing? Although, I have discussed the Teacup AGN in a previous post, I'll keep discussing AGN in the future. I'll even discuss how we can use AGN to study the M-σ relation.

Sunday, September 28, 2014

But Wait . . . I’m Still an Astronomer

It’s been a few weeks since my last blog post; I am back in Chile, and there is a lot to discuss. But I’ll save you from the majority of it.

In September, I spent two weeks visiting Yale, which is a great place for astronomy. The department there is a good size, and there are always events to attend - talks, journal clubs, student/post-doc workshops, etc. This is pretty different from my previous experience at universities that had smaller departments. There is just a better sense of community once you get a department beyond some critical size.

The department also has a very positive attitude in regards to the academic culture. For me, the attitude of the community makes a world of difference. When I was a first-year graduate student I was surrounded by a lot of negativity. That continued into my second, and third year. It has taken me a very long time to work out of that. Having a more positive attitude about academia and astronomy gives me more motivation to keep working on things. It's a feeling I get when I attend astronomy meetings/conferences. And I’m pleased to report that I’m working on revising a paper that, hopefully, will get accepted for publication soon.

Also in the past month, I’ve had an undergraduate from UdeC emailing me requesting to work with me. I was hesitant at first, because I haven’t been sure where I would be in the near future. I decided to give him some reading, and now I am actually excited about giving him a project. We met in-person last week, and he said he wanted to work on some data. I think I have a mental sketch of a decent undergraduate project where he will get some experience and learn something useful. But now that I’ve taken him on as a student, it means more work and responsibility for me. This is all a good thing, because it means I continue to progress in my career.

I also had a conversation with my current faculty sponsor. We decided that it might make sense for me to apply to some faculty positions in order to help solve the Two-Body Problem. This is going to be very interesting; I’ve never applied to a faculty position before. After thinking about it for a couple days, I’ve convinced myself that I would make a good candidate, and I hope that my application(s) will reflect that.

For a while I have been pretty conflicted about how and where I might continue in my professional career. But since attending the data science workshop in August (a very positive experience) and since visiting Yale for another two weeks (another positive experience), I am a little less worried about where I may end up. I feel a renewed attitude, and I expect that whatever job/career opportunities arise will be rewarding.

Monday, September 1, 2014

Data Science is Not Magic

We’re at the end of August and close to the end of the S2DS program that I’ve been attending in London. The program has been great, and I have learned much more in a month than I would have simply by investigating on my own. I have had a good team, and I feel like we accomplished something useful.

As I mentioned in previous posts, my team is focused on unifying offline shopping data (specifically from grocery stores) and online data from facebook. I won’t tell you the actual results that we found - for that you’ll have to sit in on our presentation on Tuesday afternoon. But, I will describe some of the methods that we’ve used.

We investigated whether users who were similar to one another in one data set could be recovered by looking at their habits in the other data set. This is referred to as a Look-Alike Engine. We went about it by creating similarity matrices that assign a score to each user-pair based on how similar they are to one another using the input data. For shopping habits that means comparing users who bought similar items. For the social network data that means comparing users who have liked similar content.

There are a couple of different metrics one can use to determine similarity between two sets. A simple metric is the Jaccard Index, defined as the number of items in common between two sets divided by the number of total items. We decided that this scoring metric was not producing the results that we wanted. If two users each have missing data, then they are scored as similar. This somewhat depends on how the data sets are constructed and how the code runs, but it can very easily count a ‘0’ in one user’s data as the same as a ‘0’ in another user’s data. We might not want that in the end.

Another metric is the ‘cosine’ similarity score. This requires one to vectorize the data in a consistent way, because the cosine metric is defined as the dot product of the two user’s data normalized by the product of the magnitudes. Recall that the dot product can be written: A dot B = A*B*cosine(theta). So this method simply calculates the value of cosine(theta). At first I found this concept to be slightly difficult to apply to “shopping habits” and “likes” from facebook. However, it is fairly straightforward once you organize the data into a vector.

For example, with the movie ‘likes’ from facebook, we created an array/vector where every element is a possible movie title. We populated the array/vector with a value of 1 if the user ‘likes’ the title, or a zero if the user has not ‘liked’ that title. Then we had an array with all possible dimensions (movie titles) for every user. The cosine metric is simply the dot product of the arrays. For our data this meant that if two users did not declare a ‘like’ for a given movie, then they would not be considered similar - we don’t actually know if they liked the movie or if they didn’t like it. Not declaring a preference is not the same as dis-liking a thing. 

Once we measured the similarity between users with a given metric, we organized the data into a large similarity matrix. This matrix simply contained all the similarity scores for every user pair, and allowed us to find the users who are most similar to one another.

Finally, we could test whether or not users who were similar in one data set were also similar in another. We selected the most similar users in one set to use as a control sample. Then in the other set we selected the most similar users and compared the two resulting selections of users to see how many we recalled and to what precision.

Recall and precision are two metrics by which we measured the ability of our method to find similar users. Recall is defined as the number of true positives in the set divided by the total number we could possibly find (the true positives plus false negatives). Precision is defined as the number of true positives divided by the number you’ve actually selected (true positives plus false positives). Depending on your application you might want to sacrifice some precision in order to obtain better recall, or vice versa.

Lastly, in order to determine if our method was actually any good, we conducted a simple monte-carlo simulation where we randomly selected users from the experimental data set to compare to the control set. In the end, we were able to determine the recall and precision for random selections and for our selections using the similarity scores as a function of the number of users in the sample selection.

Now if there actually is a correlation between people’s shopping habits and the movies and TV shows that they like on facebook, then we expect to more accurately select users from our similarity matrix than we would just by selecting at random. As I said, I won’t tell you the result, but you can hazard a guess on your own.

Coming up we will present our results to other participants and partner companies on Tuesday afternoon. Then on Wednesday afternoon there will be a job fair where will will be able to discuss opportunities with the partner companies.

As I said, I have found this experience very useful, and now I have a definite project that I can point to - with results - that shows what I can do as a data scientist. I am hoping that I will be able to develop more skills in data science and machine learning techniques as I move forward with my career.

Kyle D Hiner

Saturday, August 16, 2014

S2DS and python, etc. - Pt 2

Week 2 of S2DS is down, and this week we began working full-time on our projects. As I mentioned before, my team has some proprietary data to work with. We’ll be combining offline shopping habits with online social network preferences to try to build models about consumer demographics and behaviors. As of now we’ve just been looking at the data to get a feel for what is in there, and we’ve started to brainstorm some ideas about what we can do with them.

Our team only has three members. One is working with the offline data, while I have partnered with the other to work with our Facebook data. We are currently using a python package called GraphLab to do some modeling and analysis of the data. To begin, we wanted to see if we could create a movie recommendation engine based on the movies that users had ‘liked’ on their Facebook profiles.

The GraphLab tool makes implementing machine learning techniques so stream-lined and black-boxed that it is almost trivial. Almost. And, actually, as a scientist, that is extraordinarily frustrating. I’m dying to get into the details about the algorithms and theory behind this stuff. That, as you might expect, is non-trivial. At a basic level, you don’t need to know all that stuff, but if you want to understand what is going on and how best to use the tools, you had better know it. As a scientist I can’t stand using a tool if I don’t know how it works. I can’t defend my work if I don’t know what it is that I actually did - that is fundamental to science. The good news is that everyone here understands that.

The bad news is that I still only get a couple weeks to dive into all of it. It turns out that industry/business works on a much shorter timescales than academia. That’s what we are told, at least. For now, I am trying to learn as much as possible. But, as with any new endeavor, you can only learn so much in a short amount of time. I know I won’t be an expert after this program, but I will have a great deal more knowledge. (Aside: One thing I learned from working in the CA Senate - if you know one thing about anything that no one else knows, then you are the expert in the room.)

I’ve been getting more comfortable with programming in python now. After taking the Udacity courses and playing around on my own, I feel like I can understand many of the basic structures that python is using. Even though I don’t know a lot right now, I am more confident in my ability to quickly learn python and its various packages (pandas, numpy, scipy, graphlab, etc.) now that I have more experience with them - and that is going to be really important going forward in my career.

At the end of this week, we (my S2DS team and I) have created a basic recommendation function for movies based on people’s Facebook likes. Almost immediately I’ve learned a good lesson about testing code. As I mentioned above, we are using a python package that works a lot like a black-box. So, to figure out how it works, we have to test various inputs and see if their output makes sense. For example, we’ve tried generating fake users that are copies of our real users to see if we get consistent recommendations for the invented data. At first, we didn’t, which indicated we were doing something wrong. So, the value of testing code is very high. Our background in science has given us this attention to systematics and details, so that we understand what it is exactly that we are doing, and we can produce consistent results.

We are planning to expand on our work by increasing complexity. We would like to incorporate other variables like music and book preferences as well. Hopefully we’ll be able to take in a given set of music preferences and recommend both additional music and movies based on other users’ preferences. Collectively this is sometimes referred to as a look-alike algorithm.

A lot of the work that I’ve just described is just exploratory. Next week we are going to have to focus some more on combining our data sets and doing some real hypothesis testing. In the end, we are hoping to develop an/some algorithm(s) that will actually be useful. I think I will be a very strong candidate for data science jobs by the end of the program.
 
Kyle D Hiner
Studious data scientist

Sunday, August 10, 2014

Science to Data Science, Pt 1

I’ve traveled to London for a 5-week program on data science techniques. The program is called S2DS (Science to Data Science), and so far it has been really great. There are about 80 participants, who are divided into small (~4 person) teams. Each team partners with a company for the month in order to complete a project that is relevant to the business and serves to teach the participant valuable data science techniques. I actually have an some open questions regarding intellectual property, but glossing over that . . .

We’ve just completed the first week, and we’ve covered a lot of material. It is going pretty fast, and I feel like I’ve been here a while already even though I still haven’t met all of the participants. The lectures have been rather superficial. One simply cannot realistically give an substantial introduction into any of these topics in the small time frames that we have. You can’t learn python in 2 hours, similar for Hadoop, SQL, and machine learning. That said, the introductory lectures are valuable. I am still trying to grasp all the concepts, but hopefully I will get much a more detailed experience as the program progresses.

The thing I am most excited about in this program is expanding my skill set. I’ve always been somewhat uncomfortable with my level of competency with various tasks and programming. I’ve previously written about trying to learn more python, including through the Udacity online coursework. This workshop will really be a time that I can dive into some new things that are applicable both in and outside of astronomy.

So far we have had lectures on good coding practices, Hadoop, Database introduction, SQL, NoSQL, statistics, R, natural language processing, machine learning techniques, and even some more business oriented seminars on economics and marketing. Meanwhile, we’ve also met with our project mentors to outline the project scope for our group work over the next few weeks. I am most excited to dive deeper into the machine learning techniques, because I feel like those are most useful across a wide variety of potential future jobs.

For my team’s project, we’ll be doing a lot of machine learning and trying to do some predictive analysis. The data set that we are getting access to is proprietary, so I’m not allowed to share information about it. But, generally, we’ll be working with customer data to predict purchasing habits and/or demographics of the customer. It is kind of crazy to think about the amount of information people are willingly (or unwittingly) handing over to various companies. Regardless, I am looking forward to learning the techniques of the project and potentially applying them in academia or other industries.

Kyle D Hiner
Data scientist?