Tommy Blanchardhttps://tommyblanchard.com/2020-11-07T00:00:00-05:00Data Bullshit and Data Illiteracy2020-11-07T00:00:00-05:002020-11-07T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2020-11-07:/data-bullshit-and-data-illiteracy<p>Something I see too often in both immature data science practitioners and data science teams is overcomplication. The desire to use complex neural networks when there isn't enough data to support them, or wanting to include all kinds of variables that don't actually add predictive value.</p>
<p>Ironically, using a simple …</p><p>Something I see too often in both immature data science practitioners and data science teams is overcomplication. The desire to use complex neural networks when there isn't enough data to support them, or wanting to include all kinds of variables that don't actually add predictive value.</p>
<p>Ironically, using a simple solution is often a sign of sophistication. The experienced data scientists I know will know when complexity is warranted, but at the end of the day, simple often produces the optimal point for the effort:reward ratio.</p>
<p>For inexperienced data practitioners, the reason for unnecessary complexity is obvious: it's a combination of wanting to demonstrate you know complex methods, and the lack of experience to know when enough is enough. That can be fine when building up a portfolio and gaining experience.</p>
<p>In immature data science teams, the issue is usually a more serious problem. It leads to what I'm calling Data Bullshit: data science projects that are overly complicated for the sake of sounding complicated.</p>
<p><img alt="Linear Regression" src="https://tommyblanchard.com/images/lin.png"></p>
<h2>Data Naivete Leads to Perverse Incentives</h2>
<p>One of my previous bosses would always brag about how the models our team was making "included thousands of variables". This was true. What he didn't say was that we could get the same model performance with a tiny fraction of those variables. The additional variables were just bloat, which caused complications in extracting all of the data elements, unnecessary complexities in the code making it harder to maintain, not to mention added literally months to development time.</p>
<p>There was a ton of low-hanging fruit, places we could be adding tremendous value with small, properly targeted projects, but none of them sounded spectacular enough. It was easier to get a spotlight if he claimed we were doing things that sounded super sophisticated, that involved skills that no other team had, even if the simple stuff would have worked just as well.</p>
<p>This is a pattern I see repeated: a leader who only knows enough to be dangerous, a data naive organization where people can't tell what's bullshit, and there are incentives to justify a data science team because of their expensive data science salaries. </p>
<p>Widespread data naivete in an organization, where people are wowed by the talk of statistical models and machine learning sounds like magic, results in these perverse incentives - especially when there is data naivete at the executive level. If the people at the top don't know how to smell out data bullshit, they're going to be wowed by the complexity of the solution, and incorrectly think the complexity was required, justifying the expensive team. In reality, a simpler solution would be better and more quickly implemented - but those solutions are too easy to explain, and therefore don't show how the data science team is "special" for having come up with it (even though it often takes more experience to spot where a simple solution can be used than it takes to throw the kitchen sink at a problem).</p>
<p>This trend of unnecessarily overly complicated methods reached an extreme at this organization when one executive suggested we capture sound data at some of our sites to see if there were patterns between compliance issues and sound features.</p>
<p>This was going to be a huge logistical nightmare - literally planting recording hardware in thousands of sites, building data pipelines to collect and process the data, dealing with potential legal issues of placing recording devices, collecting data for months just to get a handful of positive data points, etc. There was going to be so much variance in the data due to dumb factors like where the device was placed in a site, and it was clear to every data literate person that there was no way the data was going to be helpful for this classification.</p>
<p>More importantly, there were plenty of other ways of getting more relevant data that wasn't currently being used - one of the big things they wanted to look for in the noise data was the sounding of alarms, but we could just pull alarm triggers more directly without needing any hardware! But none of that was good enough, because this executive thought this idea would sound good. And it did - he gave talks about this idea and drew a lot of attention for his innovative thinking.</p>
<p>I was one of two data scientists on the team assigned to this project. We both knew it was doomed to failure but couldn't convince the data illiterate leadership. It lowered morale and took a huge amount of our time and resources. I ended up leaving the company, and was happy to wash my hands of the project.</p>
<h2>Conclusion</h2>
<p>Data illiteracy leads to data bullshit. Leadership in a company using data science needs either to be data literate, or be willing to listen to those that are. Otherwise, you're going to end up with time-wasting projects, lose your best data scientists, and the projects that are completed are going to be overly complicated messes.</p>Data Science Bootcamps - What They Can and Can't Do2020-10-30T00:00:00-04:002020-10-30T00:00:00-04:00Tommy Blanchardtag:tommyblanchard.com,2020-10-30:/data-science-bootcamps-what-they-can-and-cant-do<p>It's pretty common that I get asked if a data science bootcamp (or a part-time Master's program, which for the most part I put in the same category) is worth it. Just to get my credentials out of the way as I weigh in: I have taught for a couple …</p><p>It's pretty common that I get asked if a data science bootcamp (or a part-time Master's program, which for the most part I put in the same category) is worth it. Just to get my credentials out of the way as I weigh in: I have taught for a couple of Master's programs and an online bootcamp, as well as having gone through a bootcamp myself when I was making the transition into data science.</p>
<p>I've <a href="http://tommyblanchard.com/should-i-do-a-data-science-bootcamp">written some thoughts on bootcamps in the past</a>. The trouble is, it's a hard question to give a single general answer for. Everyone has different skills and different goals. However, I think one thing is pretty constant: bootcamps tend to overpromise to those without a highly technical background. If you're not already most of the way there, a bootcamp won't make you a data scientist.</p>
<h2>Different starting points</h2>
<p>Let me give a few thoughts on bootcamps for people at different stages in their data science learning:</p>
<p><strong>Starting from scratch</strong>: Let me be blunt. If you have little to no experience with programming, data, or statistics, a 6 month part-time program isn't going to make you a data scientist. You might learn some cool skills, and if you put in the work you might land an entry-level data analyst position. Data science positions are generally considered pretty senior, or at least highly skilled. A short program simply isn't enough time to gain the levels of competency expected in the foundational skills.</p>
<p><strong>Academic backgrounds</strong>: I think those coming from a quantitative academic background are some of the best candidates for bootcamps (full disclosure, this was my background). Most quantitative academics have passable coding skills, know statistics, and have experience working with and telling stories about data. Bootcamps give a taste of the breadth of tools out there, some practice using some of the popular tools in data science, and some coding practice. Generally, people with this kind of background are the ones I see most reliably go on to actually get data science positions following a bootcamp. As an added bonus, there are programs like Data Incubator and Insight that are free for promising candidates coming from academic backgrounds. That said, many make the transition without needing a bootcamp, so while I think they can be useful, it might be worth getting a sense for your prospects on the job market without one first.</p>
<p><strong>Software engineering background</strong>: Honestly, I don't see many software engineers taking bootcamps. I think that makes sense - for the most part, if you're already working in tech, you know the space and the transition isn't as big as those coming from academia. You probably have the skills to learn from all of the great free online resources. There is a huge need for data scientists who have serious coding skills, and often people going this route end up with the title "machine learning engineer". That said, for a software engineer looking to get some background in data science and want more of a structured curriculum, I think a bootcamp could be a good way of doing it, since they will provide the statistics and machine learning background that they probably lack, but it's definitely not a necessity.</p>
<p><strong>Data analysts</strong>: Bootcamps can certainly "level up" your data skills. Depending on where your skills are now, that could be a great way of trying to either work your way into a more senior data analyst position, or try to make the jump to data scientist. But it depends a lot on what your current role entails - if you haven't used Python at all, and mostly just use Tableau, a bootcamp is going to introduce you to things and are unlikely to be enough to get you to make the leap to data scientist. It also might not be useful for your current role if there's no opportunities for using machine learning. If you see places for using data science skills in your current role and the only thing holding you back is lack of your own skills, a part-time bootcamp can be super useful.</p>
<p>Boot camps and other part time programs are great for introducing you to the wide range of data science tools out there. They are not enough on their own to make you an expert, and they are not transformative. If you're just curious about data science, there are a ton of online resources for learning. If you want to do something more directed and don't have serious financial constraints, a bootcamp can be a reasonable option. Just don't go in expecting that a bootcamp will take you from 0 to 6-figure data scientist in a few months.</p>Decision Theory and Captain Picard's Leadership2020-02-02T00:00:00-05:002020-02-02T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2020-02-02:/decision-theory-and-captain-picards-leadership<p>With the start of <em>Star Trek: Picard</em> recently, I've been thinking about one of the big impacts Captain Picard has had on my life (as a lifelong geek). There is an episode of <em>Star Trek: The Next Generation</em> called "<em>Attached</em>", where Doctor Crusher and Captain Picard become mind-linked while trapped …</p><p>With the start of <em>Star Trek: Picard</em> recently, I've been thinking about one of the big impacts Captain Picard has had on my life (as a lifelong geek). There is an episode of <em>Star Trek: The Next Generation</em> called "<em>Attached</em>", where Doctor Crusher and Captain Picard become mind-linked while trapped on a strange planet. The pair need to start moving on foot through the wilderness, but Crusher has no idea which direction they should start hiking in. Picard simply says "This way," and starts walking. Crusher, able to read Picard's thoughts (because, mind-link) is shocked to realize that Picard has no better idea than she does and is just arbitrarily choosing a direction, but acting confidently about it.</p>
<p>Crusher takes this to say something deep about one of Picard's traits that make him an effective leader: his ability to act confident despite uncertainty. But there's a more general principle here that comes from normative decision theory.</p>
<p>The decision Picard is making is between walking in different directions, without having any reason to prefer one over the other. Time is of the essense, and the morale of his crew (in this case, only Crusher) is important. Given the facts, Picard's real choice isn't what direction to walk in, but whether it's worth it to stop and consider before making a decision. Given that all directions seem the same, and there's no information to be gained, the decision <em>should</em> be as quick and confident as Picard made it. The potential payoffs and risks of each option is the same. There is a cost to stopping to consider: it takes time, and it can lower morale among crew because he is giving an indication of uncertainty. Picard therefore should do what he did: make the decision of which direction to go based on a mental coin flip. He's able to act confidently because he actually has made the best choice he could have: the choice to not waste resources deliberating.</p>
<p>When is the best course of action to just arbitrarily choose an option and get on with it? The value to be gained from stopping to think about a decision rather than just using a mental coin-flip is proportional to the difference in the value of the options. If choosing between $20 and $15, the value of being deliberate and not just tossing a coin is $2.50 ($5, cut in half since if you flipped a coin half the time you would choose the $20). When put in terms of money, decisions are easy because we just look at what number is larger. In real life, we have options that we might not explicitly put a number on, but we have some subjective valuation of that's useful to think of as a number (e.g. the amount you would pay to take that option). Similarly, you can imagine putting a price on how much you would pay to get rid of the anxiety of the decision and have your time back. Deliberate decisions have a cost.</p>
<p>If choosing between an obviously good option (one you would pay $100 for) and an obviously bad (one you would pay $20 to <em>avoid</em>), there's quite a bit of value to making a deliberate choice. However, in most cases that choice will be obvious and therefore require little deliberation. High payoff and low cost since the deliberation will be quick, so you should definitely actually consciously choose. It isn't hard and doesn't take much deliberation to decide you would prefer to get a free fancy dinner over having smelly garbage dumped all over your kitchen. If the values are closer together, like choosing between two high-end restaurants, the decision might be harder. Is one worth $105 to you and the other worth only $104? It might be hard to distinguish your true valuations of the two options and which is higher because they are so close. But because they are close, the value of a deliberate choice is diminished -- you'll end up with a good dinner regardless, and the difference in value to you might only be a couple of dollars. Choosing between two very different options, like a new pair of jeans and a high-end meal might also be difficult, but the more difficult it seems, the closer the values of those options must be to you, so the less it matters what you choose. Again, you'll be happy with either.</p>
<p>If there's low or no value to a deliberate choice, the costs of making a deliberate choice can easily outweigh the value of having made the deliberate choice. Ironically, these are also the situations in which we're most likely to be struck with indecisiveness, simply because it isn't so easy to distinguish the values of the options. We can go back and forth, imagining taking one option and then the other, and being unsure which we value more. If the options are complicated, it might be worth it to give the decision a bit of thought and make sure you're not missing something obvious, but beyond that you're facing the same situation as Picard: two options very close in value, and the real decision is how long you're going to sit and think about it. The longer you think about it, the bigger the cost -- in terms of time, the anxiety of making the decision, the mental effort, etc. Since the options are close in value, it's very easy for these costs to outweigh the benefit of choosing the better option (if there even is one). Even with large life decisions, if a large difference in value doesn't appear after thinking about it for a day, is it worth being anxious and uncertain about it for a week if the value difference between them is so indistinguishable? Likely not.</p>
<p>When I face a decision where there isn't an obvious right answer, especially when the stakes are low, I often think of Picard and make the decision quick. I'm put at ease knowing that by just arbitrarily picking an option, I'm actually making the right choice -- the choice to not pay the price of being indecisive.</p>Reboot2020-01-23T00:00:00-05:002020-01-23T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2020-01-23:/reboot<p>A lot has changed since I started this website and blog.</p>
<p>When I started, I was just starting my career as a data scientist. I was looking for an outlet for posting projects so I could build up a bit of a portfolio and online presence. This was a career-building …</p><p>A lot has changed since I started this website and blog.</p>
<p>When I started, I was just starting my career as a data scientist. I was looking for an outlet for posting projects so I could build up a bit of a portfolio and online presence. This was a career-building move. (I also had a bunch of pent-up thoughts about leaving academia that I felt I needed a venue for).</p>
<p>It wasn't long before I got tired of doing data science during the day at my job, and in the evening for this site, even if the projects I was doing for this site were pretty fun, light projects. Instead, I transitioned to making this site mostly a place for me to post thoughts about data science and connect with the data science community. This was easier on me, allowed me to have my online presence, and it was rewarding to have my stuff discussed on Reddit, have people comment here, or have people reach out to me directly.</p>
<p>My main source of readership was https://www.reddit.com/r/datascience/. The subreddit was at the time plagued with posts about people asking how to get a data science job, which seemed like 95% of the content on the subreddit. But one of the moderators seems to have decided that percentage was too low and started to clamp down on people posting their blogs, and removed one of my posts (which had already generated a bunch of discussion) and told me not to post another. So down my post went, and with it my primary audience.</p>
<p>It was hard to motivate continuing to write posts after that. Why write posts to enter a discussion with the data science community when there was no venue for connecting the community to what I was writing? So this site went dormant.</p>
<p>Nowadays, I'm far enough along in my career that I don't think my web presence is going to matter too much one way or another. So I'm doing a bit of a reboot, and making this less of a (poor attempt at) a professional blog and more of whatever I feel like writing about. I'll probably still write about data science stuff, but I'm not limiting myself to that. We'll see what happens!</p>The Data Incubator Unofficial Frequently Asked Questions2018-05-30T00:00:00-04:002018-05-30T00:00:00-04:00Tommy Blanchardtag:tommyblanchard.com,2018-05-30:/the-data-incubator-unofficial-frequently-asked-questions<p>About a year ago I wrote <a href="http://tommyblanchard.com/review-of-the-data-incubator-data-science-bootcamp">a review</a> of <a href="http://www.thedataincubator.com/fellowship.html?ref=ce730ff6c5d6&ch=ge">The Data Incubator</a> (updated review is <a href="http://tommyblanchard.com/an-updated-review-of-the-data-incubator-data-science-bootcamp">here</a>). I always know when the Data Incubator application season is here because I always get a few people who have found my blog reaching out with questions about the process. I decided to put …</p><p>About a year ago I wrote <a href="http://tommyblanchard.com/review-of-the-data-incubator-data-science-bootcamp">a review</a> of <a href="http://www.thedataincubator.com/fellowship.html?ref=ce730ff6c5d6&ch=ge">The Data Incubator</a> (updated review is <a href="http://tommyblanchard.com/an-updated-review-of-the-data-incubator-data-science-bootcamp">here</a>). I always know when the Data Incubator application season is here because I always get a few people who have found my blog reaching out with questions about the process. I decided to put together a short list of some of the most common questions I get asked. </p>
<h2>Should I do the program?</h2>
<p>The program has pros and cons. For some people I think the program is great. It provides an overview of a lot of data science topics and practice with concepts. However, it’s probably not as useful for people weak in programming or those that hope it will help them network or get them a job in a specific area/industry. In general, if you’re not accepted as a Fellow (tuition-free), I think it generally isn’t worth it. You can read more about my thoughts on the program in my review of it.</p>
<h2>How good is the network of hiring partners?</h2>
<p>Much worse than you would expect from the slick marketing. Around the areas the program is located, especially NYC and the Bay Area, there are a fair number of hiring partners. However, the types of industries are pretty limited. Don't expect to be able to work in gaming or non-profit, those jobs are extremely rare despite being listed alongside industries with way more hiring partners (like finance). If you have strong geographic constraints, don’t expect much from the program’s network.</p>
<h2>What is the admission process like?</h2>
<p>It’s long and involved, especially compared to other programs like Insight. There are three stages to it. First there is an initial web application that is just a typical application asking for relevant background, education, why you want to do the program, where you could work, etc. If you make it through that stage, you are considered a semi-finalist, where there are some more involved challenges thrown at you (see below for more info). Finally there is the finalist stage, where you go through a quick interview.</p>
<h2>What are the semi-finalist challenges like?</h2>
<p>The hard part of the semi-finalist challenges are a couple of tough programming questions. You have a limited amount of time to do them (~4 days), with no flexibility about the schedule for doing them. Being very comfortable with Python will help a huge amount here. For a sense of the kinds of questions they like to ask, check out their <a href="https://blog.thedataincubator.com/2015/01/a-cs-degree-for-data-science-part-i-efficient-numerical-computation/">blog post on efficient numerical computation</a>, they love asking you to make use of the concepts there.</p>
<p>In addition to the programming challenges, you’ll be asked to come up with an idea for your capstone project and submit a short video describing it. They also want a preliminary data visualization, and like for it to be interactive (best is if it’s hosted on Heroku, <a href="https://blog.thedataincubator.com/2015/09/painlessly-deploying-data-apps-with-bokeh-flask-and-heroku/">see their post on getting set up on Heroku</a>).</p>
<h2>I'm a finalist, what is the interview like?</h2>
<p>The final interview is pretty superficial. It will happen with a group of other candidates. You’ll have 2 minutes (seriously, that’s all) to pitch your project and show a couple of preliminary analyses. The other candidates will have a chance to ask one or two questions. Then it will move on to the next candidate. The interviewers won’t ask any technical questions, but will ask things about where you’re willing to work. For the whole group of 4-6 candidates, the interview will only be 30 minutes.</p>
<h2>What should I do for my capstone project?</h2>
<p>It’s nice but absolutely not necessary to have a project dealing with data in the industry you would like to work in. Don’t be overly ambitious, make sure you can get the data pretty easily, and just plan to build a predictive model of some kind. For your video and initial data analysis, keep it simple, all you’re doing is showing that your idea is feasible and interesting. When you start working on your project, having a nice presentation/app is usually more important than building a well performing model.</p>
<p>That's all for now. Feel free to reach out with any additional questions not asked here, I would be happy to add to the list!</p>An Updated Review of The Data Incubator Data Science Bootcamp2018-05-29T00:00:00-04:002018-05-29T00:00:00-04:00Tommy Blanchardtag:tommyblanchard.com,2018-05-29:/an-updated-review-of-the-data-incubator-data-science-bootcamp<p>A while ago, I wrote <a href="http://tommyblanchard.com/review-of-the-data-incubator-data-science-bootcamp">a review</a> of <a href="http://www.thedataincubator.com/fellowship.html?ref=ce730ff6c5d6&ch=ge">The Data Incubator</a> based on my experience in the program. Since then, it’s been the most common reason people reach out to me. I’ve had people reach out to tell me how the program went for them, to ask me …</p><p>A while ago, I wrote <a href="http://tommyblanchard.com/review-of-the-data-incubator-data-science-bootcamp">a review</a> of <a href="http://www.thedataincubator.com/fellowship.html?ref=ce730ff6c5d6&ch=ge">The Data Incubator</a> based on my experience in the program. Since then, it’s been the most common reason people reach out to me. I’ve had people reach out to tell me how the program went for them, to ask me questions about the program, or to ask advice. Since this happens so frequently, and my review is a bit out of date now, I figured I would write an updated version, taking into account what has changed (and what hasn’t) according to those who have been through the program after me. I've also written <a href="http://tommyblanchard.com/the-data-incubator-unofficial-frequently-asked-questions">a collection of the most common questions I get asked about the program, with my answers</a>.</p>
<h2>Curriculum</h2>
<p>The curriculum is the right level of breadth. A lot of topics are covered, but with enough depth that you get a reasonable introduction to them. The topics covered are pretty standard and there are no major omissions, though arguably it is a bit weak on statistics (it focuses much more on coding skills). It’s a good overview of the broad strokes of data science, which I think is the benefit of bootcamps like this.</p>
<h2>Lectures</h2>
<p>While the topics covered are good, the lectures themselves are lacking. Many of the lectures are taught remotely with very poor A/V equipment, making it difficult and annoying to interact with the instructor. The lecture quality varies a lot, but tends to not be very useful. I and many others tended to use lecture time for eating lunch so it wasn’t a total waste.</p>
<h2>Assignments</h2>
<p>The assignments are possibly the greatest strength of the program. While there are annoyances with the automated marking, the assignments have the great benefit of forcing you to get your hands dirty with each topic and get some experience. This, in my opinion, is the benefit of The Data Incubator over it’s main competitor, <a href="https://www.insightdatascience.com/">Insight</a>, which essentially just gives a list of topics and resources and leaves it to the fellows to learn and get experience.</p>
<h2>Coding exercises</h2>
<p>Every morning in the program starts with coding exercises, programming problems that you might get as a technical exercise at a job interview. I found these extremely useful as they made me much more confident in Python. Opinions differ though, some people found them frustrating and discouraging. As these challenges are not unlike a lot of the ones you’ll see as the technical part of a job interview, I tend to think they are valuable.</p>
<h2>Job hunt support</h2>
<p>In general, I thought there was good written content and advice on how to interview and build a data science resume. However, the lectures on these topics were significantly less useful. The alumni network is very weak, giving few ‘ins’ and networking opportunities from the program. In comparison, <a href="https://www.insightdatascience.com/">Insight</a> ends up being very good at this, and fellows in that program end up with a strong network and community after completing the program.
The hiring partners, the companies that hire from the bootcamp, are fewer than you would expect from the slick advertising, and are much less diverse than you would think (fewer industries and locations). This is a major issue, as some people from my cohort dropped out after seeing how few opportunities there were in the area they wanted to work in.</p>
<h2>Organizational culture</h2>
<p>I’ve heard mixed opinions on this, but the majority of people I’ve talked to agree that the culture of the organization feels a bit off. The demeanor of some career advisement staff (to name names, Alyssa Thomas, director of program experience and career advising) can be very condescending. In addition to this, fellows are punished for not completing their assignments by being cut off from the portal to interact with employers, and this punishment is wielded pretty arbitrarily to punish fellow behavior they don’t like (such as turning down a bad job offer). A number of other factors make the program feel much less welcoming an environment, which is too bad. I would love to love <a href="http://www.thedataincubator.com/fellowship.html?ref=ce730ff6c5d6&ch=ge">The Data Incubator</a>, but instead was left with mixed feelings about it, largely because the culture led to a mixed experience.</p>
<h2>Final thoughts</h2>
<p>Overall the program is good for what it is. The curriculum and assignments are solid, and I learned a lot from the program as well as the other fellows. The program has problems, but all programs do. I wouldn’t full-heartedly endorse the program, but I think it is a good way to go for a lot of people looking to break into data science, especially those coming from academia.</p>Implementing data science in healthcare2018-05-15T00:00:00-04:002018-05-15T00:00:00-04:00Tommy Blanchardtag:tommyblanchard.com,2018-05-15:/implementing-data-science-in-healthcare<p>I recently wrote a blogpost for datascience.com, which you can find <a href="https://www.datascience.com/blog/data-science-in-healthcare">here</a>. It’s about some of the lessons I’ve learned on actually implementing data science projects in healthcare for clinicians. It isn’t about the technical side of things, but the challenges of actually making sure your …</p><p>I recently wrote a blogpost for datascience.com, which you can find <a href="https://www.datascience.com/blog/data-science-in-healthcare">here</a>. It’s about some of the lessons I’ve learned on actually implementing data science projects in healthcare for clinicians. It isn’t about the technical side of things, but the challenges of actually making sure your project is actually useful and fits into the workflows of clinicians. </p>Automated machine learning is coming... and it won't matter2018-04-04T00:00:00-04:002018-04-04T00:00:00-04:00Tommy Blanchardtag:tommyblanchard.com,2018-04-04:/automated-machine-learning-is-coming-and-it-wont-matter<p>Recently, I’ve been seeing a lot of services and products advertising automation of machine learning. <a href="https://www.datarobot.com/">Data Robot</a> and <a href="https://www.h2o.ai/">H2O.ai</a> offer platforms that allow the creation of machine learning algorithms in point-and-click interfaces. They’ll even do the feature engineering for you! This functionality, or something like it, is …</p><p>Recently, I’ve been seeing a lot of services and products advertising automation of machine learning. <a href="https://www.datarobot.com/">Data Robot</a> and <a href="https://www.h2o.ai/">H2O.ai</a> offer platforms that allow the creation of machine learning algorithms in point-and-click interfaces. They’ll even do the feature engineering for you! This functionality, or something like it, is slowly being built into various tools and programs. They promise to automate the creation of the whole machine learning pipeline - from feature transformations, hyperparameter tuning, to model selection. There are open-source tools that do much the same things (like <a href="https://github.com/EpistasisLab/tpot">TPOT</a>, a cool module I love the idea of but can never get to actually work on a data set that isn’t trivially small).</p>
<p>Right now, these tools mostly aren’t great and/or are absurdly expensive (for the cost of a subscription to Data Robot, you can employ a full-time data scientist). But I have no doubt that soon tools will exist that will completely take care of the model/hyperparameter/feature-transformation process. </p>
<p>I’ve had people ask me if I’m worried about my job security as a data scientist. No, I am not. I can’t wait until these tools are there and open source so I can just type “import machinelearn” and just have it do the stupid hyperparameter optimization and I can get on with the hard part of the job.</p>
<p>When I get data to the point where it could conceivably be ingested by one of these tools, the problem is basically done. At that point I need to run a bit of code to do the grid search and find a reasonably decent model and tune the hyperparameters. Hell, if I just ran XGBoost with the default parameters at this point it would usually be almost as good as I am ever going to get it anyways. Doing the extra work of tuning things a bit more is only worth it because it’s relatively easy, and you very quickly get to the point of diminishing returns (unless you’re in a Kaggle competition, where even diminished returns might take you from 10th place to 1st so you milk every tiny incremental increase in accuracy you can).</p>
<p>Once you have your data in the format where you could make a Kaggle competition out of it, you’ve done the hard part. I would love it if at that point I just ran a single function that did a well optimized search that was way more thorough than my typical grid searches, and also explored some different feature transformations. Maybe my models would do marginally better, and I would save myself a few minutes writing the code. It would be nice. But if it would put you out of a job, maybe you should be seriously thinking about what skills you bring to the table.</p>
<p>In most data science positions I’ve heard of, the hard part isn’t building a model once the problem has been framed, data collected, samples chosen, and data is in a neat one-row-per-sample format. The hard part is getting to that point. While I don’t doubt some of these steps will be made simpler in the future as tools evolve, I can’t see anytime in the near future where the whole process could be easily automated. Translating a business problem into a prediction problem is hard and requires a lot of business knowledge coupled with abstract, quantitative thinking. Figuring out what data to use and how to get it is hard - businesses evolve and the data infrastructure isn’t always so clean, so there aren’t ready solutions here. Choosing an unbiased sample set for training can be extremely difficult and there isn’t a cookie-cutter solution to this. Most often, some structure needs to be imposed on the data from knowledge about the particulars of the problem.</p>
<p>I have no doubt that in the next few years, we’ll have some nice tools for automating the building of a machine learning pipeline. Hopefully once that problem is rendered trivial, fewer aspiring data scientists will try to prove their skills by showing off how accurate their model is on the Iris data set. I don’t see much impact on the field beyond that.</p>It’s okay to not be a data scientist2018-02-20T00:00:00-05:002018-02-20T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2018-02-20:/its-okay-to-not-be-a-data-scientist<h2>Everyone wants to be a data scientist</h2>
<p>Being a data scientist has been hyped a lot in the past few years. Glassdoor has listed it as the #1 <a href="https://www.glassdoor.com/List/Best-Jobs-in-America-LST_KQ0,20.htm">Best Job in America</a> 3 years in a row, and it isn’t hard to find <a href="https://data36.com/become-data-scientist-7-plus-1-selfish-reasons/">blog posts</a> talking about how great …</p><h2>Everyone wants to be a data scientist</h2>
<p>Being a data scientist has been hyped a lot in the past few years. Glassdoor has listed it as the #1 <a href="https://www.glassdoor.com/List/Best-Jobs-in-America-LST_KQ0,20.htm">Best Job in America</a> 3 years in a row, and it isn’t hard to find <a href="https://data36.com/become-data-scientist-7-plus-1-selfish-reasons/">blog posts</a> talking about how great being a data scientist is. It’s no surprise, then, that the <a href="https://www.reddit.com/r/datascience/">main data science subreddit</a> seems to be mostly people asking for advice on how to <em>become</em> a data scientist, rather than about data science.</p>
<p>I’ve been feeling pretty ambivalent about a lot of the advice I’ve seen (and previously given), and I worry it’s been doing people a disservice. A lot of the advice out there (and advertising from certain online courses/bootcamps) make it sound like the only things you need to be a data scientist are a few technical skills - so it’s no surprise that there are questions <a href="https://www.reddit.com/r/datascience/comments/7u0a4d/why_is_the_pay_gap_so_large_between_data_analysts/">like this</a> asking why the pay gap between data analysts and data scientists is so large if the lists of technical skills each need to have are the same.</p>
<h2>Why isn’t everyone a data scientist?</h2>
<p>The truth is, there is more to being a data scientist than learning how to import sklearn. I have to tread carefully here. I don’t want to be seen as gatekeeping. But I think there needs to be some reality check on the idea that anyone can do one machine learning project and put it on github to land a job paying a 6-figure income.</p>
<p>According to the 2017 <a href="https://www.burtchworks.com/">Burtch Works</a> ‘Salaries of Data Scientists’ report, about 90% of data scientists have advanced degrees (~40% PhDs, ~50% Masters). Of those 10% without a graduate degree, my guess (I don’t have stats on this) the majority have a lot of experience either with pretty high-level data analytics or software engineering. </p>
<p>There are reasons for the large proportion of graduate degrees. Graduate degrees (especially PhDs) in quantitative disciplines indicate that a person has had a certain amount of experience with exploring abstract concepts, developing intuitions for statistical relationships, devising ways of testing hypotheses, translating data into stories, communicating complex results, etc. It may only take a couple of months to learn Python and how to wrangle data in Pandas and build a model in sklearn, but that’s just the surface-level stuff. The real world has complications that require you to have an intuition behind the math and understand what will and won’t work - and how to show that it will or won’t work.</p>
<p>I don’t mean to imply a PhD is required to be a data scientist - that is empirically false (60% don’t, after all). There are many different paths to becoming a data scientist. <strong>But there’s no easy path</strong>. </p>
<p>The thing to realize about all of those data science bootcamps and online courses is this: for most of the people who get a data scientist job after them, the skills they learned in those courses were just the icing on the cake. If you have a quantitative PhD, or tonnes of software engineering experience, or years of working closely with data scientists as a data analyst, maybe all you need is a short course to pick up how to use a couple of Python packages and you’ll be competitive. If you don’t, most likely you have a longer road to being a data scientist.</p>
<h2>You don’t have to be a data scientist</h2>
<p>Gaining new skills is fun and probably good for your career regardless of what title you end up with. It’s worth picking up skills that allow you to do things you enjoy. If you currently don’t work as an analytics professional, learning online or doing a data science course could certainly help land that first data analyst position. Maybe if you’re a current data analyst working at a high level, learning some of those skills and incorporating them into your work could eventually lead to a data science position down the road.</p>
<p>But there are more ways ‘up’ than one. Being a data scientist doesn’t need to be your goal. You can end up on a management track and end up leading a team of data analysts. That may lead to managing a large data analytics group, or even to being Chief Analytics Officer one day. My point is, a lot of people are a bit too obsessed with the title ‘Data Scientist’. It’s a good job, but I think people are overvaluing it and underestimating the expected level of experience for it. There are lots of great analytics jobs (and lots of great non-analytics jobs, for that matter), and I think it would benefit some people to take their eyes off the shiny, hyped up ‘data scientist’ title and judge their options more objectively.</p>Performance metrics aren't everything2018-02-09T00:00:00-05:002018-02-09T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2018-02-09:/performance-metrics-arent-everything<p>Lately I’ve been getting pretty annoyed with an obsession with performance metrics. It’s like someone let the word out about what <a href="http://gim.unmc.edu/dxtests/roc3.htm">area under the ROC curve</a> is and suddenly everyone thinks that’s the only measure of whether a data science project is ‘good’ or not.</p>
<p>The problem …</p><p>Lately I’ve been getting pretty annoyed with an obsession with performance metrics. It’s like someone let the word out about what <a href="http://gim.unmc.edu/dxtests/roc3.htm">area under the ROC curve</a> is and suddenly everyone thinks that’s the only measure of whether a data science project is ‘good’ or not.</p>
<p>The problem is, whether a model is good or not typically relies on much more than [insert your favorite performance metric here]. Yes, if your model is predicting at chance, it’s almost certainly useless. But even slightly above chance it might be immensely useful (conversely, even with perfect predictions it might be useless). The usefulness of a predictive model is a function of what it enables you to do that you wouldn’t be able to do without it. What actions or interventions will the project as a whole allow that would not otherwise happen, and how valuable are those?</p>
<p>Unfortunately, a little knowledge can be a dangerous thing. I’ve had projects where the predictive accuracy of a model is completely irrelevant - the model was built just to eliminate the effects of a few variables on some outcome (i.e. to get the residual). After showing how well the model captured the trends in those few variables, the non-technical people who had seen a predictive model before immediately started asking about the area under the ROC curve, and judging the project on this. Yet the value of the project was just removing those trends from the outcome, which the model did beautifully.</p>
<p>Return On Investment (brought up often and referred to as ROI by those who want you to know they’ve taken a business class) is a better concept to keep in mind for thinking about the value of a project, even if in practice it’s often not possible to work it out exactly. What is the (value - cost) of having this model in production? The cost of a false predictions and the payoff of true predictions are just as important to figuring this out as the predictive accuracy of a model. There is a lot that a data scientist can do to alter these costs and payoffs, and sometimes that’s a better place to focus effort than getting an extra 0.00001 precision in your model.</p>
<p>For example, often a model is expected to not only make a prediction, but give some idea of why that prediction was made. This is what makes tools like <a href="https://github.com/marcotcr/lime">LIME</a> that explain where a prediction has come from so useful. Unfortunately, they don’t completely solve the issue because explanations are complicated. Some explanations might be less useful than others. Explaining a patient is likely to be sick because they are old might be true, but that doesn’t make the explanation or the prediction useful. Additional work of picking out those features that yield explanations of interest (or grouping features together in a way that makes sense) is also necessary. Doing this work well might create a tool that drastically improves the efficiency of some process. Doing it poorly might mean your model directs effort to the wrong places, creating cost and no value. These are both in the realm of possibilities regardless of how accurate your model is.</p>
<p>There are plenty of other examples of ways you can use a predictive model beyond just its prediction, or add value on top of that prediction. Knowing a performance metric doesn’t mean you can judge a project’s value. Real projects aren’t Kaggle competitions where the only thing that matters is predictive accuracy.</p>Lessons learned in my first year as a data scientist2018-01-25T00:00:00-05:002018-01-25T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2018-01-25:/lessons-learned-in-my-first-year-as-a-data-scientist<p>It’s been a year since I started my first job as a data scientist. In that time, I’ve learned a lot, but most of that learning hasn’t been the type I expected. I’ve certainly learned some things about new technologies and techniques, but much of what …</p><p>It’s been a year since I started my first job as a data scientist. In that time, I’ve learned a lot, but most of that learning hasn’t been the type I expected. I’ve certainly learned some things about new technologies and techniques, but much of what I’ve learned has been about how to actually make my skills useful to others in the company.</p>
<p>For context, I work in a healthcare company where the data science group acts kind of like a consulting firm - we take on projects to create predictive models and provide other analytical support. For that reason, a lot of the lessons I’ve learned have more to do with the issues with operationalizing data science projects in the business.</p>
<h2>Feature engineering is important</h2>
<p>One of the big lessons from the year is that feature engineering is the most important part of building a predictive model. This might not be a surprised to anyone with a lot of machine learning experience, and I certainly had heard this when I started. But if I'm honest, it was hard for me to come up with examples of when or why it was important before I started. Seeing repeated examples of this in practice have really made me understand it on a deeper level. The kind of model you use doesn’t matter if your features suck, and being able to understand what kinds of features will be useful is a skill that requires abstract thinking and intuitive math. This is what makes machine learning hard.</p>
<h2>Getting the best performance is not important</h2>
<p>When I was initially learning data science and machine learning, there was a lot of emphasis on performance metrics. The truth is, for almost every project, you can get 90% of the actual value of the project quickly and the last 10% will take you ten times longer. For most projects, it just isn’t worth it. While with Kaggle you want to perfect the model as much as possible because a .01 increase in your performance metric of choice can make or break you, in the real world, tiny increases rarely matter (though obviously this depends on the industry and project).</p>
<h2>The hard part of projects isn't the machine learning, but everything else</h2>
<p>More important than knowing how to build the best predictive model is knowing how to translate a business problem into a problem a predictive model can help with, and translating a predictive model into something actionable. When people from other departments hear we can build predictive models, they often come up with some idea of something they think would be interesting to predict. Often, their ideas don’t make sense, but explaining why that’s the case, the technical issues involved, and coming up with an alternative that will work - that’s important.
It’s also important that once a model is built, the output is actually usable - it’s easy to predict things, but often the prediction is only useful if it comes with some additional insight. Using tools like <a href="https://github.com/marcotcr/lime">lime</a> has been useful and is part of the solution, but sometimes your features are not actionable or easy to understand for the end user, so lime is useful but not a silver bullet - more thought needs to be put in than just to stick lime on the end.</p>
<h2>Ask the right questions BEFORE you start a project</h2>
<p>Finally, probably the most important lesson I’ve learned the hard way this year: Make sure you know up front where the data is going to come from and how the project is going to be used before putting too much effort into it or committing to any kind of deadline.
I had one project described to me that I was excited to tackle and promised a quick turn-around on, only to learn that writing the algorithm was the easy part. I was given a sample of data and had assumed that meant there was a process in place for me to acquire the data. In reality, there was no such process, and it took months to figure out how to get access to the necessary data. I ended up looking pretty bad for going way over my initial time estimate, even though most of that time was spent waiting for people to respond to emails so I could track down and get access to the necessary data. Figuring out data pipelines is really hard in a big company!</p>
<p>I also had to pick up a few projects that were started before me when another data scientist left. One was a dashboard put together to help navigate and visualize some text data. I was amazed when I talked to the end-user to check what else they wanted done with the project, and discovered all of the changes they wanted involved removing features. The dashboard was massively over-engineered, with some of its major functionality either removed or left in but never used. Worse, the dashboard was never meant to be in long-term use and would be retired in a year, so there was no chance these features would find eventual use. This meant time was wasted twice - once creating those features, and again going back and removing them to simplify the dashboard.</p>
<p>This and other experiences really taught me the importance of having a close feedback loop with the end user of whatever project I’m working on. A biweekly, half-hour meeting can end up saving a lot of time.</p>Motivation in Academia vs Industry2018-01-21T00:00:00-05:002018-01-21T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2018-01-21:/motivation-in-academia-vs-industry<p>I’ve been in industry working as a data scientist for a year now after leaving academia. By all measures I can think of, it’s been a good year. I got lucky with having a great manager, I’ve gotten a bunch of experience and learned a lot, I …</p><p>I’ve been in industry working as a data scientist for a year now after leaving academia. By all measures I can think of, it’s been a good year. I got lucky with having a great manager, I’ve gotten a bunch of experience and learned a lot, I work at a place where doing good work means actually helping sick people, and I even lucked out with a promotion, allowing me to try out a slightly more managerial position so I get to see how I like those responsibilities while still making my own development contributions.</p>
<p>However, I wanted to revisit my appraisal of my life in academia vs industry. Rereading my <a href="http://tommyblanchard.com/retrospective-on-leaving-academia-for-industry-data-science">previous post about this</a>, I agree with everything I said. On the whole, the issues I had in academia aren’t an issue in industry, and overall I still can’t imagine going back to academia.</p>
<p>But I’ve been thinking lately about what’s been the biggest tradeoff for me: the motivational structure. With academia, there are a bunch of somewhat quantifiable metrics that are often looked at to approximate how much you’ve accomplished as a scientist - your number of first-author publications, h-index, etc. Of course there are issues with these metrics, and a lot of controversy around how much weight is put on them to judge a scholar. However, one thing I’ve realized is that (at least for me) they are incredibly effective motivators.</p>
<p>It feels incredibly good to get a new first-author publication when that is the main metric by which you’re judged. It goes on your CV, and that accomplishment will follow you wherever you go. Every citation it accrues goes down on a sort of permanent record of achievement for you. It feels a lot like building something, where every incremental piece adds up.</p>
<p>There’s no real equivalent in industry. When a project is completed, it might come up between you and your manager in your performance review. If it’s a big project, you might put it on your resume to help the next time you’re looking for a job.</p>
<p>This motivational structure for academia is a double-edged sword. It gave me a sense of purpose and progression, quantifiable goals and accomplishments. However, it was a bit <em>too</em> effective. I didn’t take much time off because I wanted to keep moving towards that next publication. I felt guilty reading if it wasn’t reading something I hoped would give me a new project idea for a quick publication. And of course, when there was a big set back in my project, it would take a big psychological toll. </p>
<p>I’ve been trying, both at work and in my private life, to find things that will help give me some of this sense of progression and purpose. I’ve had mixed success - certainly I’ve found some things motivating and rewarding in a similar way, but not in as sustained a way as publications were when I was an academic. It just seems to take more effort to find these things.</p>
<p>A probably healthier way of looking at things is with a growth-mindset - that it’s the skills I’ve gained and lessons learned that are important, not the specific accomplishments I’ve made. But growth is hard to measure, and it’s often hard to see how far you’ve come. It’s hard to get super excited about growth.</p>
<p>On balance I certainly still think the move to industry was doubtless the right one for me. The same lack of a super motivating goal also makes it much easier to leave work at work and have a better work-life balance. But this is probably the biggest issue I’ve struggled with since the shift. It was something I worried about before leaving, and that worry has turned out to be justified.</p>"Should I do a Data Science bootcamp?"2018-01-03T00:00:00-05:002018-01-03T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2018-01-03:/should-i-do-a-data-science-bootcamp<p>Since I wrote a <a href="http://tommyblanchard.com/review-of-the-data-incubator-data-science-bootcamp">review of my experience with The Data Incubator bootcamp</a>, a lot of people have reached out in one way or another wondering if they should bother with a data science bootcamp. Many people interpreted my review as very negative. To be clear, I do think there …</p><p>Since I wrote a <a href="http://tommyblanchard.com/review-of-the-data-incubator-data-science-bootcamp">review of my experience with The Data Incubator bootcamp</a>, a lot of people have reached out in one way or another wondering if they should bother with a data science bootcamp. Many people interpreted my review as very negative. To be clear, I do think there is value in the program, but also some pretty serious problems. Despite my ambivalence about the program itself, I have to say it was worth it for me and is probably worth it for many others. </p>
<p>The real value of <a href="http://www.thedataincubator.com/fellowship.html?ref=ce730ff6c5d6&ch=ge">Data Incubator</a> (which I imagine goes for most data science bootcamps) was being given challenges that required me to learn, and being surrounded by people with the same goal. It’s much easier to learn that way than trying to learn on your own. It’s amazing how much you learn from just being around smart people trying to learn things. Having some direction from a course specifically designed to take you into the world of data science also gives you a good amount of breadth over the field of data science, which can be hard to get when trying to learn on your own.</p>
<p>However, I think there are some serious costs to these programs. They are stressful. They require a more-than-full-time commitment for a couple of months. Some may require you to move, though maybe temporarily (I moved to NYC for 2 months for Data Incubator). Some of them require you to pay up to $15,000 - Data Incubator offers a less competitive option of being a ‘scholar’, where you pay about that amount to attend the program.</p>
<p>I think the stress is probably worth it - it sucks during the program, but any quick way of learning a lot is going to involve a lot of stress. It’s hard to put a dollar amount that the programs are worth, so it’s hard to say if it’s worth taking the time off or even paying tuition. If you have financial support from somewhere, and you won’t be sunk financially if you don’t get a job immediately after finishing, it might be worth it.</p>
<p>The issue is, not everyone gets a job. These programs don’t work for everyone. It’s hard to know the rate at which attendees of a program get a job - the issue with most of the numbers these programs put out is they decide who to include in their calculation. A lot of students just lose contact with the program after losing hope of getting a job through them, and the program doesn’t count them when they tell you what percentage of students found a job through the program. This basically guarantees the program will be able to list a high success rate. So don’t trust the numbers they give (or at least ask more about if it includes everyone who enters the program, not just the people who ‘successfully complete’ it, since the definition of successfully complete may mean they either got a job or they stayed in contact with the program for 3 months after it was over). Regardless, if doing the program will put you on a financial knife-edge, it probably isn’t worth the risk.</p>
<p>There are alternatives to doing a bootcamp. If you’re motivated and can get a data analyst position that works closely with data scientists, you can transition from there. You can also take courses, do projects, and learn on your own in your spare time. I think these options are slower and probably harder than doing a bootcamp, but they can work, and are certainly safer. But if you feel like you're close - you have a PhD or relevant work experience and just need that extra boost to get over the edge - then bootcamps can be really powerful.</p>Data professional definitions: Data analyst vs data scientist vs data engineer2017-12-14T00:00:00-05:002017-12-14T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2017-12-14:/data-professional-definitions-data-analyst-vs-data-scientist-vs-data-engineer<p>Lately I’ve read a lot of attempts at defining data scientist and differentiating it from other data-centric roles. The terms ‘data scientist’, ‘data analyst’, and ‘data engineer’ are obviously interrelated. But recently I’ve seen some weird definitions of them.</p>
<p>Let me make clear that this isn’t just …</p><p>Lately I’ve read a lot of attempts at defining data scientist and differentiating it from other data-centric roles. The terms ‘data scientist’, ‘data analyst’, and ‘data engineer’ are obviously interrelated. But recently I’ve seen some weird definitions of them.</p>
<p>Let me make clear that this isn’t just a silly semantic quibble with no practical significance (though it certainly is partially, maybe largely, that). This issue often comes up when people are giving career advice. A <a href="http://nadbordrozd.github.io/blog/2017/12/10/what-they-dont-tell-you-about-data-science-2-data-analyst-roles-are-poison/">recent blog post</a> defined a data analyst as someone who interrogates data using SQL and Excel to produce reports, while a data scientist is someone who delivers software. This is a lead in to advice that a data analyst position is not good preparation for a data scientist position because data scientists are basically software engineers and data analyst positions don’t give you that experience. The premise, however, is based on an extremely narrow definition of both of these roles that might only be true in certain companies.</p>
<p>Another example of silly definitions for these roles came from a reddit thread I read, where someone was claiming that anyone who regularly uses pandas/sk-learn must be a data engineer. This bizarre claim seemed to stem from an idea that legitimate data scientists are at the forefront of machine learning research and therefore must be programming completely new machine learning algorithms from scratch.</p>
<p>Here’s the thing: if anyone claims a very clear, straightforward definition of any of these roles that sharply delineates them, they are probably extrapolating based on experience of how these roles are defined in one company (or industry). This is because these jobs, by their very nature, have a lot of overlap.</p>
<p>I would give the high-level, fuzzy (and hopefully not controversial) definitions of these roles as:</p>
<p><strong>Data engineer</strong>: a data professional who focuses on building data pipelines, manages how to get data from point A to point B.</p>
<p><strong>Data analyst</strong>: a data professional who focuses on producing reports describing trends/insights in data.</p>
<p><strong>Data scientist</strong>: a data professional who focuses on producing insights and predictions from data.</p>
<p>Note my use of the weasel phrase ‘focuses on’ to avoid making any hard statements. Because at bottom, each of these roles overlaps significantly with the others - it’s typical for data professionals to need to extract data or move it around. It’s not uncommon for data engineers to produce dashboards or reports, or for data analysts to set up data pipelines. Data scientists may sometimes produce reports, and some data analysts are deliver code to go into production.</p>
<p>Any hard line you can think of (data scientists use machine learning, data analysts use excel, etc, etc) there are going to be lots of counter-examples.</p>
<p>At the end of the day, there is a difference in these roles. It’s a fuzzy yet important one. Typically data scientists are more specialized and have more experience/skills than data analysts. Data engineers might have more knowledge of databases but less about statistics. But the field is not at a point where you can easily determine the total extent of the role just by the title.</p>
<p>The bottom line is, if you’re looking to become a data scientist and want to know what path to take, getting experience as a data analyst (or data engineer) might not be a bad way to go about it. However, it’s dependent on the specifics of the particular position you get. If you’re a data analyst who sits with business people and only use excel to produce simple reports, you’re not going to get the kind of experience you need to move on to a data science position. But if you work closely with other data scientists, or are expected to learn stats/machine learning to perform your duties, it might be good experience. I think <a href="http://nadbordrozd.github.io/blog/2017/12/10/what-they-dont-tell-you-about-data-science-2-data-analyst-roles-are-poison/">the blog post I mentioned above</a> does give good advice on this - be concerned about who you’ll be sitting with, since that probably says a lot about what skills you’ll learn.</p>“Should I get a PhD to be a data scientist/analytics professional?”2017-11-19T00:00:00-05:002017-11-19T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2017-11-19:/should-i-get-a-phd-to-be-a-data-scientistanalytics-professional<p>There’s some advice I’ve read that <a href="http://varianceexplained.org/r/start-blog/">“when you’ve given the same in-person advice 3 times, write a blog post”</a>. I’ve decided to take that advice and write some of my thoughts on getting a PhD to go into industry. </p>
<h3>Opportunity Costs of Getting a PhD</h3>
<p>Obviously …</p><p>There’s some advice I’ve read that <a href="http://varianceexplained.org/r/start-blog/">“when you’ve given the same in-person advice 3 times, write a blog post”</a>. I’ve decided to take that advice and write some of my thoughts on getting a PhD to go into industry. </p>
<h3>Opportunity Costs of Getting a PhD</h3>
<p>Obviously, having a PhD on your resume, all else being equal, helps you. It shows you’re smart and have a variety of skills. It also gives you a number of important skills for industry.</p>
<p>But asking whether a PhD is a good thing to have on your resume isn’t the right question. Is having a PhD better than having 5+ years of industry experience, or a Master’s degree and a couple of years of experience? My guess is in most cases, no. PhDs take a long time, and aren’t very efficient for learning the specific skills for an industry job. PhDs train you to be a researcher in a very specific field.</p>
<p>Simply put, if you’re just looking for a way of advancing your career, in most cases you’re better off doing something other than getting a PhD. There might be some exceptions to this - like if you’re planning on getting a PhD in machine learning. But for the most part, a PhD is just a slow way of learning some skills. When you factor in the financial opportunity costs as well, it just doesn’t make sense to get a PhD if you’re doing it just for your career.</p>
<h3>Risks of Enrolling in a PhD Program</h3>
<p>One issue I don’t see brought up enough in discussions about getting a PhD is that getting a PhD carries significant risk. A large proportion of students (<a href="http://www.chronicle.com/article/PhD-Attrition-How-Much-Is/140045">estimated ~50%</a>) don’t complete their PhD. Everyone thinks that these statistics don’t apply to them, but quite simply, there is a lot of luck involved in getting a PhD. Many advisers just aren’t good (or have styles that don’t jive well with your own), some departments suck, some research plans don’t pan out. On top of that, sometimes life circumstances get in the way - you have a kid, a family member gets sick, or you find you can’t continue doing it for financial reasons. These are things it’s hard to know ahead of time. There is always a chance things just won’t work out with your PhD program, or that it will require much more time than you originally planned.</p>
<h3>Doing it for the Wrong Reasons</h3>
<p>Finally - if you’re getting a PhD just thinking about what it’s going to give you on the other end, you’re doing it for the wrong reasons. If you’re not seriously excited about the prospect of doing academic research for the next few years, you’re just not going to gain much from the experience. A PhD is a long commitment - 5+ years might as well be a lifetime. It’s also a lot of work - I worked much harder during my PhD than I have at any other point in my life. Academia can also be extremely lonely and isolating, <a href="http://tommyblanchard.com/reasons-i-left-academia">as I've written about before</a>. If you aren’t happy and motivated by the work you’re doing during that time, you’re (1) not going to accomplish much, (2) not learn much, and (3) miss out on enjoying a big chunk of your life.</p>
<h3>Bottom Line</h3>
<p>I’m not against the idea of getting a PhD, and going into it planning to take an industry job after isn’t a bad idea (it’s probably better than going into it expecting a tenure-track academic job, given <a href="https://lifesciencenetwork11.connectedcommunity.org/blogs/leah-cannon/2016/09/15/how-many-phd-graduates-become-professors">the prospects of that</a>). However, I think if you’re going to do a PhD, it should be because you love the idea of doing a PhD. If it’s just something you’re trying to get through for the position and prestige you feel you’ll have on the other end, it really isn’t worth it. Given the risks involved, the financial hardship it entails, the cost to your mental health, I really believe you should only do a PhD if you would want to do it even if it wouldn’t actually help your career at all.</p>Data Science in Healthcare2017-11-14T00:00:00-05:002017-11-14T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2017-11-14:/data-science-in-healthcare<p>I've recently written a couple of guest blog posts about data science in the healthcare space.</p>
<p>The first is a pretty general article about some of the challenges and opportunities for data science and predictive analytics in healthcare. You can find it <a href="https://data-science-blog.com/blog/2017/09/04/data-science-and-predictive-analytics-in-healthcare/">here</a>.</p>
<p>The second one is about the importance …</p><p>I've recently written a couple of guest blog posts about data science in the healthcare space.</p>
<p>The first is a pretty general article about some of the challenges and opportunities for data science and predictive analytics in healthcare. You can find it <a href="https://data-science-blog.com/blog/2017/09/04/data-science-and-predictive-analytics-in-healthcare/">here</a>.</p>
<p>The second one is about the importance of domain knowledge in data science, with a focus again on healthcare. It talks about why domain knowledge is important, and ideas of how to get it if you (like me) are a data science without a medical background working in healthcare. Find that one <a href="https://data-science-blog.com/blog/2017/11/10/the-importance-of-domain-knowledge-a-healthcare-data-science-perspective/">here</a>.</p>Review of The Data Incubator data science bootcamp2017-05-29T00:00:00-04:002017-05-29T00:00:00-04:00Tommy Blanchardtag:tommyblanchard.com,2017-05-29:/review-of-the-data-incubator-data-science-bootcamp<h3>May 2018: <a href="http://tommyblanchard.com/an-updated-review-of-the-data-incubator-data-science-bootcamp">Click here for an updated review</a>, and <a href="http://tommyblanchard.com/the-data-incubator-unofficial-frequently-asked-questions">here for a recent collection answers to common questions I get asked about Data Incubator</a></h3>
<p>This is a review of my experience in <a href="http://www.thedataincubator.com/fellowship.html?ref=ce730ff6c5d6&ch=ge">the Data Incubator data science program</a>.</p>
<p>When I decided to make the switch from academia to data science …</p><h3>May 2018: <a href="http://tommyblanchard.com/an-updated-review-of-the-data-incubator-data-science-bootcamp">Click here for an updated review</a>, and <a href="http://tommyblanchard.com/the-data-incubator-unofficial-frequently-asked-questions">here for a recent collection answers to common questions I get asked about Data Incubator</a></h3>
<p>This is a review of my experience in <a href="http://www.thedataincubator.com/fellowship.html?ref=ce730ff6c5d6&ch=ge">the Data Incubator data science program</a>.</p>
<p>When I decided to make the switch from academia to data science, I went the route of doing a bootcamp. There is a lot that is appealing about this route. You get to learn with others in the same position as you. Having assignments and lessons forced on you can be a powerful motivator to learn and get experience. Having a fully worked out curriculum can mean getting a larger, better rounded introduction to the field than if you tried to learn on your own. Finally, many bootcamps explicitly market themselves to academics, which I found attractive given my background. </p>
<p>For these reasons, I decided to attend a bootcamp to launch my data science career. I ended up attending Data Incubator, in the September-October 2016 cohort. While I did end up getting a job through the program, I still left it with some mixed feelings about the program and thought writing some details may be helpful for someone trying to make a decision about attending.</p>
<h2>Getting in</h2>
<p>Many, if not all, data science bootcamps have some kind of admission process. For some, this means just sending a resume and going through an interview. Others involve short technical challenges to test your statistics/programming to see if you're at the level they expect students of the program to be at.</p>
<p>I applied for a bunch of different programs and went through a few different admissions tests. By far the Data Incubator's was the most involved. After applying with typical application paperwork and getting reference letters, if you're chosen you're given challenge questions - programming questions that are pretty challenging that you only have a few days to complete. There is no way to reschedule so if you happen to be travelling during the scheduled time (like I was), you just have to figure out a way to do it. Along with the challenge questions, you have to come up with a project for the program, and do some initial exploratory analysis. If you make it through to the semi-finalist stage, you need to put together more analyses for the project proposal and prepare to do a short pitch in an interview. All of this took many stressful hours of preparation time. </p>
<p>Compare this to Data Incubator's main competitor, <a href="http://insightdatascience.com/">Insight</a>, where I did an initial application and an interview and that was it. That application took perhaps an hour or two (and was also successful).</p>
<p>In addition to all the work you put into the Data Incubator application, you're not told until the end if you're accepted as a 'fellow' (no tuition), or a 'scholar' ($15k for the program). My hunch (based on a small sample size) is that they are strongly biased towards giving 'fellowships' to PhDs, and most Masters applicants end up with 'scholar' status if they are accepted.</p>
<h2>Strengths of the program</h2>
<p>Perhaps the best part of the program is that the assignments are diverse and do a good job of introducing you to a range of topics and tools. In contrast to Insight (where, my understanding is, you're given resources and a list of things you should do but no real lectures or assignments), there is a pretty structured curriculum that makes it clear what you're supposed to be learning and when. The fact that they are assignments forces you to actually get your hands dirty working with powerful different Python tools.</p>
<p>Another strength of the program is the focus on programming skills. As well as the assignments which are mostly expected to be done in Python, four days a week the program starts with an hour long coding challenge. I came in having basically taught myself Python to complete the application. By the time I finished, Python was my most comfortable language and I felt very confident in it. </p>
<p>The course includes in its curriculum some basic job skills that many people transitioning to data science lack: how to sell yourself to employers as a data scientist. There is advice and feedback on making a resume and interview practice. While some of this was a bit too obvious to be useful, I found some tips and advice helped a lot.</p>
<p>Finally, the course provides what any bootcamp should: a social learning experience where you're immersed and forced to learn a lot in a short period of time.</p>
<h2>Weaknesses of the program</h2>
<p>The program includes daily lectures. On paper, this sounds great, but in practice it's terrible. The hour-long lectures are frequently unhelpful because they often come after you've already learned the content while trying to complete the assignment for that week. When they are timely, they frequently are just low quality that make it hard to gain anything from. Most lectures are also remote - being teleconferenced from one of the other Data Incubator locations. The remote lectures raise barriers to interacting with the lecturer, and the sound quality is often poor enough that it takes just too much effort to pay attention. I found myself frequently using lecture time as lunch hour so the time wasn't a complete waste.</p>
<p>Parts of the curriculum structure also just didn't make sense. We had an assignment nominally supposed to teach us SQL, even though we had no resources for being taught how to even set up SQL on our machines (everyone ended up completing the assignment using Python's Pandas). One of the last weeks of the program we suddenly switched to using Scala for the morning programming challenges, despite using Python for everything else in the program. We came in Monday morning for our weekly assignment, and were literally given an hour to complete a challenge in a language none of us had ever used.</p>
<p>The advertising of the program is slick but the reality often falls short. The variety of companies hiring from the program is greatly exaggerated. Based on the marketing, I was expecting them to have hiring partners all over the country with a large variety of industries. There was exactly one non-profit, zero video-game companies that were hiring. There were only a couple of jobs in all of Boston. One student at my location just left the program immediately after seeing how limited his job options were in his geographical area.</p>
<p>Other problems with the course were deeper than just poor course planning. There seemed to be a deep distrust and infantilization of the students woven into the philosophy of the course. If we failed to complete an assignment on time, we were punished by being locked out of the system for contacting hiring partners until we caught up. One fellow in my cohort was locked out of the system as punishment for turning down a bad job offer. The 'soft skills' lectures (which were really 'job search' lectures) were at best not useful, but frequently condescending and verged on outright insulting people with academic backgrounds. We were routinely encouraged to apply for jobs we weren't interested in.</p>
<h2>Conclusion</h2>
<p>Overall, the program was useful for me. I probably could have gotten a data science job without it, but I am glad I did it. There are ugly parts of the program, but it was free training for me and did end up landing me a job, so I can't complain too much. However, I don't view it particularly favorably compared to Insight (a program I've only heard good things about from a few of my friends who have gone through it). I also am not convinced a bootcamp is necessary for the job - I actually got more data science interviews that weren't through Data Incubator, and it's mostly fluke that I got my job through Data Incubator instead of on my own. </p>How to make the transition from academia to data science2017-04-23T00:00:00-04:002017-04-23T00:00:00-04:00Tommy Blanchardtag:tommyblanchard.com,2017-04-23:/how-to-make-the-transition-from-academia-to-data-science<p>Ever since I've started writing about my transition from academia to industry (both <a href="http://tommyblanchard.com/reasons-i-left-academia">my reasons for leaving</a> and <a href="http://tommyblanchard.com/retrospective-on-leaving-academia-for-industry-data-science">what I think about the transition in retrospect</a>), I've started receiving a lot of requests for advice on making that transition. Sometimes these requests come from former peers, former professors looking to …</p><p>Ever since I've started writing about my transition from academia to industry (both <a href="http://tommyblanchard.com/reasons-i-left-academia">my reasons for leaving</a> and <a href="http://tommyblanchard.com/retrospective-on-leaving-academia-for-industry-data-science">what I think about the transition in retrospect</a>), I've started receiving a lot of requests for advice on making that transition. Sometimes these requests come from former peers, former professors looking to advise students, or just someone who read one of my blog posts online.</p>
<p>I'm always happy to reply to these requests as best as I can given my experiences, but I figured since so many people seem interested I it might be useful to put my thoughts in a blog post.</p>
<h2>What do I need to know to be a data scientist?</h2>
<p>My main message to most of the people that have been asking me for advice is not to worry too much. People seem to think you need to know everything to be a data scientist. If you have a PhD in the sciences or any quantitative discipline, you're likely most of the way to having the skills you need, so don't be scared to take that next step (by just looking at and applying to jobs). Put yourself out there and let potential employers decide whether you have the skills to work for them or not, don't do their job for them.</p>
<p>If you really want to know what I think are the essentials to get a first data science position, the main classes of skills you need to have should come as no surprise:</p>
<ol>
<li><strong>Be a decent programmer</strong>: Python and R are the languages that are most common. Being comfortable in both opens more doors, but you can make due with one or the other. SQL is also used frequently, so at least do a short tutorial on it (basic queries are simple enough that it's not super difficult to pick up the necessities).</li>
<li><strong>Know some machine-learning</strong>: You should understand basic machine-learning concepts and have at some experience with some of the most common algorithms (like tree-based methods, logistic regression, dimensionality reduction, etc.)</li>
<li><strong>Know some traditional stats</strong>: You should know about p-values, regressions, t-tests, statistical significance.</li>
</ol>
<p>These are the bare essentials. You'll need to be more than just 'decent' in at least one of these categories (which one depends on the job, read on), but the point is, these should be skills you already have or could gain in a short period of time through some additional reading/practice. The skills involved in data science are so broad, no one is an expert in all of them. As long as you know the basics, and have some areas where you're particularly strong, you should be able to find a somewhere that your skills could be useful.</p>
<h2>Other skills that are useful</h2>
<p>Some people seem convinced that they need an understanding of every big data technology under the sun to be a data scientist. To the uninitiated, the bizarre names you might hear (Hadoop, Spark, MongoDB, etc.) just sound intimidating. The truth is, they're not that complicated, and you don't need to be an expert in them to get a data science job.</p>
<p>Different data science teams use different tools. Some may use some big data tools for everything and really need someone who can jump into that workflow right away. But in my experience, the majority of data science jobs have these skills listed as 'Preferred but not required', if they're listed at all.</p>
<p>Knowing specific packages and algorithms might be required by specific jobs. <strong>The best way to figure out what you might need to know for the kinds of jobs your interested in is to just start looking.</strong> Go to <a href="https://www.indeed.com/">Indeed</a> or any other job posting site and just start looking at jobs. Find some that interest you, and figure out what skills they want, and get to work on those skills.</p>
<h2>Where do I learn these skills?</h2>
<p>Once you get a sense of what skills you might need to gain or strengthen, where do you go to get them? For almost any package under the sun, it's easy to just google a tutorial or free online course to learn the basics.</p>
<p>Some people opt to go to boot camps. My overall opinion is that they are good for getting a general overview if you can afford to take a couple of months off full-time, but I don't think they are necessary.</p>
<h4>Start applying/interviewing as early as possible</h4>
<p>I find I learn best by being forced to solve problems. I think what taught me the most about being a data scientist was <em>applying and interviewing</em>. Interviewers will often give you a coding challenge or small project to work on at home before they bring you in for an in-person interview. These can be anything from a quick one hour coding exercise to a multi-day project where you have to implement a recommendation engine. These are great for learning, because they're nice small projects that are, by definition, what interviewers want you to know. Treating them as a learning exercise helps in two ways. First, they're efficient for learning skills. Second, it will take the edge off when, inevitably, you get rejected repeatedly after interviewing. Interviewing is hard and it can really suck to get rejected after you've put in a lot of time and effort and fallen in love with the idea of working at a particular company. A better mentality is to approach interviews as being a success as long as you've learned something.</p>
<p>There are plenty of other good resources for learning some of the essential skills to being a data scientist. Here's a woefully incomplete guide:</p>
<ol>
<li>To brush up on programming, try the <a href="https://www.hackerrank.com/domains/tutorials/cracking-the-coding-interview">Cracking the Coding Interview resources at HackerRank</a></li>
<li>For machine-learning, <a href="https://www.amazon.com/gp/product/1461471370/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1461471370&linkCode=as2&tag=tommyblanchar-20&linkId=274873f56d6b671eec6503342836a1b7">An Introduction to Statistical Learning</a> is excellent. <a href="https://www.amazon.com/gp/product/0387848576/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0387848576&linkCode=as2&tag=tommyblanchar-20&linkId=2bff6a12fa8c459f1187ee75759152df">The Elements of Statistical Learning</a> is more comprehensive but denser.</li>
<li>To just learn some basic packages and data skills, try working your way through some of the <a href="https://www.kaggle.com/c/titanic/details/tutorials">Titanic tutorials at Kaggle</a></li>
</ol>
<h2>Conclusion</h2>
<p>I think my main piece of advice is this: You're probably closer than you know to getting a data science interview, and you should take the next steps (looking at job listings, or applying to some of them) as early as possible to better guide your search. Good luck!</p>Retrospective on leaving academia for industry data science2017-04-09T00:00:00-04:002017-04-09T00:00:00-04:00Tommy Blanchardtag:tommyblanchard.com,2017-04-09:/retrospective-on-leaving-academia-for-industry-data-science<p>It's been two and a half months since I left academia to take a job as a data scientist in industry. Although I haven't been in my new job for very long yet, I wanted to check in with my current thoughts about whether the transition was worth it and …</p><p>It's been two and a half months since I left academia to take a job as a data scientist in industry. Although I haven't been in my new job for very long yet, I wanted to check in with my current thoughts about whether the transition was worth it and the differences between working in academia and industry.</p>
<p>In a lot of ways, being an industry data scientist is a lot like being a post-doc. I'm paid to tackle intellectual problems, I have a lot of freedom in how I approach problems, and there is emphasis placed on professional development (attending conferences, etc.). Of course, there is a change of emphasis on what types of tasks I do - as an academic I spent a lot of time collecting data and writing, in industry the emphasis is more on doing analyses and communicating results verbally or through simple reports.</p>
<h2>The problems I had in academia I no longer have in industry</h2>
<p>I made the decision to do leave academia for a number of reasons, outlined in a <a href="http://tommyblanchard.com/reasons-i-left-academia">previous post</a>. The main reasons were that I was lonely, stressed out, and no longer found the research held any interest for me.</p>
<p>Being in industry, there's a lot less social isolation. It's rare that a day goes by where I'm not in some kind of meeting. While sometimes this can get frustrating when meetings seem unnecessary, I think a big part of the point of meetings is social. It's nice to get away from the desk and talk to people. I'm not the kind of person that often seeks out social interactions, and I think it's really good for me to be involved in various meetings.</p>
<p>In academia, it often felt like I alone had to figure out how to solve a problem (or come up with an idea) in isolation to save a project that might span years. The projects I've worked on in industry are just much less stressful. They tend to be smaller or have a much longer timeline. Perhaps most importantly, they tend to have more people involved so you can always get more input. The end product isn't a research paper, so often it makes sense to be a bit less rigorous if it means a quicker turn-around (depending on the needs of the project).</p>
<p>Perhaps most importantly, it's expected that you leave work at work. I have done small amounts of work on evenings and weekends since starting my new job, but it's seen as weird and definitely not expected. People will talk about how much they have to finish, but doing it on the weekend is still unthinkable for them. It keeps work from encroaching on my personal life, and keeps me from feeling guilty about working on other things for fun.</p>
<h2>Industry isn't without its problems, but I find them easier to overcome</h2>
<p>While most of the time I'm interacting with more people throughout the course of a project, one downside of industry is that I have to explain things to many more non-technical people. In academic science, everyone knows some stats and some programming, so it's usually pretty easy to explain the idea behind analyses to someone regardless of their specific field. Now, I find myself talking to HR people or nurses who lack any math or programming understanding. This can lead to some frustration and talking at cross-purposes.</p>
<p>However, the challenge of communicating with less technical people is just that - a challenge. I've always enjoyed explaining technical things in non-technical ways. It helps me to understand things when I'm forced to put it in simple terms. This is a bit more extreme - explaining sometimes complex algorithms and statistics to people who don't know the first thing about math or code. But it allows me to develop a skill to speak to a wider audience, and I think that's a good thing.</p>
<p>While projects are less stressful, the flip side is a feeling of less personal investment that makes it hard to feel passionate about projects. The projects can still be fun and interesting, but there isn't always a whole lot of deeper meaning in them. Relatedly, with academia, your work is in some ways open to the world. You get publications, maybe some media coverage, and are considered a recognized expert. Without going beyond your job, the same thing doesn't really happen in industry. I might get some publications due to my position, but media coverage (or any other sort of recognition outside of the company) is unlikely.</p>
<p>But once again, I find this issue much easier to deal with than the issues I had in academia. Though I have less passion for work projects, I have a lot more time and energy to put into my own personal projects. And this can be quite rewarding - I get to try different things, like <a href="https://twitter.com/Potter_Overflow">coding silly twitter bots</a> or <a href="http://tommyblanchard.com/movie-genre-ratings">writing data</a> <a href="http://tommyblanchard.com/does-the-muslim-ban-make-us-safer">journalism pieces</a>. I find I have a wider range of projects to work on for satisfaction than I did while an academic, where I felt like any side project should ultimately net me a publication.</p>
<h2>A lot of clear benefits of industry</h2>
<p>I've had moments of wondering if I really did the right thing by leaving academia (usually when some reward of academia is made particularly salient). However, the thought doesn't usually last long.</p>
<p>Simply put, I value the types of freedom an industry job gives me far more than the types academia does. I have less freedom now in terms of what specific projects I take on. However, I have much more freedom to define where I live, what industry I work in, and all of the freedoms involved in having a much more secure financial situation. There are also a number of different ways I could take my career - I could transition into a management position or stay closer to development/implementation. I could try freelancing or consulting. While I'm happy where I am right now, it's good to know that I have a lot of options for the future.</p>Does the Muslim ban make us safer?2017-03-10T00:00:00-05:002017-03-10T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2017-03-10:/does-the-muslim-ban-make-us-safer<p>On March 6, Donald Trump signed a second executive order banning people from certain majority-muslim countries from entering the USA. The previous order banned citizens of seven countries: Syria, Iran, Sudan, Libya, Somalia, Yemen, and Iraq, but was stopped after legal action. The new ban applies to six countries - Iraq …</p><p>On March 6, Donald Trump signed a second executive order banning people from certain majority-muslim countries from entering the USA. The previous order banned citizens of seven countries: Syria, Iran, Sudan, Libya, Somalia, Yemen, and Iraq, but was stopped after legal action. The new ban applies to six countries - Iraq is not included - and uses different wording in the hopes of being on firmer legal ground.</p>
<p>Trump and his administration <a href="http://www.cnbc.com/2017/01/29/trump-america-proud-nation-of-immigrants-says-this-is-not-about-religion.html">have claimed that this ban is to protect Americans</a>. How effective is this ban for that purpose? I looked at data originally collected by <a href="https://www.newamerica.org/in-depth/terrorism-in-america/part-i-overview-terrorism-cases-2001-today/">New America</a>. This data is from records of criminal convictions and deaths of terrorists. The data contains terrorist activity from after 9/11 up to 2017.</p>
<p>The ban is supposed to protect Americans from terrorism. An obvious metric we can look at for how much harm terrorists from the banned countries do to America is looking at the number of people killed on American soil by terrorists from these countries.</p>
<p><img alt="Terrorism deaths" src="https://tommyblanchard.com/images/terrorism/terror-fig1.png"></p>
<p>Immigration control isn't going to be of much help curbing harm from terrorists, since the vast majority of terrorism-related deaths are caused by people born in America. A few were caused by people born in other countries, and absolutely none by people from the banned countries.</p>
<p>However, the fact that terrorists from these countries didn't kill anyone does not mean that there are no terrorists from these countries, contrary to <a href="http://www.seattletimes.com/nation-world/nation-politics/ap-fact-check-no-arrests-from-7-nations-in-travel-ban-nope/">false claims by a federal judge</a>. I was surprised to find that quite a few terrorists come from the banned countries - 58, if we include naturalized citizens and permanent residents. However the breakdown of where they come from is interesting. The vast majority of terrorists from the banned countries come from Somalia. None came from Libya. However, of those that come from the banned countries, most are naturalized citizens or permanent residents, and thus would not have been affected by the ban (except the first ban, which originally applied to permanent residents).</p>
<p><img alt="Terrorist origins" src="https://tommyblanchard.com/images/terrorism/terror-fig2.png"></p>
<p>It's important to put the threat foreign terrorists pose to America in context. Currently, <a href="http://www.people-press.org/2017/01/24/after-seismic-political-shift-modest-changes-in-publics-policy-agenda/">even among Democrats, a majority list terrorism as a top policy priority</a>. But would we actually be significantly safer even if we somehow managed to eliminate all terrorism caused by people born outside of America?</p>
<p>25 deaths over 16 years is not a very large number. On average, only slightly more people die each year by foreign terrorists as from alligator attacks or during enema administrations. More than twice as many people die riding roller-coasters, and the number of people killed each year by lightning is is one and a half times greater than the total number of people killed by foreign terrorists since 9/11.</p>
<p><img alt="Rare deaths" src="https://tommyblanchard.com/images/terrorism/terror-fig3.png"></p>
<p>There are plenty of costs to the Muslim ban - it exacerbates <a href="https://www.scientificamerican.com/article/trump-immigration-ban-can-worsen-u-s-doctor-shortage-hurt-hospitals/">the doctor shortage</a> and it <a href="http://www.slate.com/articles/health_and_science/climate_desk/2017/02/trump_s_ban_will_also_staunch_scientific_progress.html">hurts U.S. science</a>. Many worry that <a href="http://www.nbcnews.com/news/us-news/trump-travel-ban-makes-america-less-safe-ex-top-security-n717206">the move hurts intelligence gathering</a> on terrorist organizations by hurting relations with the banned countries, making us less safe from terrorists.</p>
<p>In terms of protecting Americans, legislation on roller-coasters would likely be more effective at keeping Americans safe than immigration policy reform possibly could.</p>
<p><em>Sources for non-terrorism death rates:</em></p>
<p>Alligators: <a href="https://en.wikipedia.org/wiki/List_of_fatal_alligator_attacks_in_the_United_States">Wikipedia</a>. Data for 2001-2017</p>
<p>Enema administration: <a href="https://wonder.cdc.gov/controller/datarequest/D132">Centers for Disease Control and Prevention</a>. Data for 1999-2016.</p>
<p>Roller-coasters: <a href="http://injuryprevention.bmj.com/content/11/5/309">Injury Prevention</a>. Data for 1994-2004</p>
<p>Lightning: <a href="http://origin-www.nws.noaa.gov/om/lightning/resources/RecentLightningDeaths.pdf">National Weather Service</a>. Data for 2006-2013</p>Movie Genre Ratings - Addendum2017-02-24T00:00:00-05:002017-02-24T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2017-02-24:/movie-genre-ratings-addendum<p>Some additional thoughts and analysis on differences in critics' and audiences' ratings of different movie genres</p><br /><header id="attribution" style="color:#999; font-size: 120%; text-align: center">
<b>This article was created with Jupyter. To see the code generating all figures and outputs, click 'Show Code'</b>
</header>
<script>
function code_toggle() {
if (code_shown){
$('div.input').hide('500');
$('#toggleButton').val('Show Code')
} else {
$('div.input').show('500');
$('#toggleButton').val('Hide Code')
}
code_shown = !code_shown
}
$( document ).ready(function(){
code_shown=false;
$('div.input').hide()
});
</script>
<div style="text-align: center;"><form action="javascript:code_toggle()"><input id="toggleButton" style="font-size: 200%; width: 10em" type="submit" value="Show Code" /></form></div><br /><div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="Introduction"><center>Introduction</center><a class="anchor-link" href="#Introduction">¶</a></h1><p>In <a href="https://tommyblanchard.com/movie-genre-ratings">a previous post</a>, I looked at trends in critic and audience ratings of movies. One finding was that critics on average rate movies lower than audiences. One potential explanation for this is that there is more selection bias with audience ratings - only people who are an audience likely to enjoy a film will tend to see (and therefore rate) it. In other words, if you asked an audience member or a critic how much enjoyment they would get out of seeing a film they rated a 5, you would get similar responses.</p>
<p>However, an alternative explanation is that when I compare audience and critic responses, I'm comparing apples and oranges. Maybe critics, having made a career of rating things, actually have a better calibrated rating scale. As a population, they use a wider range of values. Under this explanation, a 5 from an audience (around the lowest I saw for any movie) is actually more like a 2 from a critic.</p>
<p>Which interpretation is correct? I originally went with the 'they use the same scale' interpretation, partially because I think it holds merit and partially because it leads to numbers that are easier to digest. A 2 point difference on a 10 point scale is meaningful to most people in a way that 1.5 standard deviations is not. However, it's still interesting to see what happens if we use normalized values.</p>
<p>I executed all of the same code, but with normalized (z-scored) values. For the non-stats savvy people: I've just made it so the range of the ratings are about the same for the audience and critic ratings, and made it so an 'average' rating is a 0. This is easier to see in the first figure (compare to the previous post).</p>
<h1 id="-Visualizing-Normalized-Movie-Ratings-"><center> Visualizing Normalized Movie Ratings </center><a class="anchor-link" href="#-Visualizing-Normalized-Movie-Ratings-">¶</a></h1>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [1]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="o">%</span><span class="k">matplotlib</span> inline
<span class="c1">#Import some tools we'll use</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">bokeh.palettes</span> <span class="k">import</span> <span class="n">Category20</span><span class="p">,</span> <span class="n">Category20b</span>
<span class="kn">from</span> <span class="nn">bokeh.plotting</span> <span class="k">import</span> <span class="n">figure</span><span class="p">,</span> <span class="n">show</span><span class="p">,</span> <span class="n">output_notebook</span>
<span class="kn">from</span> <span class="nn">bokeh.models</span> <span class="k">import</span> <span class="n">ColumnDataSource</span><span class="p">,</span> <span class="n">Range1d</span><span class="p">,</span> <span class="n">LabelSet</span><span class="p">,</span> <span class="n">Label</span><span class="p">,</span> <span class="n">HoverTool</span>
<span class="kn">from</span> <span class="nn">bokeh.charts.attributes</span> <span class="k">import</span> <span class="n">CatAttr</span>
<span class="kn">from</span> <span class="nn">bokeh.charts</span> <span class="k">import</span> <span class="n">Bar</span>
<span class="kn">from</span> <span class="nn">scipy.stats.mstats</span> <span class="k">import</span> <span class="n">zscore</span>
<span class="c1">#Only output floats to one decimal place in tables</span>
<span class="n">pd</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">display</span><span class="o">.</span><span class="n">float_format</span> <span class="o">=</span> <span class="s1">'</span><span class="si">{:,.1f}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span>
<span class="n">output_notebook</span><span class="p">(</span><span class="n">hide_banner</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt"></div>
<div class="output_html rendered_html output_subarea">
</div>
</div>
<div class="output_area">
<div class="prompt"></div>
<div id="18b5e1a1-c737-4182-9049-2e529616c5c0"></div>
<div class="output_subarea output_javascript">
<script type="text/javascript">
var element = $('#18b5e1a1-c737-4182-9049-2e529616c5c0');
(function(global) {
function now() {
return new Date();
}
var force = true;
if (typeof (window._bokeh_onload_callbacks) === "undefined" || force === true) {
window._bokeh_onload_callbacks = [];
window._bokeh_is_loading = undefined;
}
if (typeof (window._bokeh_timeout) === "undefined" || force === true) {
window._bokeh_timeout = Date.now() + 5000;
window._bokeh_failed_load = false;
}
var NB_LOAD_WARNING = {'data': {'text/html':
"<div style='background-color: #fdd'>\n"+
"<p>\n"+
"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \n"+
"may be due to a slow or bad network connection. Possible fixes:\n"+
"</p>\n"+
"<ul>\n"+
"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\n"+
"<li>use INLINE resources instead, as so:</li>\n"+
"</ul>\n"+
"<code>\n"+
"from bokeh.resources import INLINE\n"+
"output_notebook(resources=INLINE)\n"+
"</code>\n"+
"</div>"}};
function display_loaded() {
if (window.Bokeh !== undefined) {
document.getElementById("").textContent = "BokehJS successfully loaded.";
} else if (Date.now() < window._bokeh_timeout) {
setTimeout(display_loaded, 100)
}
}
function run_callbacks() {
window._bokeh_onload_callbacks.forEach(function(callback) { callback() });
delete window._bokeh_onload_callbacks
console.info("Bokeh: all callbacks have finished");
}
function load_libs(js_urls, callback) {
window._bokeh_onload_callbacks.push(callback);
if (window._bokeh_is_loading > 0) {
console.log("Bokeh: BokehJS is being loaded, scheduling callback at", now());
return null;
}
if (js_urls == null || js_urls.length === 0) {
run_callbacks();
return null;
}
console.log("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
window._bokeh_is_loading = js_urls.length;
for (var i = 0; i < js_urls.length; i++) {
var url = js_urls[i];
var s = document.createElement('script');
s.src = url;
s.async = false;
s.onreadystatechange = s.onload = function() {
window._bokeh_is_loading--;
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: all BokehJS libraries loaded");
run_callbacks()
}
};
s.onerror = function() {
console.warn("failed to load library " + url);
};
console.log("Bokeh: injecting script tag for BokehJS library: ", url);
document.getElementsByTagName("head")[0].appendChild(s);
}
};
var js_urls = ["https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.js", "https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.js"];
var inline_js = [
function(Bokeh) {
Bokeh.set_log_level("info");
},
function(Bokeh) {
console.log("Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css");
Bokeh.embed.inject_css("https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css");
console.log("Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css");
Bokeh.embed.inject_css("https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css");
}
];
function run_inline_js() {
if ((window.Bokeh !== undefined) || (force === true)) {
for (var i = 0; i < inline_js.length; i++) {
inline_js[i](window.Bokeh);
}} else if (Date.now() < window._bokeh_timeout) {
setTimeout(run_inline_js, 100);
} else if (!window._bokeh_failed_load) {
console.log("Bokeh: BokehJS failed to load within specified timeout.");
window._bokeh_failed_load = true;
} else if (force !== true) {
var cell = $(document.getElementById("")).parents('.cell').data().cell;
cell.output_area.append_execute_result(NB_LOAD_WARNING)
}
}
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: BokehJS loaded, going straight to plotting");
run_inline_js();
} else {
load_libs(js_urls, function() {
console.log("Bokeh: BokehJS plotting callback run at", now());
run_inline_js();
});
}
}(this));
</script>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [2]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">###Just copying and pasting the code from the other notebook and zscoring</span>
<span class="c1">##DATA PREP</span>
<span class="c1">#Read in the data</span>
<span class="n">mov</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_csv</span><span class="p">(</span><span class="s1">'blockbuster-top_ten_movies_per_year_DFE.csv'</span><span class="p">)</span>
<span class="c1">#Remove columns where data is missing</span>
<span class="n">mov</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[(</span><span class="n">mov</span><span class="p">[</span><span class="s1">'rt_score'</span><span class="p">]</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">&</span> <span class="p">(</span><span class="n">mov</span><span class="p">[</span><span class="s1">'rt_audience_score'</span><span class="p">]</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">&</span> <span class="p">(</span><span class="o">~</span><span class="n">pd</span><span class="o">.</span><span class="n">isnull</span><span class="p">(</span><span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_1'</span><span class="p">]))]</span>
<span class="c1">#rt_score is on a 1 to 10 scale, rt_audience_score is 0.5 to 5. Let's rescale</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'rt_audience_score'</span><span class="p">]</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[</span><span class="s1">'rt_audience_score'</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span>
<span class="c1">#Only include those columns we want</span>
<span class="n">mov</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[[</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'rt_audience_score'</span><span class="p">,</span><span class="s1">'rt_score'</span><span class="p">,</span><span class="s1">'Genre_1'</span><span class="p">,</span><span class="s1">'Genre_2'</span><span class="p">,</span><span class="s1">'Genre_3'</span><span class="p">]]</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'rt_audience_score'</span><span class="p">]</span> <span class="o">=</span> <span class="n">zscore</span><span class="p">(</span><span class="n">mov</span><span class="p">[</span><span class="s1">'rt_audience_score'</span><span class="p">])</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'rt_score'</span><span class="p">]</span> <span class="o">=</span> <span class="n">zscore</span><span class="p">(</span><span class="n">mov</span><span class="p">[</span><span class="s1">'rt_score'</span><span class="p">])</span>
<span class="c1">#Calculate difference between audience and critic scores (to use later)</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'dif'</span><span class="p">]</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[</span><span class="s1">'rt_audience_score'</span><span class="p">]</span> <span class="o">-</span> <span class="n">mov</span><span class="p">[</span><span class="s1">'rt_score'</span><span class="p">]</span>
<span class="c1">#Generate a unique color based on whatever the first genre is for each movie, for plotting</span>
<span class="n">cat</span> <span class="o">=</span> <span class="n">Category20</span><span class="p">[</span><span class="mi">20</span><span class="p">]</span>
<span class="n">cat</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Category20b</span><span class="p">[</span><span class="mi">3</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
<span class="n">genres</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_1'</span><span class="p">]</span><span class="o">.</span><span class="n">unique</span><span class="p">()</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'colors'</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="n">cat</span><span class="p">[</span><span class="n">np</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">genres</span> <span class="o">==</span> <span class="n">genre</span><span class="p">)[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">]]</span> <span class="k">for</span> <span class="n">genre</span> <span class="ow">in</span> <span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_1'</span><span class="p">]]</span>
<span class="c1">#Generate a genre string based on the three genres (to prevent hover tooltips from displaying nans)</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_str'</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_1'</span><span class="p">]</span> <span class="o">+</span> <span class="s1">' '</span> <span class="o">+</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_2'</span><span class="p">]</span><span class="o">.</span><span class="n">fillna</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span> <span class="o">+</span> <span class="s1">' '</span> <span class="o">+</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_3'</span><span class="p">]</span><span class="o">.</span><span class="n">fillna</span><span class="p">(</span><span class="s1">''</span><span class="p">))</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [3]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">#Themes aren't really supported yet in Bokeh, so define a function to do styling</span>
<span class="k">def</span> <span class="nf">styleBokeh</span><span class="p">(</span><span class="n">p</span><span class="p">):</span>
<span class="c1">#Hide the bokeh toolbar</span>
<span class="n">p</span><span class="o">.</span><span class="n">toolbar_location</span> <span class="o">=</span> <span class="kc">None</span>
<span class="c1">#Format axis label fonts</span>
<span class="n">p</span><span class="o">.</span><span class="n">yaxis</span><span class="o">.</span><span class="n">axis_label_text_font_size</span> <span class="o">=</span> <span class="s2">"12pt"</span>
<span class="n">p</span><span class="o">.</span><span class="n">yaxis</span><span class="o">.</span><span class="n">axis_label_text_font_style</span> <span class="o">=</span> <span class="s2">"normal"</span>
<span class="n">p</span><span class="o">.</span><span class="n">xaxis</span><span class="o">.</span><span class="n">axis_label_text_font_size</span> <span class="o">=</span> <span class="s2">"12pt"</span>
<span class="n">p</span><span class="o">.</span><span class="n">xaxis</span><span class="o">.</span><span class="n">axis_label_text_font_style</span> <span class="o">=</span> <span class="s2">"normal"</span>
<span class="n">p</span><span class="o">.</span><span class="n">xaxis</span><span class="o">.</span><span class="n">major_label_text_font_size</span> <span class="o">=</span> <span class="s2">"10pt"</span>
<span class="n">p</span><span class="o">.</span><span class="n">yaxis</span><span class="o">.</span><span class="n">major_label_text_font_size</span> <span class="o">=</span> <span class="s2">"10pt"</span>
<span class="c1">#Change title font size</span>
<span class="n">p</span><span class="o">.</span><span class="n">title</span><span class="o">.</span><span class="n">text_font_size</span><span class="o">=</span><span class="s1">'14pt'</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [4]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">##SCATTER PLOT ALL MOVIES</span>
<span class="c1">#Make a data source for bokeh to use</span>
<span class="n">mov_source</span> <span class="o">=</span> <span class="n">ColumnDataSource</span><span class="p">(</span><span class="n">mov</span><span class="p">)</span>
<span class="c1">#We want the axes on the same scale, so figure out min of both and max of both</span>
<span class="n">low</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[[</span><span class="s1">'rt_audience_score'</span><span class="p">,</span><span class="s1">'rt_score'</span><span class="p">]]</span><span class="o">.</span><span class="n">min</span><span class="p">()</span><span class="o">.</span><span class="n">min</span><span class="p">()</span> <span class="o">-</span> <span class="mf">0.2</span>
<span class="n">high</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[[</span><span class="s1">'rt_audience_score'</span><span class="p">,</span><span class="s1">'rt_score'</span><span class="p">]]</span><span class="o">.</span><span class="n">max</span><span class="p">()</span><span class="o">.</span><span class="n">max</span><span class="p">()</span> <span class="o">+</span> <span class="mf">0.2</span>
<span class="c1">#Define the hover over tooltips</span>
<span class="n">hover</span> <span class="o">=</span> <span class="n">HoverTool</span><span class="p">(</span>
<span class="n">tooltips</span><span class="o">=</span><span class="p">[(</span><span class="s2">"Title"</span><span class="p">,</span> <span class="s2">"@title"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Audience Score"</span><span class="p">,</span> <span class="s2">"@rt_audience_score</span><span class="si">{0.0}</span><span class="s2">"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Critic Score"</span><span class="p">,</span> <span class="s2">"@rt_score</span><span class="si">{0.0}</span><span class="s2">"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Genres"</span><span class="p">,</span> <span class="s2">"@Genre_str"</span><span class="p">)</span>
<span class="p">]</span>
<span class="p">)</span>
<span class="c1">#Make the figure</span>
<span class="n">p</span> <span class="o">=</span> <span class="n">figure</span><span class="p">(</span><span class="n">title</span> <span class="o">=</span> <span class="s2">"Movie critic and audience ratings"</span><span class="p">,</span>
<span class="n">x_range</span><span class="o">=</span><span class="n">Range1d</span><span class="p">(</span><span class="n">low</span><span class="p">,</span> <span class="n">high</span><span class="p">),</span>
<span class="n">y_range</span><span class="o">=</span><span class="n">Range1d</span><span class="p">(</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span>
<span class="n">tools</span><span class="o">=</span><span class="p">[</span><span class="n">hover</span><span class="p">])</span>
<span class="c1">#We'll put critic ratings on the x-axis and audience on the y-axis</span>
<span class="n">p</span><span class="o">.</span><span class="n">xaxis</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">axis_label</span> <span class="o">=</span> <span class="s1">'Critic Rating'</span>
<span class="n">p</span><span class="o">.</span><span class="n">yaxis</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">axis_label</span> <span class="o">=</span> <span class="s1">'Audience Rating'</span>
<span class="c1">#Add a diagonal line for where audience rating = critic rating</span>
<span class="n">p</span><span class="o">.</span><span class="n">line</span><span class="p">((</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span> <span class="p">(</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span><span class="n">line_color</span><span class="o">=</span><span class="s2">"red"</span><span class="p">,</span> <span class="n">line_width</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
<span class="c1">#Plot the points, coloring by Genre_1</span>
<span class="n">p</span><span class="o">.</span><span class="n">scatter</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s1">'rt_score'</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s1">'rt_audience_score'</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">mov_source</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s1">'colors'</span><span class="p">,</span>
<span class="n">size</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span> <span class="n">fill_alpha</span> <span class="o">=</span> <span class="mi">1</span><span class="p">)</span>
<span class="n">styleBokeh</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="n">show</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt"></div>
<div class="output_html rendered_html output_subarea">
<div class="bk-root">
<div class="bk-plotdiv" id="a54e96a0-1e33-4cb6-834b-960e835a72c5"></div>
</div>
<script type="text/javascript">
(function(global) {
function now() {
return new Date();
}
var force = false;
if (typeof (window._bokeh_onload_callbacks) === "undefined" || force === true) {
window._bokeh_onload_callbacks = [];
window._bokeh_is_loading = undefined;
}
if (typeof (window._bokeh_timeout) === "undefined" || force === true) {
window._bokeh_timeout = Date.now() + 0;
window._bokeh_failed_load = false;
}
var NB_LOAD_WARNING = {'data': {'text/html':
"<div style='background-color: #fdd'>\n"+
"<p>\n"+
"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \n"+
"may be due to a slow or bad network connection. Possible fixes:\n"+
"</p>\n"+
"<ul>\n"+
"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\n"+
"<li>use INLINE resources instead, as so:</li>\n"+
"</ul>\n"+
"<code>\n"+
"from bokeh.resources import INLINE\n"+
"output_notebook(resources=INLINE)\n"+
"</code>\n"+
"</div>"}};
function display_loaded() {
if (window.Bokeh !== undefined) {
document.getElementById("a54e96a0-1e33-4cb6-834b-960e835a72c5").textContent = "BokehJS successfully loaded.";
} else if (Date.now() < window._bokeh_timeout) {
setTimeout(display_loaded, 100)
}
}
function run_callbacks() {
window._bokeh_onload_callbacks.forEach(function(callback) { callback() });
delete window._bokeh_onload_callbacks
console.info("Bokeh: all callbacks have finished");
}
function load_libs(js_urls, callback) {
window._bokeh_onload_callbacks.push(callback);
if (window._bokeh_is_loading > 0) {
console.log("Bokeh: BokehJS is being loaded, scheduling callback at", now());
return null;
}
if (js_urls == null || js_urls.length === 0) {
run_callbacks();
return null;
}
console.log("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
window._bokeh_is_loading = js_urls.length;
for (var i = 0; i < js_urls.length; i++) {
var url = js_urls[i];
var s = document.createElement('script');
s.src = url;
s.async = false;
s.onreadystatechange = s.onload = function() {
window._bokeh_is_loading--;
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: all BokehJS libraries loaded");
run_callbacks()
}
};
s.onerror = function() {
console.warn("failed to load library " + url);
};
console.log("Bokeh: injecting script tag for BokehJS library: ", url);
document.getElementsByTagName("head")[0].appendChild(s);
}
};var element = document.getElementById("a54e96a0-1e33-4cb6-834b-960e835a72c5");
if (element == null) {
console.log("Bokeh: ERROR: autoload.js configured with elementid 'a54e96a0-1e33-4cb6-834b-960e835a72c5' but no matching script tag was found. ")
return false;
}
var js_urls = [];
var inline_js = [
function(Bokeh) {
(function() {
var fn = function() {
var docs_json = {"ab8d509f-3521-4516-9fb9-bc3b111f4117":{"roots":{"references":[{"attributes":{},"id":"9ab9ad4d-1c16-441b-8864-defb64c2162c","type":"BasicTicker"},{"attributes":{"dimension":1,"plot":{"id":"c6219ddb-bf56-4ed2-bffc-656bd99df910","subtype":"Figure","type":"Plot"},"ticker":{"id":"9ab9ad4d-1c16-441b-8864-defb64c2162c","type":"BasicTicker"}},"id":"a53d78a6-aab8-42ff-a475-56ab0655f84e","type":"Grid"},{"attributes":{"axis_label":"Critic Rating","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"cd81ea7c-a353-4dce-8774-338feeac910e","type":"BasicTickFormatter"},"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"c6219ddb-bf56-4ed2-bffc-656bd99df910","subtype":"Figure","type":"Plot"},"ticker":{"id":"6c8ae3bc-2c7b-4ff8-88b8-10e0948041c5","type":"BasicTicker"}},"id":"11b7081f-ba8c-4f1d-85b3-25ea8e586693","type":"LinearAxis"},{"attributes":{"data_source":{"id":"010223e2-f215-4c81-bdb8-f36ee805da7f","type":"ColumnDataSource"},"glyph":{"id":"cc0105f1-d43f-407c-955d-09cc6bbc4825","type":"Circle"},"hover_glyph":null,"nonselection_glyph":{"id":"de245f22-a899-4676-8234-0a467ae8d47a","type":"Circle"},"selection_glyph":null},"id":"e5f3d1a7-44f2-4131-98a5-e354090deaf3","type":"GlyphRenderer"},{"attributes":{},"id":"6b4a2c9a-a7d6-4715-a989-14973d53d58e","type":"ToolEvents"},{"attributes":{"callback":null,"plot":{"id":"c6219ddb-bf56-4ed2-bffc-656bd99df910","subtype":"Figure","type":"Plot"},"tooltips":[["Title","@title"],["Audience Score","@rt_audience_score{0.0}"],["Critic Score","@rt_score{0.0}"],["Genres","@Genre_str"]]},"id":"93cada5a-7037-4869-9254-13fa817b509c","type":"HoverTool"},{"attributes":{"callback":null,"end":2.634629390026345,"start":-3.2888788534450852},"id":"19412676-85c4-4ffb-9b1a-1817a075c765","type":"Range1d"},{"attributes":{"callback":null,"column_names":["x","y"],"data":{"x":[-3.2888788534450852,2.634629390026345],"y":[-3.2888788534450852,2.634629390026345]}},"id":"57836677-22ce-4948-bd37-c039b841e705","type":"ColumnDataSource"},{"attributes":{"active_drag":"auto","active_scroll":"auto","active_tap":"auto","tools":[{"id":"93cada5a-7037-4869-9254-13fa817b509c","type":"HoverTool"}]},"id":"802b032c-b83a-4934-9289-640624566095","type":"Toolbar"},{"attributes":{},"id":"6c8ae3bc-2c7b-4ff8-88b8-10e0948041c5","type":"BasicTicker"},{"attributes":{"plot":null,"text":"Movie critic and audience ratings","text_font_size":{"value":"14pt"}},"id":"2692beee-8608-49a8-9dca-f0d8847feae8","type":"Title"},{"attributes":{},"id":"d2e4d898-45e9-47e7-870b-afb9e2e518c4","type":"BasicTickFormatter"},{"attributes":{"plot":{"id":"c6219ddb-bf56-4ed2-bffc-656bd99df910","subtype":"Figure","type":"Plot"},"ticker":{"id":"6c8ae3bc-2c7b-4ff8-88b8-10e0948041c5","type":"BasicTicker"}},"id":"4d65dcde-4cb6-476a-a458-e101d5175069","type":"Grid"},{"attributes":{"data_source":{"id":"57836677-22ce-4948-bd37-c039b841e705","type":"ColumnDataSource"},"glyph":{"id":"03bf83c6-07e9-4224-b557-a43b0902f289","type":"Line"},"hover_glyph":null,"nonselection_glyph":{"id":"eb5cc063-2244-40e3-a5b9-4bdf2234e500","type":"Line"},"selection_glyph":null},"id":"518bc818-1715-476c-85ef-fb06b111994c","type":"GlyphRenderer"},{"attributes":{"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"line_width":{"value":5},"x":{"field":"x"},"y":{"field":"y"}},"id":"eb5cc063-2244-40e3-a5b9-4bdf2234e500","type":"Line"},{"attributes":{"below":[{"id":"11b7081f-ba8c-4f1d-85b3-25ea8e586693","type":"LinearAxis"}],"left":[{"id":"b51be1bb-4833-4cc9-bf4a-0bba5903c6aa","type":"LinearAxis"}],"renderers":[{"id":"11b7081f-ba8c-4f1d-85b3-25ea8e586693","type":"LinearAxis"},{"id":"4d65dcde-4cb6-476a-a458-e101d5175069","type":"Grid"},{"id":"b51be1bb-4833-4cc9-bf4a-0bba5903c6aa","type":"LinearAxis"},{"id":"a53d78a6-aab8-42ff-a475-56ab0655f84e","type":"Grid"},{"id":"518bc818-1715-476c-85ef-fb06b111994c","type":"GlyphRenderer"},{"id":"e5f3d1a7-44f2-4131-98a5-e354090deaf3","type":"GlyphRenderer"}],"title":{"id":"2692beee-8608-49a8-9dca-f0d8847feae8","type":"Title"},"tool_events":{"id":"6b4a2c9a-a7d6-4715-a989-14973d53d58e","type":"ToolEvents"},"toolbar":{"id":"802b032c-b83a-4934-9289-640624566095","type":"Toolbar"},"toolbar_location":null,"x_range":{"id":"19412676-85c4-4ffb-9b1a-1817a075c765","type":"Range1d"},"y_range":{"id":"bdb7b5cd-4a1f-4c25-8a97-8f35f0f01fc1","type":"Range1d"}},"id":"c6219ddb-bf56-4ed2-bffc-656bd99df910","subtype":"Figure","type":"Plot"},{"attributes":{},"id":"cd81ea7c-a353-4dce-8774-338feeac910e","type":"BasicTickFormatter"},{"attributes":{"line_alpha":{"value":0.5},"line_color":{"value":"red"},"line_width":{"value":5},"x":{"field":"x"},"y":{"field":"y"}},"id":"03bf83c6-07e9-4224-b557-a43b0902f289","type":"Line"},{"attributes":{"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"size":{"units":"screen","value":8},"x":{"field":"rt_score"},"y":{"field":"rt_audience_score"}},"id":"de245f22-a899-4676-8234-0a467ae8d47a","type":"Circle"},{"attributes":{"fill_color":{"field":"colors"},"line_color":{"field":"colors"},"size":{"units":"screen","value":8},"x":{"field":"rt_score"},"y":{"field":"rt_audience_score"}},"id":"cc0105f1-d43f-407c-955d-09cc6bbc4825","type":"Circle"},{"attributes":{"callback":null,"column_names":["Genre_1","Genre_3","rt_audience_score","colors","title","rt_score","Genre_str","Genre_2","dif","index"],"data":{"Genre_1":["Sci-Fi","Sci-Fi","Sci-Fi","Sci-Fi","Family","Fantasy","Fantasy","Sci-Fi","Sci-Fi","Sci-Fi","Family","Thriller","Comedy","Thriller","Sci-Fi","Fantasy","Comedy","Fantasy","Adventure","Fantasy","Comedy","Comedy","Sci-Fi","Thriller","Fantasy","Sci-Fi","Thriller","Fantasy","Sci-Fi","Fantasy","Comedy","Thriller","Mystery","Animation","Thriller","Fantasy","Comedy","Comedy","Sci-Fi","Fantasy","Family","Fantasy","Family","Sci-Fi","Sci-Fi","Comedy","Family","Fantasy","Comedy","Sci-Fi","Thriller","Fantasy","Fantasy","Animation","Crime","Comedy","Fantasy","Sci-Fi","Comedy","Fantasy","Adventure","Sci-Fi","Animation","Animation","Romance","Adventure","Family","Drama","Family","War","Fantasy","Thriller","Mystery","Fantasy","Family","Comedy","Adventure","Comedy","Sci-Fi","Comedy","Thriller","Family","Animation","Thriller","Comedy","Fantasy","Fantasy","Thriller","Sci-Fi","Adventure","Comedy","Fantasy","Romance","Drama","Comedy","Crime","Fantasy","Fantasy","Thriller","Fantasy","Romance","Thriller","Comedy","Comedy","Adventure","Sci-Fi","Animation","Drama","Adventure","Crime","Fantasy","Comedy","Fantasy","Sci-Fi","History","Fantasy","Sci-Fi","Sci-Fi","Sci-Fi","Crime","Fantasy","Comedy","Fantasy","Sci-Fi","Romance","Thriller","Adventure","Fantasy","Fantasy","Thriller","Fantasy","Sci-Fi","Comedy","Thriller","Romance","Sci-Fi","Comedy","Fantasy","Fantasy","Drama","Family","Drama","Fantasy","Comedy","Thriller","Drama","Mystery","Romance","Sci-Fi","Romance","Comedy","Romance","Fantasy","Drama","Sci-Fi","Fantasy","Thriller","Crime","Comedy","Comedy","Sci-Fi","Sci-Fi","Fantasy","Thriller","Thriller","Family","War","Romance","Romance","Drama","Romance","Comedy","Sci-Fi","Romance","Sci-Fi","Music","Sci-Fi","Romance","Thriller","Family","Mystery","Sci-Fi","Romance","Thriller","Thriller","Family","Sci-Fi","Thriller","Drama","History","Fantasy","Fantasy","Thriller","Thriller","Fantasy","Drama","Mystery","Comedy","Sci-Fi","Drama","Comedy","Romance","Romance","Romance","Thriller","Fantasy","Drama","Fantasy","Thriller","Thriller","Romance","Thriller","Family","Drama","History","Romance","Thriller","Crime","Drama","Thriller","Comedy","Thriller","Action","Romance","Family","Thriller","Music","Music","Music","Fantasy","Thriller","Western","Family","Comedy","Thriller","Drama","Sci-Fi","Fantasy","Thriller","Romance","Western","Thriller","Romance","Family","Crime","Mystery","Romance","Comedy","Action","Sci-Fi","Adventure","War","Drama","Horror","Family","Adventure","Thriller","Romance","Fantasy","Comedy","Comedy","Fantasy","Romance","Romance","Thriller","Drama","Crime","Comedy","Crime","Crime","Thriller","War","Thriller","Romance","Thriller","Comedy","Thriller","Horror","Family","Adventure","Sci-Fi","Drama","Sport","War","Crime","Comedy","Comedy","Romance","Romance","Romance","Sci-Fi","Romance","Thriller","Sport","Comedy","Drama","Family","Comedy","Romance","Comedy","Romance","Fantasy","Horror","Action","Comedy","Comedy","Sci-Fi","Family","Sci-Fi","Romance","Drama","Thriller","Drama","Fantasy","Romance","Thriller","Drama","Comedy","Thriller","Crime","Romance","Family","Sci-Fi","Horror","Comedy","Sport","Drama","Musical","Romance","Romance","Sport","Thriller","Drama","Adventure","War","Sci-Fi","Comedy","Drama","Fantasy","Comedy","Comedy","Comedy","Music","War","Crime","Adventure","Crime","Romance","Crime","Romance","Sci-Fi","War","Drama","Crime","Sport","Sci-Fi","Horror","Comedy","Family","Horror","Comedy","Romance","Sport","Comedy","Thriller","Comedy","Mystery","Sci-Fi","War","War","Romance","Sci-Fi","Fantasy","Romance","Romance","Fantasy","Thriller","Romance","Thriller","Romance","Thriller","Horror","History","Sport","Crime","Thriller","Mystery","Drama","Musical","Romance","Western","Mystery","Thriller"],"Genre_2":["Adventure","Drama","Adventure","Adventure","Adventure","Adventure","Adventure","Adventure","Adventure","Adventure","Comedy","Crime","Animation","Sci-Fi","Adventure","Adventure","Animation","Adventure","Sci-Fi","Adventure","Animation","Adventure","Comedy","Adventure","Adventure","Adventure","Action","Adventure","Adventure","Drama","Animation","Crime","Fantasy","Adventure","Adventure","Adventure","NaN","Animation","Adventure","Family","Comedy","Family","Animation","Mystery","Adventure","Animation","Comedy","Drama","Animation","Adventure","Mystery","Adventure","Family","Adventure","Adventure","NaN","Drama","Adventure","Animation","Action","Action","Adventure","Adventure","Adventure","Musical","Action","Adventure","Crime","Animation","Fantasy","Family","Sci-Fi","Adventure","Adventure","Comedy","Animation","Action","Animation","Adventure","Animation","Adventure","Comedy","Adventure","Adventure","Adventure","Adventure","Adventure","Mystery","Adventure","Action","Adventure","Family","Comedy","Adventure","Animation","Comedy","Adventure","Family","Sci-Fi","Family","Comedy","Crime","Adventure","Animation","Action","Adventure","Adventure","NaN","NaN","Comedy","Drama","Animation","Adventure","Action","Drama","Adventure","Action","Action","Adventure","Adventure","Family","Animation","Comedy","Mystery","Comedy","Sci-Fi","Action","Adventure","Adventure","Drama","Family","Adventure","Animation","Crime","Drama","Adventure","Animation","Adventure","Adventure","Adventure","Animation","Action","Family","NaN","Adventure","Adventure","Horror","Fantasy","Adventure","Drama","Adventure","Drama","Adventure","Animation","Action","Adventure","Mystery","Adventure","Animation","Animation","Adventure","Drama","Family","Sci-Fi","Crime","Animation","Drama","Drama","Comedy","Adventure","Drama","NaN","Comedy","Comedy","Adventure","Drama","Adventure","Drama","Adventure","Comedy","Drama","Adventure","Drama","Adventure","Crime","Drama","Romance","Adventure","Adventure","Drama","Adventure","Family","Adventure","Adventure","Family","Animation","Drama","Animation","Adventure","Crime","NaN","Drama","Drama","Horror","Crime","Family","Animation","Crime","Comedy","Adventure","Drama","Sci-Fi","Drama","NaN","Drama","Drama","Mystery","Adventure","Crime","Drama","Animation","Mystery","NaN","Horror","Comedy","Crime","Comedy","Drama","Comedy","Family","Crime","Comedy","Comedy","NaN","History","Adventure","Action","Comedy","NaN","Comedy","Drama","Action","Fantasy","Comedy","Comedy","Drama","Comedy","Adventure","Sci-Fi","Comedy","Action","Drama","NaN","Fantasy","Comedy","Action","Crime","Comedy","Family","Adventure","NaN","Drama","Drama","Comedy","Action","NaN","Comedy","NaN","Comedy","Comedy","Drama","Drama","Crime","Drama","Comedy","NaN","Drama","Fantasy","Drama","Comedy","Adventure","Comedy","Romance","Drama","Comedy","Adventure","Adventure","Family","Drama","Comedy","NaN","Drama","Adventure","Drama","Adventure","NaN","Comedy","Adventure","Drama","Action","Music","Comedy","Comedy","Adventure","NaN","Adventure","Adventure","Drama","Action","Music","Comedy","Adventure","Crime","Adventure","Music","Action","Comedy","NaN","Sci-Fi","Comedy","Drama","Drama","Family","NaN","NaN","Drama","Adventure","Comedy","Comedy","Comedy","History","Adventure","NaN","Action","Comedy","Romance","Action","Comedy","Comedy","NaN","NaN","Action","Drama","Comedy","Comedy","Action","Comedy","Drama","Comedy","Comedy","Horror","Drama","NaN","Adventure","Drama","Mystery","Drama","NaN","Comedy","Drama","Action","Musical","Romance","Action","Horror","NaN","Comedy","Drama","Drama","History","Drama","Drama","Comedy","Music","Comedy","Adventure","Mystery","Drama","Adventure","Music","Drama","Fantasy","Drama","Drama","Comedy","Crime","Horror","Crime","Drama","Drama","Family","Crime","Sci-Fi"],"Genre_3":["Action","Action","Action","NaN","Action","Action","NaN","NaN","Action","Action","Animation","Action","Adventure","Western","Action","Action","Adventure","NaN","NaN","Action","Adventure","Animation","Action","Action","Action","Action","NaN","NaN","NaN","Adventure","Adventure","Action","Adventure","Action","Action","Action","NaN","Adventure","Action","Adventure","Animation","Adventure","Adventure","Action","Action","Adventure","Animation","Adventure","Adventure","Action","NaN","Action","Adventure","Action","Action","NaN","Adventure","Action","Adventure","NaN","NaN","Action","Action","Action","Comedy","NaN","Action","Action","Adventure","Action","Adventure","Drama","Action","Action","Animation","Adventure","NaN","Adventure","Action","Adventure","Action","Animation","Action","Action","Action","Action","Action","NaN","Action","NaN","Family","Adventure","NaN","Action","Adventure","Action","Action","Adventure","Adventure","Adventure","NaN","NaN","Animation","Adventure","NaN","Action","Action","NaN","NaN","Action","Comedy","Adventure","NaN","NaN","Action","Western","NaN","NaN","Action","Action","Adventure","Adventure","Action","Action","NaN","Drama","NaN","Action","NaN","Crime","Adventure","Action","Adventure","NaN","Action","Action","Adventure","NaN","Action","NaN","Adventure","NaN","Comedy","NaN","Action","Action","Drama","Comedy","Action","NaN","Action","Comedy","Action","Adventure","NaN","Action","Drama","Action","Adventure","Adventure","Action","Action","Comedy","Action","Action","Adventure","Action","Comedy","NaN","Action","Comedy","NaN","NaN","NaN","Action","Comedy","Action","NaN","Action","Adventure","Action","Action","Comedy","Action","NaN","Animation","Comedy","Action","Action","Adventure","Action","Comedy","Action","Action","Adventure","Adventure","Thriller","Adventure","Action","Action","NaN","NaN","Comedy","NaN","Action","Comedy","Adventure","Comedy","Action","Action","NaN","Adventure","Comedy","NaN","Biography","Comedy","Drama","Action","Action","NaN","Adventure","Drama","NaN","NaN","Adventure","Action","NaN","Action","NaN","Animation","NaN","NaN","Adventure","NaN","Drama","Action","NaN","NaN","NaN","Adventure","Adventure","NaN","Drama","NaN","Action","Crime","NaN","Action","Mystery","Adventure","NaN","Biography","NaN","Comedy","Adventure","NaN","Action","NaN","Animation","Action","NaN","Comedy","Comedy","NaN","NaN","NaN","NaN","NaN","Animation","Action","NaN","Comedy","Action","Comedy","NaN","NaN","Crime","Comedy","Comedy","Crime","Action","Animation","Comedy","NaN","NaN","Action","Action","Action","Action","Adventure","NaN","Biography","Action","NaN","NaN","NaN","Adventure","Action","Crime","NaN","Drama","NaN","NaN","Drama","NaN","Action","Action","Action","NaN","Drama","Western","Action","Comedy","Action","Drama","NaN","NaN","NaN","NaN","Action","NaN","Comedy","Western","NaN","NaN","NaN","Action","NaN","NaN","NaN","Drama","Action","NaN","NaN","NaN","Action","NaN","NaN","Adventure","NaN","NaN","NaN","Biography","NaN","Action","Fantasy","NaN","Adventure","Action","NaN","NaN","NaN","NaN","Action","Action","Adventure","NaN","NaN","Adventure","NaN","NaN","NaN","Comedy","NaN","NaN","NaN","Crime","Action","NaN","Drama","Comedy","NaN","NaN","Drama","Action","Action","Adventure","Comedy","Action","Drama","NaN","Adventure","Action","NaN","Action","Action","Drama","NaN","Comedy","NaN","Comedy","Comedy","Drama"],"Genre_str":["Sci-Fi Adventure Action","Sci-Fi Drama Action","Sci-Fi Adventure Action","Sci-Fi Adventure ","Family Adventure Action","Fantasy Adventure Action","Fantasy Adventure ","Sci-Fi Adventure ","Sci-Fi Adventure Action","Sci-Fi Adventure Action","Family Comedy Animation","Thriller Crime Action","Comedy Animation Adventure","Thriller Sci-Fi Western","Sci-Fi Adventure Action","Fantasy Adventure Action","Comedy Animation Adventure","Fantasy Adventure ","Adventure Sci-Fi ","Fantasy Adventure Action","Comedy Animation Adventure","Comedy Adventure Animation","Sci-Fi Comedy Action","Thriller Adventure Action","Fantasy Adventure Action","Sci-Fi Adventure Action","Thriller Action ","Fantasy Adventure ","Sci-Fi Adventure ","Fantasy Drama Adventure","Comedy Animation Adventure","Thriller Crime Action","Mystery Fantasy Adventure","Animation Adventure Action","Thriller Adventure Action","Fantasy Adventure Action","Comedy ","Comedy Animation Adventure","Sci-Fi Adventure Action","Fantasy Family Adventure","Family Comedy Animation","Fantasy Family Adventure","Family Animation Adventure","Sci-Fi Mystery Action","Sci-Fi Adventure Action","Comedy Animation Adventure","Family Comedy Animation","Fantasy Drama Adventure","Comedy Animation Adventure","Sci-Fi Adventure Action","Thriller Mystery ","Fantasy Adventure Action","Fantasy Family Adventure","Animation Adventure Action","Crime Adventure Action","Comedy ","Fantasy Drama Adventure","Sci-Fi Adventure Action","Comedy Animation Adventure","Fantasy Action ","Adventure Action ","Sci-Fi Adventure Action","Animation Adventure Action","Animation Adventure Action","Romance Musical Comedy","Adventure Action ","Family Adventure Action","Drama Crime Action","Family Animation Adventure","War Fantasy Action","Fantasy Family Adventure","Thriller Sci-Fi Drama","Mystery Adventure Action","Fantasy Adventure Action","Family Comedy Animation","Comedy Animation Adventure","Adventure Action ","Comedy Animation Adventure","Sci-Fi Adventure Action","Comedy Animation Adventure","Thriller Adventure Action","Family Comedy Animation","Animation Adventure Action","Thriller Adventure Action","Comedy Adventure Action","Fantasy Adventure Action","Fantasy Adventure Action","Thriller Mystery ","Sci-Fi Adventure Action","Adventure Action ","Comedy Adventure Family","Fantasy Family Adventure","Romance Comedy ","Drama Adventure Action","Comedy Animation Adventure","Crime Comedy Action","Fantasy Adventure Action","Fantasy Family Adventure","Thriller Sci-Fi Adventure","Fantasy Family Adventure","Romance Comedy ","Thriller Crime ","Comedy Adventure Animation","Comedy Animation Adventure","Adventure Action ","Sci-Fi Adventure Action","Animation Adventure Action","Drama ","Adventure ","Crime Comedy Action","Fantasy Drama Comedy","Comedy Animation Adventure","Fantasy Adventure ","Sci-Fi Action ","History Drama Action","Fantasy Adventure Western","Sci-Fi Action ","Sci-Fi Action ","Sci-Fi Adventure Action","Crime Adventure Action","Fantasy Family Adventure","Comedy Animation Adventure","Fantasy Comedy Action","Sci-Fi Mystery Action","Romance Comedy ","Thriller Sci-Fi Drama","Adventure Action ","Fantasy Adventure Action","Fantasy Adventure ","Thriller Drama Crime","Fantasy Family Adventure","Sci-Fi Adventure Action","Comedy Animation Adventure","Thriller Crime ","Romance Drama Action","Sci-Fi Adventure Action","Comedy Animation Adventure","Fantasy Adventure ","Fantasy Adventure Action","Drama Adventure ","Family Animation Adventure","Drama Action ","Fantasy Family Comedy","Comedy ","Thriller Adventure Action","Drama Adventure Action","Mystery Horror Drama","Romance Fantasy Comedy","Sci-Fi Adventure Action","Romance Drama ","Comedy Adventure Action","Romance Drama Comedy","Fantasy Adventure Action","Drama Animation Adventure","Sci-Fi Action ","Fantasy Adventure Action","Thriller Mystery Drama","Crime Adventure Action","Comedy Animation Adventure","Comedy Animation Adventure","Sci-Fi Adventure Action","Sci-Fi Drama Action","Fantasy Family Comedy","Thriller Sci-Fi Action","Thriller Crime Action","Family Animation Adventure","War Drama Action","Romance Drama Comedy","Romance Comedy ","Drama Adventure Action","Romance Drama Comedy","Comedy ","Sci-Fi Comedy ","Romance Comedy ","Sci-Fi Adventure Action","Music Drama Comedy","Sci-Fi Adventure Action","Romance Drama ","Thriller Adventure Action","Family Comedy Adventure","Mystery Drama Action","Sci-Fi Adventure Action","Romance Drama Comedy","Thriller Adventure Action","Thriller Crime ","Family Drama Animation","Sci-Fi Romance Comedy","Thriller Adventure Action","Drama Adventure Action","History Drama Adventure","Fantasy Adventure Action","Fantasy Family Comedy","Thriller Adventure Action","Thriller Adventure Action","Fantasy Family Adventure","Drama Animation Adventure","Mystery Drama Thriller","Comedy Animation Adventure","Sci-Fi Adventure Action","Drama Crime Action","Comedy ","Romance Drama ","Romance Drama Comedy","Romance Horror ","Thriller Crime Action","Fantasy Family Comedy","Drama Animation Adventure","Fantasy Crime Comedy","Thriller Comedy Action","Thriller Adventure Action","Romance Drama ","Thriller Sci-Fi Adventure","Family Drama Comedy","Drama ","History Drama Biography","Romance Drama Comedy","Thriller Mystery Drama","Crime Adventure Action","Drama Crime Action","Thriller Drama ","Comedy Animation Adventure","Thriller Mystery Drama","Action ","Romance Horror ","Family Comedy Adventure","Thriller Crime Action","Music Comedy ","Music Drama Action","Music Comedy ","Fantasy Family Animation","Thriller Crime ","Western Comedy ","Family Comedy Adventure","Comedy ","Thriller History Drama","Drama Adventure Action","Sci-Fi Action ","Fantasy Comedy ","Thriller ","Romance Comedy Adventure","Western Drama Adventure","Thriller Action ","Romance Fantasy Drama","Family Comedy ","Crime Comedy Action","Mystery Drama Crime","Romance Comedy ","Comedy Adventure Action","Action Sci-Fi Mystery","Sci-Fi Comedy Adventure","Adventure Action ","War Drama Biography","Drama ","Horror Fantasy Comedy","Family Comedy Adventure","Adventure Action ","Thriller Crime Action","Romance Comedy ","Fantasy Family Animation","Comedy Adventure Action","Comedy ","Fantasy Drama Comedy","Romance Drama Comedy","Romance Comedy ","Thriller Action ","Drama ","Crime Comedy ","Comedy ","Crime Comedy Animation","Crime Comedy Action","Thriller Drama ","War Drama Comedy","Thriller Crime Action","Romance Drama Comedy","Thriller Comedy ","Comedy ","Thriller Drama Crime","Horror Fantasy Comedy","Family Drama Comedy","Adventure Comedy Crime","Sci-Fi Adventure Action","Drama Comedy Animation","Sport Romance Comedy","War Drama ","Crime Comedy ","Comedy Adventure Action","Comedy Adventure Action","Romance Family Action","Romance Drama Action","Romance Comedy Adventure","Sci-Fi ","Romance Drama Biography","Thriller Adventure Action","Sport Drama ","Comedy Adventure ","Drama ","Family Comedy Adventure","Comedy Adventure Action","Romance Drama Crime","Comedy Action ","Romance Music Drama","Fantasy Comedy ","Horror Comedy ","Action Adventure Drama","Comedy ","Comedy Adventure Action","Sci-Fi Adventure Action","Family Drama Action","Sci-Fi Action ","Romance Music Drama","Drama Comedy Western","Thriller Adventure Action","Drama Crime Comedy","Fantasy Adventure Action","Romance Music Drama","Thriller Action ","Drama Comedy ","Comedy ","Thriller Sci-Fi ","Crime Comedy Action","Romance Drama ","Family Drama Comedy","Sci-Fi Family Western","Horror ","Comedy ","Sport Drama ","Drama Adventure Action","Musical Comedy ","Romance Comedy ","Romance Comedy ","Sport History Drama","Thriller Adventure Action","Drama ","Adventure Action ","War Comedy ","Sci-Fi Romance Action","Comedy Action ","Drama Comedy ","Fantasy Comedy Adventure","Comedy ","Comedy ","Comedy Action ","Music Drama Biography","War Comedy ","Crime Comedy Action","Adventure Action Fantasy","Crime Comedy ","Romance Drama Adventure","Crime Comedy Action","Romance Comedy ","Sci-Fi Horror ","War Drama ","Drama ","Crime Adventure Action","Sport Drama Action","Sci-Fi Mystery Adventure","Horror Drama ","Comedy ","Family Comedy Adventure","Horror Drama ","Comedy Action ","Romance Musical ","Sport Romance Comedy","Comedy Action ","Thriller Horror ","Comedy ","Mystery Comedy Crime","Sci-Fi Drama Action","War Drama ","War History Drama","Romance Drama Comedy","Sci-Fi Drama ","Fantasy Comedy ","Romance Music Drama","Romance Comedy Action","Fantasy Adventure Action","Thriller Mystery Adventure","Romance Drama Comedy","Thriller Adventure Action","Romance Music Drama","Thriller Drama ","Horror Fantasy Adventure","History Drama Action","Sport Drama ","Crime Comedy Action","Thriller Crime Action","Mystery Horror Drama","Drama Crime ","Musical Drama Comedy","Romance Drama ","Western Family Comedy","Mystery Crime Comedy","Thriller Sci-Fi Drama"],"colors":["#1f77b4","#1f77b4","#1f77b4","#1f77b4","#aec7e8","#ff7f0e","#ff7f0e","#1f77b4","#1f77b4","#1f77b4","#aec7e8","#ffbb78","#2ca02c","#ffbb78","#1f77b4","#ff7f0e","#2ca02c","#ff7f0e","#98df8a","#ff7f0e","#2ca02c","#2ca02c","#1f77b4","#ffbb78","#ff7f0e","#1f77b4","#ffbb78","#ff7f0e","#1f77b4","#ff7f0e","#2ca02c","#ffbb78","#d62728","#ff9896","#ffbb78","#ff7f0e","#2ca02c","#2ca02c","#1f77b4","#ff7f0e","#aec7e8","#ff7f0e","#aec7e8","#1f77b4","#1f77b4","#2ca02c","#aec7e8","#ff7f0e","#2ca02c","#1f77b4","#ffbb78","#ff7f0e","#ff7f0e","#ff9896","#9467bd","#2ca02c","#ff7f0e","#1f77b4","#2ca02c","#ff7f0e","#98df8a","#1f77b4","#ff9896","#ff9896","#c5b0d5","#98df8a","#aec7e8","#8c564b","#aec7e8","#c49c94","#ff7f0e","#ffbb78","#d62728","#ff7f0e","#aec7e8","#2ca02c","#98df8a","#2ca02c","#1f77b4","#2ca02c","#ffbb78","#aec7e8","#ff9896","#ffbb78","#2ca02c","#ff7f0e","#ff7f0e","#ffbb78","#1f77b4","#98df8a","#2ca02c","#ff7f0e","#c5b0d5","#8c564b","#2ca02c","#9467bd","#ff7f0e","#ff7f0e","#ffbb78","#ff7f0e","#c5b0d5","#ffbb78","#2ca02c","#2ca02c","#98df8a","#1f77b4","#ff9896","#8c564b","#98df8a","#9467bd","#ff7f0e","#2ca02c","#ff7f0e","#1f77b4","#e377c2","#ff7f0e","#1f77b4","#1f77b4","#1f77b4","#9467bd","#ff7f0e","#2ca02c","#ff7f0e","#1f77b4","#c5b0d5","#ffbb78","#98df8a","#ff7f0e","#ff7f0e","#ffbb78","#ff7f0e","#1f77b4","#2ca02c","#ffbb78","#c5b0d5","#1f77b4","#2ca02c","#ff7f0e","#ff7f0e","#8c564b","#aec7e8","#8c564b","#ff7f0e","#2ca02c","#ffbb78","#8c564b","#d62728","#c5b0d5","#1f77b4","#c5b0d5","#2ca02c","#c5b0d5","#ff7f0e","#8c564b","#1f77b4","#ff7f0e","#ffbb78","#9467bd","#2ca02c","#2ca02c","#1f77b4","#1f77b4","#ff7f0e","#ffbb78","#ffbb78","#aec7e8","#c49c94","#c5b0d5","#c5b0d5","#8c564b","#c5b0d5","#2ca02c","#1f77b4","#c5b0d5","#1f77b4","#f7b6d2","#1f77b4","#c5b0d5","#ffbb78","#aec7e8","#d62728","#1f77b4","#c5b0d5","#ffbb78","#ffbb78","#aec7e8","#1f77b4","#ffbb78","#8c564b","#e377c2","#ff7f0e","#ff7f0e","#ffbb78","#ffbb78","#ff7f0e","#8c564b","#d62728","#2ca02c","#1f77b4","#8c564b","#2ca02c","#c5b0d5","#c5b0d5","#c5b0d5","#ffbb78","#ff7f0e","#8c564b","#ff7f0e","#ffbb78","#ffbb78","#c5b0d5","#ffbb78","#aec7e8","#8c564b","#e377c2","#c5b0d5","#ffbb78","#9467bd","#8c564b","#ffbb78","#2ca02c","#ffbb78","#7f7f7f","#c5b0d5","#aec7e8","#ffbb78","#f7b6d2","#f7b6d2","#f7b6d2","#ff7f0e","#ffbb78","#c7c7c7","#aec7e8","#2ca02c","#ffbb78","#8c564b","#1f77b4","#ff7f0e","#ffbb78","#c5b0d5","#c7c7c7","#ffbb78","#c5b0d5","#aec7e8","#9467bd","#d62728","#c5b0d5","#2ca02c","#7f7f7f","#1f77b4","#98df8a","#c49c94","#8c564b","#bcbd22","#aec7e8","#98df8a","#ffbb78","#c5b0d5","#ff7f0e","#2ca02c","#2ca02c","#ff7f0e","#c5b0d5","#c5b0d5","#ffbb78","#8c564b","#9467bd","#2ca02c","#9467bd","#9467bd","#ffbb78","#c49c94","#ffbb78","#c5b0d5","#ffbb78","#2ca02c","#ffbb78","#bcbd22","#aec7e8","#98df8a","#1f77b4","#8c564b","#dbdb8d","#c49c94","#9467bd","#2ca02c","#2ca02c","#c5b0d5","#c5b0d5","#c5b0d5","#1f77b4","#c5b0d5","#ffbb78","#dbdb8d","#2ca02c","#8c564b","#aec7e8","#2ca02c","#c5b0d5","#2ca02c","#c5b0d5","#ff7f0e","#bcbd22","#7f7f7f","#2ca02c","#2ca02c","#1f77b4","#aec7e8","#1f77b4","#c5b0d5","#8c564b","#ffbb78","#8c564b","#ff7f0e","#c5b0d5","#ffbb78","#8c564b","#2ca02c","#ffbb78","#9467bd","#c5b0d5","#aec7e8","#1f77b4","#bcbd22","#2ca02c","#dbdb8d","#8c564b","#17becf","#c5b0d5","#c5b0d5","#dbdb8d","#ffbb78","#8c564b","#98df8a","#c49c94","#1f77b4","#2ca02c","#8c564b","#ff7f0e","#2ca02c","#2ca02c","#2ca02c","#f7b6d2","#c49c94","#9467bd","#98df8a","#9467bd","#c5b0d5","#9467bd","#c5b0d5","#1f77b4","#c49c94","#8c564b","#9467bd","#dbdb8d","#1f77b4","#bcbd22","#2ca02c","#aec7e8","#bcbd22","#2ca02c","#c5b0d5","#dbdb8d","#2ca02c","#ffbb78","#2ca02c","#d62728","#1f77b4","#c49c94","#c49c94","#c5b0d5","#1f77b4","#ff7f0e","#c5b0d5","#c5b0d5","#ff7f0e","#ffbb78","#c5b0d5","#ffbb78","#c5b0d5","#ffbb78","#bcbd22","#e377c2","#dbdb8d","#9467bd","#ffbb78","#d62728","#8c564b","#17becf","#c5b0d5","#c7c7c7","#d62728","#ffbb78"],"dif":[1.4433082072612269,0.8610055602961073,1.548624846602019,1.5764845717326015,1.5527063540563786,1.1293990429660354,1.3400323216476169,1.0757203464320495,1.6621045008515303,1.3638105393238389,1.8944752434821546,2.212465915231707,1.2843128713864504,-0.5420927374462976,1.0478606213014667,1.4195299895850049,1.2068559571762434,1.4711679323918097,1.4433082072612269,1.4195299895850049,1.5010684112495745,0.6782320067451084,1.2347156823068262,0.35820058126837506,1.0220416498980638,1.3101318427898543,1.0458198675742858,1.630163268266586,1.1531772606422566,1.9501946937433197,0.39014181385331886,1.5248466289257958,0.8073268637621207,0.5987343388077198,0.2270649705241815,1.236756436034007,1.0519421287558275,1.0539828824830086,1.3957517719087829,0.7597704284096772,1.2068559571762434,1.232674928579645,0.8610055602961073,0.7815078923587193,0.6524130353417065,0.6007750925349007,0.9146842568300919,1.2625754074374091,0.3303408561377916,0.5233181783246936,0.9724444608184396,0.9941819247674799,0.3602413349955552,1.2625754074374091,0.890906039153871,1.2068559571762434,1.8190590829991269,2.1907284512826655,-0.8322236840652673,1.2625754074374091,-0.7228255372701164,1.0994985641082726,0.6245533102111226,0.8650870677504681,1.1830777395000212,0.17746778144455735,0.8114083712164831,0.8331458351655252,0.38401955267177823,2.027651607953527,0.8630463140232871,0.467598728063527,1.739561415061739,1.711701689931155,-0.4089163729749241,0.7339514570062743,-0.16634186170839876,-0.22206131196956358,2.266144611765692,0.3344223635921534,0.14756730258679362,0.07011038837658595,0.7060917318756923,-0.4843325334579512,1.0777611001592304,1.5785253254597813,-0.8023232052075043,0.6823135141994703,0.8650870677504681,0.2270649705241815,-1.754254466728982,-0.935499569678878,0.018472445569780782,-2.680366756847058,0.17746778144455735,0.2569654493819453,-1.4899424915134145,-1.25144948770125,-1.859571106069773,-0.1962423405661624,1.1572587680966184,0.07215114210376578,0.3643228424499172,-0.8301829303380871,-1.3071689379624167,0.2848251745125292,-1.571480913177984,1.1293990429660354,0.5212774245975127,2.2960450906234566,0.310644145915931,-0.7527260161278795,0.7040509781485113,-1.012956483889085,0.7319107032790945,-1.0965356592808337,-0.3790158941171603,0.813449124943663,-0.0630659760947877,-0.6154681442021438,0.09592935977998884,0.14960805631397459,0.10001086723434982,-1.412485577303207,-0.8281421766109062,-0.907639844548294,-1.2793092128318333,-0.4843325334579512,0.11970757745620975,0.9724444608184396,0.1754270277173775,-0.16430110798121778,-0.2757400085035504,0.07011038837658595,1.1056208252898132,-1.1957300374400837,0.2270649705241815,0.35820058126837506,0.6286348176654835,-0.5916899265259226,-0.9592777873551,0.3602413349955552,0.04633217070036466,0.07011038837658595,-0.8002824514803235,0.12582983863775254,-0.13848213657781483,-0.2974774724525914,0.25492469565476544,-0.43473534437832617,-0.007346525833622164,-0.8818208731448922,0.15164881004115444,-1.5436211880473998,-0.486373287185131,0.49545845319410975,0.042250663246002795,-0.561789447668159,-1.5456619417745807,-1.5178022166439986,1.1572587680966184,-0.9055990908211142,-0.7724227263497405,-0.5318889688103949,0.15164881004115444,-0.935499569678878,-0.2241020656967445,-1.571480913177984,-0.8023232052075043,-1.0666351804230707,-0.432694590651146,-0.45851356205454896,-0.6711875944633106,-0.32533719758317536,0.8114083712164831,-1.2793092128318333,0.04633217070036466,-1.5972998845813866,-0.5359704762647559,-0.5081107511341731,-0.4544320546001881,0.28278442078534827,-1.1203138769570575,0.07215114210376578,-1.012956483889085,-1.410444823576026,-0.9850967587585029,0.30860339218875116,-0.2716585010491885,-0.8838616268720723,-0.42861308319678515,0.1536895637683353,1.0240824036252447,-0.45851356205454896,0.04633217070036466,-0.2716585010491885,0.835186588892704,-1.335028663092999,-1.2215490088434862,-0.45851356205454896,0.07215114210376578,1.1531772606422566,-1.5436211880473998,1.1293990429660354,-1.5178022166439986,-0.2933959649982305,0.0938886060528088,-0.5896491727987416,-0.7486445086735175,-1.4879017377862347,0.048372924427544595,-1.0428569627468494,0.41596078525672187,0.5729153674043186,0.25084318820040363,-0.40483486552056325,-0.4306538369239651,-0.7248662909972963,0.12582983863775254,-0.009387279560801987,-0.6195496516565048,-0.4564728083273679,-0.5638302013953398,0.3881010601261391,1.1076615790169935,0.12582983863775254,-0.2974774724525914,0.1536895637683353,-0.3790158941171603,-0.8580426554686699,-0.35319692271375736,-1.330947155638638,1.264616161164589,-1.1977707911672646,-0.037247004691385865,0.49545845319410975,-0.7785449875312819,0.04633217070036466,0.11970757745620975,-0.14052289030499582,-0.4068756192477431,0.4417797566601248,-0.11470391890159284,0.7081324856028721,-0.08480344004382911,-0.85600190174149,0.7597704284096772,0.9466254894150365,-1.0408162090196689,0.4417797566601248,0.04429141697318372,-0.85600190174149,0.3602413349955552,0.3643228424499172,-1.2235897625706675,0.33238160986497256,-0.4843325334579512,-0.2696177473220087,-0.8838616268720723,0.3942233213076807,-0.2736992547763694,-0.9891782662128636,0.9486662431422175,0.41596078525672187,-0.3294187050375361,-0.1962423405661624,-1.0408162090196689,-0.6392463618783659,-1.3866666058998047,0.33850387104651425,-0.5638302013953398,-0.5916899265259226,-0.08888494749818993,-1.1739925734910424,-1.462082766382832,-0.32329644385599443,0.46555797433634605,-0.4306538369239651,-0.9850967587585029,-1.356766127042041,-1.0707166878774326,-0.24583952964578668,-1.5952591308542057,-0.09092570122537103,-1.0666351804230707,-0.19420158683898148,0.6048565999892617,0.07419189583094665,0.6802727604722894,-0.7527260161278795,-0.6949658121395325,0.6524130353417065,0.9744852145456206,1.2109374646306041,0.7359922107334553,0.8630463140232871,1.2347156823068262,0.1536895637683353,-1.1481736020876396,-0.6175088979293248,0.23114647797854232,-0.96335929480946,-0.7765042338041014,0.3602413349955552,0.9208065180116347,-1.3051281842352351,-0.32533719758317536,-0.7228255372701164,-1.3608476344964011,0.4974992069212909,-0.8797801194177114,0.10001086723434982,-1.4641235201100118,1.2068559571762434,1.0302046648067864,0.04633217070036466,-0.1425636440321757,-0.432694590651146,-1.2793092128318333,-1.3051281842352351,-0.5916899265259226,0.25900620310912625,-1.9431502814615218,-0.6970065658667135,0.5769968748586796,0.46963948179070686,-0.1962423405661624,0.44382051038730586,-1.0944949055536546,-0.9613185410822809,-0.5658709551225196,-0.24583952964578668,-0.22206131196956358,-0.6215904053836856,0.04429141697318372,-1.4641235201100118,0.894987546608232,0.4417797566601248,-0.9891782662128636,-0.907639844548294,-1.0428569627468494,0.33850387104651425,-1.0428569627468494,-1.436263794979429,0.2610469568363063,-0.03928775841856602,0.17746778144455735,1.5588286152379203,0.1754270277173775,-1.382585098445444,-0.7269070447244772,-0.19828309429334334,-0.3810566478443401,-0.561789447668159,-0.06102522236760788,-0.2974774724525914,1.264616161164589,0.30860339218875116,-0.909680598275475,-1.2813499665590133,0.6564945427960673,0.5729153674043186,-0.8818208731448922,0.020513199296961826,-0.7724227263497405,-0.30155897990695224,-0.4843325334579512,-1.0686759341502516,0.04020990951882175,0.41392003152954204,-0.7269070447244772,-1.176033327218223,-0.3511561689865764,-1.4641235201100118,0.018472445569780782,0.27870291333098574,-0.031124743509844066,0.9167250105572728,-0.3790158941171603,1.0777611001592304,-0.8859023805992532,-0.29543671872541144,0.8650870677504681,-2.100104863609118,-0.14052289030499582,0.018472445569780782,-0.35319692271375736,-0.14460439775935652,0.8413088500742469,-0.4306538369239651,-0.4306538369239651,-0.29951822617977236,-0.907639844548294],"index":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,383,384,385,386,387,388,391,392,393,394,396,398],"rt_audience_score":[2.1703174148107762,1.9060054395952097,2.4346293900263447,1.9060054395952097,0.84875753873294,0.5844455635173736,1.1130695139485074,0.84875753873294,-0.47280233734489613,2.1703174148107762,1.9060054395952097,1.9060054395952097,2.1703174148107762,1.377381489164075,1.377381489164075,1.1130695139485074,1.377381489164075,1.6416934643796413,2.1703174148107762,1.1130695139485074,0.3201335883018062,0.84875753873294,0.84875753873294,1.6416934643796413,1.1130695139485074,2.4346293900263447,2.1703174148107762,1.6416934643796413,1.6416934643796413,0.84875753873294,-0.47280233734489613,1.377381489164075,2.1703174148107762,0.84875753873294,1.1130695139485074,0.055821613086238786,-0.20849036212932867,-1.0014262877760298,0.055821613086238786,0.055821613086238786,1.377381489164075,1.6416934643796413,1.9060054395952097,1.9060054395952097,0.5844455635173736,0.055821613086238786,1.6416934643796413,0.3201335883018062,2.1703174148107762,-0.7371143125604624,-0.20849036212932867,1.6416934643796413,0.84875753873294,0.3201335883018062,0.5844455635173736,1.377381489164075,0.3201335883018062,0.055821613086238786,0.84875753873294,0.3201335883018062,-0.47280233734489613,1.9060054395952097,1.1130695139485074,0.3201335883018062,0.3201335883018062,-0.20849036212932867,0.5844455635173736,2.4346293900263447,1.9060054395952097,1.6416934643796413,1.1130695139485074,0.3201335883018062,0.3201335883018062,0.84875753873294,1.1130695139485074,-0.20849036212932867,-0.47280233734489613,0.5844455635173736,1.6416934643796413,0.5844455635173736,1.1130695139485074,0.3201335883018062,0.3201335883018062,-0.47280233734489613,0.055821613086238786,1.1130695139485074,-0.47280233734489613,-0.7371143125604624,0.3201335883018062,1.1130695139485074,-1.2657382629915974,-0.20849036212932867,-0.20849036212932867,-1.7943622134227322,-0.20849036212932867,-0.20849036212932867,-1.0014262877760298,-1.0014262877760298,-1.5300502382071648,0.84875753873294,0.055821613086238786,-0.47280233734489613,-0.7371143125604624,0.055821613086238786,0.055821613086238786,-0.7371143125604624,-0.20849036212932867,0.5844455635173736,0.055821613086238786,0.3201335883018062,-0.47280233734489613,0.84875753873294,1.1130695139485074,-1.0014262877760298,0.5844455635173736,0.5844455635173736,-0.20849036212932867,-0.20849036212932867,0.5844455635173736,-1.0014262877760298,0.5844455635173736,0.3201335883018062,-1.0014262877760298,-0.20849036212932867,-0.7371143125604624,-0.7371143125604624,-0.47280233734489613,-0.47280233734489613,1.6416934643796413,-0.20849036212932867,0.5844455635173736,-1.2657382629915974,0.84875753873294,0.3201335883018062,-0.47280233734489613,-2.0586741886382987,1.1130695139485074,1.6416934643796413,-0.47280233734489613,0.055821613086238786,-1.2657382629915974,0.84875753873294,-0.7371143125604624,0.3201335883018062,-1.2657382629915974,-0.7371143125604624,-1.0014262877760298,-1.0014262877760298,0.5844455635173736,0.84875753873294,-0.47280233734489613,-0.47280233734489613,-0.47280233734489613,-0.7371143125604624,0.3201335883018062,-0.20849036212932867,0.84875753873294,-1.2657382629915974,0.055821613086238786,-0.47280233734489613,0.055821613086238786,-1.5300502382071648,-1.7943622134227322,-2.5872981390694334,-0.47280233734489613,-0.20849036212932867,1.377381489164075,-0.20849036212932867,-0.47280233734489613,-0.7371143125604624,0.055821613086238786,-0.20849036212932867,0.055821613086238786,-0.47280233734489613,0.5844455635173736,-0.47280233734489613,-0.7371143125604624,-0.47280233734489613,-1.0014262877760298,-1.5300502382071648,-1.7943622134227322,0.055821613086238786,-0.47280233734489613,-0.47280233734489613,-1.0014262877760298,-1.0014262877760298,-1.5300502382071648,0.3201335883018062,-0.7371143125604624,0.3201335883018062,-1.5300502382071648,-1.2657382629915974,0.3201335883018062,-0.20849036212932867,-0.7371143125604624,-0.7371143125604624,1.6416934643796413,0.5844455635173736,-2.322986163853866,-0.20849036212932867,-0.47280233734489613,1.6416934643796413,-0.7371143125604624,0.5844455635173736,-0.47280233734489613,-2.5872981390694334,1.377381489164075,-0.7371143125604624,-0.7371143125604624,-1.7943622134227322,-1.5300502382071648,0.3201335883018062,-0.20849036212932867,0.5844455635173736,2.1703174148107762,-0.47280233734489613,-0.7371143125604624,0.3201335883018062,-0.7371143125604624,0.3201335883018062,0.5844455635173736,-1.0014262877760298,-0.47280233734489613,0.3201335883018062,-1.2657382629915974,-0.7371143125604624,-1.0014262877760298,-1.2657382629915974,-0.20849036212932867,0.5844455635173736,0.055821613086238786,-1.0014262877760298,-0.47280233734489613,-1.2657382629915974,0.84875753873294,-0.20849036212932867,0.5844455635173736,-0.7371143125604624,1.6416934643796413,-0.20849036212932867,0.3201335883018062,0.055821613086238786,0.055821613086238786,-0.47280233734489613,-1.2657382629915974,-0.20849036212932867,0.055821613086238786,-0.47280233734489613,-0.47280233734489613,0.055821613086238786,0.055821613086238786,-0.20849036212932867,0.84875753873294,-0.7371143125604624,-1.5300502382071648,1.377381489164075,-0.47280233734489613,-1.5300502382071648,0.3201335883018062,-2.0586741886382987,0.055821613086238786,0.055821613086238786,-1.2657382629915974,-0.20849036212932867,1.1130695139485074,0.84875753873294,-0.47280233734489613,-2.0586741886382987,0.055821613086238786,-1.0014262877760298,-0.47280233734489613,0.055821613086238786,0.3201335883018062,-0.20849036212932867,-1.5300502382071648,-1.2657382629915974,1.1130695139485074,-0.7371143125604624,-1.5300502382071648,-1.2657382629915974,0.84875753873294,-0.47280233734489613,-1.2657382629915974,1.1130695139485074,-0.7371143125604624,0.055821613086238786,-1.5300502382071648,-1.2657382629915974,0.055821613086238786,0.84875753873294,-1.0014262877760298,0.5844455635173736,-1.0014262877760298,-0.20849036212932867,-1.0014262877760298,1.1130695139485074,0.84875753873294,-1.2657382629915974,0.055821613086238786,-0.20849036212932867,-0.47280233734489613,0.3201335883018062,-0.20849036212932867,0.84875753873294,-0.7371143125604624,-0.7371143125604624,-0.47280233734489613,-0.47280233734489613,0.3201335883018062,-1.0014262877760298,-1.2657382629915974,-1.0014262877760298,-0.7371143125604624,1.377381489164075,-2.0586741886382987,-0.7371143125604624,0.5844455635173736,0.055821613086238786,-0.47280233734489613,-0.7371143125604624,0.055821613086238786,-1.0014262877760298,0.055821613086238786,-0.20849036212932867,-1.0014262877760298,-0.47280233734489613,0.84875753873294,-0.7371143125604624,-0.20849036212932867,-0.47280233734489613,0.3201335883018062,-0.47280233734489613,0.5844455635173736,1.377381489164075,0.055821613086238786,-0.7371143125604624,-1.0014262877760298,0.055821613086238786,0.055821613086238786,-0.7371143125604624,0.3201335883018062,-1.0014262877760298,0.3201335883018062,-1.2657382629915974,-1.7943622134227322,1.6416934643796413,-0.20849036212932867,-1.5300502382071648,0.5844455635173736,-1.5300502382071648,1.1130695139485074,1.6416934643796413,0.5844455635173736,-1.2657382629915974,-0.20849036212932867,-1.0014262877760298,-0.47280233734489613,0.3201335883018062,0.055821613086238786,0.3201335883018062,-1.0014262877760298,0.5844455635173736,-0.47280233734489613,-1.0014262877760298,-1.7943622134227322,0.5844455635173736,-0.47280233734489613,0.055821613086238786,1.6416934643796413,0.5844455635173736,1.1130695139485074,0.5844455635173736,-0.7371143125604624,-0.7371143125604624,-0.20849036212932867,1.6416934643796413,-1.5300502382071648,0.84875753873294,-0.20849036212932867,0.055821613086238786,1.1130695139485074,-1.7943622134227322,0.3201335883018062,-0.7371143125604624,-0.20849036212932867,-0.20849036212932867,0.055821613086238786,1.377381489164075,-0.7371143125604624,-0.7371143125604624,-0.7371143125604624,-0.20849036212932867,-0.7371143125604624],"rt_score":[0.7270092075495493,1.0449998792991024,0.8860045434243259,0.3295208678626082,-0.7039488153234384,-0.5449534794486619,-0.22696280769910945,-0.22696280769910945,-2.1349068381964265,0.8065068754869372,0.011530196113055063,-0.30646047563649736,0.8860045434243259,1.9194742266103726,0.3295208678626082,-0.30646047563649736,0.17052553198783163,0.17052553198783163,0.7270092075495493,-0.30646047563649736,-1.1809348229477683,0.17052553198783163,-0.385958143573886,1.2834928831112662,0.0910278640504437,1.1244975472364904,1.1244975472364904,0.011530196113055063,0.4885162037373848,-1.1014371550103796,-0.862944151198215,-0.1474651397617208,1.3629905510486555,0.25002319992522026,0.8860045434243259,-1.1809348229477683,-1.260432490885156,-2.0554091702590385,-1.339930158822544,-0.7039488153234384,0.17052553198783163,0.40901853579999614,1.0449998792991024,1.1244975472364904,-0.06796747182433287,-0.5449534794486619,0.7270092075495493,-0.942441819135603,1.8399765586729846,-1.260432490885156,-1.1809348229477683,0.6475115396121613,0.4885162037373848,-0.942441819135603,-0.30646047563649736,0.17052553198783163,-1.4989254946973207,-2.1349068381964265,1.6809812227982073,-0.942441819135603,0.25002319992522026,0.8065068754869372,0.4885162037373848,-0.5449534794486619,-0.862944151198215,-0.385958143573886,-0.22696280769910945,1.6014835548608195,1.5219858869234315,-0.385958143573886,0.25002319992522026,-0.1474651397617208,-1.4194278267599327,-0.862944151198215,1.5219858869234315,-0.942441819135603,-0.30646047563649736,0.8065068754869372,-0.6244511473860506,0.25002319992522026,0.9655022113617138,0.25002319992522026,-0.385958143573886,0.011530196113055063,-1.0219394870729916,-0.46545581151127396,0.3295208678626082,-1.4194278267599327,-0.5449534794486619,0.8860045434243259,0.4885162037373848,0.7270092075495493,-0.22696280769910945,0.8860045434243259,-0.385958143573886,-0.46545581151127396,0.4885162037373848,0.25002319992522026,0.3295208678626082,1.0449998792991024,-1.1014371550103796,-0.5449534794486619,-1.1014371550103796,0.8860045434243259,1.3629905510486555,-1.0219394870729916,1.3629905510486555,-0.5449534794486619,-0.46545581151127396,-1.9759115023216505,-0.7834464832608271,1.6014835548608195,0.40901853579999614,0.011530196113055063,-0.1474651397617208,1.6809812227982073,0.17052553198783163,-1.0219394870729916,0.6475115396121613,-0.385958143573886,0.4885162037373848,0.17052553198783163,-1.1014371550103796,1.2039952151738784,0.0910278640504437,0.17052553198783163,0.8065068754869372,0.011530196113055063,1.5219858869234315,-1.1809348229477683,0.40901853579999614,-1.1014371550103796,1.1244975472364904,0.25002319992522026,-1.5784231626347094,-0.862944151198215,0.8860045434243259,1.2834928831112662,-1.1014371550103796,0.6475115396121613,-0.30646047563649736,0.4885162037373848,-0.7834464832608271,0.25002319992522026,-0.46545581151127396,-0.862944151198215,-0.862944151198215,-0.7039488153234384,0.3295208678626082,1.2834928831112662,-0.46545581151127396,0.40901853579999614,-0.6244511473860506,0.8065068754869372,0.8065068754869372,-0.7039488153234384,0.8065068754869372,-0.7039488153234384,1.6014835548608195,1.0449998792991024,-1.1014371550103796,-0.6244511473860506,-1.0219394870729916,-2.0554091702590385,-0.6244511473860506,0.7270092075495493,1.6014835548608195,1.3629905510486555,0.3295208678626082,0.3295208678626082,0.4885162037373848,0.25002319992522026,0.7270092075495493,-0.1474651397617208,-0.22696280769910945,0.8065068754869372,-0.7834464832608271,1.1244975472364904,-0.46545581151127396,-1.0219394870729916,-1.339930158822544,-0.22696280769910945,0.6475115396121613,-0.5449534794486619,0.011530196113055063,0.40901853579999614,-0.5449534794486619,0.011530196113055063,-0.46545581151127396,1.2039952151738784,-1.1014371550103796,-1.4194278267599327,-0.7039488153234384,0.25002319992522026,-0.7834464832608271,-0.46545581151127396,0.8065068754869372,1.9194742266103726,-1.1014371550103796,0.25002319992522026,-0.5449534794486619,0.4885162037373848,0.8065068754869372,-0.5449534794486619,1.0449998792991024,-2.293902174071203,1.2834928831112662,-0.1474651397617208,0.011530196113055063,-0.30646047563649736,-1.5784231626347094,1.3629905510486555,-0.6244511473860506,0.011530196113055063,1.9194742266103726,-0.06796747182433287,-0.30646047563649736,1.0449998792991024,-0.862944151198215,0.3295208678626082,1.2039952151738784,-0.5449534794486619,0.0910278640504437,-0.06796747182433287,-2.373399842008591,-0.862944151198215,-0.7039488153234384,-1.4194278267599327,0.17052553198783163,1.4424882189860435,0.40901853579999614,0.3295208678626082,-1.7374184985094852,-0.06796747182433287,0.8860045434243259,-0.7039488153234384,1.3629905510486555,-0.7834464832608271,1.5219858869234315,-0.06796747182433287,0.7270092075495493,-0.385958143573886,0.17052553198783163,-1.1809348229477683,-1.1809348229477683,0.6475115396121613,-0.7039488153234384,-1.4194278267599327,0.5680138716747727,-0.385958143573886,0.011530196113055063,0.6475115396121613,0.4885162037373848,-1.1014371550103796,-0.30646047563649736,1.0449998792991024,0.011530196113055063,-1.260432490885156,1.2039952151738784,-2.4528975099459793,0.3295208678626082,1.0449998792991024,-2.214404506133815,-0.6244511473860506,1.4424882189860435,1.0449998792991024,0.5680138716747727,-1.4194278267599327,1.4424882189860435,-1.339930158822544,0.0910278640504437,0.6475115396121613,0.40901853579999614,0.9655022113617138,-0.06796747182433287,-0.942441819135603,0.6475115396121613,-0.30646047563649736,-0.5449534794486619,0.0910278640504437,1.9194742266103726,-0.22696280769910945,0.3295208678626082,1.2039952151738784,0.3295208678626082,0.25002319992522026,-2.1349068381964265,-1.339930158822544,-0.6244511473860506,1.6014835548608195,-0.30646047563649736,-0.06796747182433287,-1.9759115023216505,-1.4194278267599327,-1.7374184985094852,0.25002319992522026,-0.385958143573886,-1.4194278267599327,1.2039952151738784,0.40901853579999614,-0.7039488153234384,1.2834928831112662,0.5680138716747727,0.4885162037373848,-1.6579208305720972,0.5680138716747727,-0.1474651397617208,0.25002319992522026,1.6809812227982073,-1.4989254946973207,-0.385958143573886,-1.1014371550103796,0.7270092075495493,0.17052553198783163,-3.088878853445085,-0.7834464832608271,0.7270092075495493,0.4885162037373848,0.8065068754869372,0.5680138716747727,0.6475115396121613,-1.260432490885156,1.9989718945477606,0.4885162037373848,-1.5784231626347094,-0.942441819135603,1.0449998792991024,-1.1809348229477683,0.8860045434243259,0.4885162037373848,0.8860045434243259,-0.22696280769910945,0.8065068754869372,1.9989718945477606,0.011530196113055063,0.7270092075495493,-1.8964138343842618,-0.385958143573886,1.0449998792991024,0.17052553198783163,1.3629905510486555,-1.339930158822544,1.3629905510486555,0.17052553198783163,-2.0554091702590385,1.6809812227982073,-0.385958143573886,-3.088878853445085,0.40901853579999614,-0.1474651397617208,1.8399765586729846,1.8399765586729846,0.9655022113617138,-0.7039488153234384,-0.1474651397617208,-0.7039488153234384,-1.7374184985094852,0.011530196113055063,0.9655022113617138,1.6014835548608195,-1.6579208305720972,0.011530196113055063,0.40901853579999614,-1.0219394870729916,-1.0219394870729916,0.8860045434243259,0.011530196113055063,1.1244975472364904,1.6014835548608195,0.17052553198783163,1.8399765586729846,1.7604788907355966,-0.385958143573886,0.7270092075495493,-0.22696280769910945,1.3629905510486555,-1.4989254946973207,-0.06796747182433287,0.17052553198783163,-1.0219394870729916,1.9989718945477606,-1.4989254946973207,-0.5449534794486619,1.3629905510486555,-0.06796747182433287,-0.22696280769910945,0.40901853579999614,1.5219858869234315,-1.5784231626347094,-0.30646047563649736,-0.30646047563649736,0.0910278640504437,0.17052553198783163],"title":["Captain America: The Winter Soldier","Dawn of the Planet of the Apes","Guardians of the Galaxy","Interstellar","Maleficent","The Amazing Spider-Man 2","The Hobbit: The Battle of the Five Armies","The Hunger Games: Mockingjay - Part 1","Transformers: Age of Extinction","X-Men: Days of Future Past","Despicable Me 2","Fast & Furious 6","Frozen","Gravity","Iron Man 3","Man of Steel","Monsters University","The Hobbit: The Desolation of Smaug","The Hunger Games: Catching Fire","Thor: The Dark World","Ice Age: Continental Drift","Madagascar 3: Europe's Most Wanted","Men in Black 3","Skyfall","The Amazing Spider-Man","The Avengers","The Dark Knight Rises","The Hobbit: An Unexpected Journey","The Hunger Games","The Twilight Saga: Breaking Dawn - Part 2","Cars 2","Fast Five","Harry Potter and the Deathly Hallows - Part 2","Kung Fu Panda 2","Mission: Impossible - Ghost Protocol","Pirates of the Caribbean: On Stranger Tides","The Hangover Part II","The Smurfs","Transformers: Dark of the Moon","Alice in Wonderland","Despicable Me","Harry Potter and the Deathly Hallows - Part 1","How to Train Your Dragon","Inception","Iron Man 2","Shrek Forever After","Tangled","The Twilight Saga: Eclipse","Toy Story 3","2012","Angels & Demons","Avatar","Harry Potter and the Half-Blood Prince","Ice Age: Dawn of the Dinosaurs","Sherlock Holmes","The Hangover","The Twilight Saga: New Moon","Transformers: Revenge of the Fallen","Up","Hancock","Indiana Jones and the Kingdom of the Crystal Skull","Iron Man","Kung Fu Panda","Madagascar: Escape 2 Africa","Mamma Mia!","Quantum of Solace","The Chronicles of Narnia: Prince Caspian","The Dark Knight","WALL-E","300","Harry Potter and the Order of the Phoenix","I Am Legend","National Treasure: Book of Secrets","Pirates of the Caribbean: At World's End","Ratatouille","Shrek the Third","Spider-Man 3","The Simpsons Movie","Transformers","Cars","Casino Royale","Happy Feet","Ice Age: The Meltdown","Mission: Impossible III","Night at the Museum","Pirates of the Caribbean: Dead Man's Chest","Superman Returns","The Da Vinci Code","X-Men: The Last Stand","Batman Begins","Charlie and the Chocolate Factory","Harry Potter and the Goblet of Fire","Hitch","King Kong","Madagascar","Mr. & Mrs. Smith","Star Wars Episode III: Revenge of the Sith","The Chronicles of Narnia: The Lion, the Witch and the Wardrobe","War of the Worlds","Harry Potter and the Prisoner of Azkaban","Meet the Fockers","Ocean's Twelve","Shark Tale","Shrek 2","Spider-Man 2","The Day After Tomorrow","The Incredibles","The Passion of the Christ","Troy","Bad Boys II","Bruce Almighty","Finding Nemo","Pirates of the Caribbean: The Curse of the Black Pearl","Terminator 3: Rise of the Machines","The Last Samurai","The Lord of the Rings: The Return of the King","The Matrix Reloaded","The Matrix Revolutions","X2","Die Another Day","Harry Potter and the Chamber of Secrets","Ice Age","Men in Black II","Minority Report","My Big Fat Greek Wedding","Signs","Spider-Man","Star Wars Episode II: Attack of the Clones","The Lord of the Rings: The Two Towers","Hannibal","Harry Potter and the Sorcerer's Stone","Jurassic Park III","Monsters, Inc.","Ocean's Eleven","Pearl Harbor","Planet of the Apes","Shrek","The Lord of the Rings: The Fellowship of the Ring","The Mummy Returns","Cast Away","Dinosaur","Gladiator","How the Grinch Stole Christmas","Meet the Parents","Mission: Impossible II","The Perfect Storm","What Lies Beneath","What Women Want","X-Men","American Beauty","Austin Powers: The Spy Who Shagged Me","Notting Hill","Star Wars Episode I: The Phantom Menace","Tarzan","The Matrix","The Mummy","The Sixth Sense","The World Is Not Enough","Toy Story 2","A Bug's Life","Armageddon","Deep Impact","Dr. Dolittle","Godzilla","Lethal Weapon 4","Mulan","Saving Private Ryan","Shakespeare in Love","There's Something About Mary","Air Force One","As Good as It Gets","Liar Liar","Men in Black","My Best Friend's Wedding","The Fifth Element","The Full Monty","The Lost World: Jurassic Park","Titanic","Tomorrow Never Dies","101 Dalmatians","Eraser","Independence Day","Jerry Maguire","Mission: Impossible","Ransom","The Hunchback of Notre Dame","The Nutty Professor","The Rock","Twister","Apollo 13","Batman Forever","Casper","Die Hard with a Vengeance","GoldenEye","Jumanji","Pocahontas","Seven","Toy Story","Waterworld","Clear and Present Danger","Dumb and Dumber","Forrest Gump","Four Weddings and a Funeral","Interview with the Vampire: The Vampire Chronicles","Speed","The Flintstones","The Lion King","The Mask","True Lies","Cliffhanger","Indecent Proposal","Jurassic Park","Mrs. Doubtfire","Philadelphia","Schindler's List","Sleepless in Seattle","The Firm","The Fugitive","The Pelican Brief","A Few Good Men","Aladdin","Basic Instinct","Batman Returns","Bram Stoker's Dracula","Home Alone 2: Lost in New York","Lethal Weapon 3","Sister Act","The Bodyguard","Wayne's World","Beauty and the Beast","Cape Fear","City Slickers","Hook","Hot Shots!","JFK","Robin Hood: Prince of Thieves","Terminator 2: Judgment Day","The Addams Family","The Silence of the Lambs","Back to the Future Part III","Dances with Wolves","Die Hard 2","Ghost","Home Alone","Kindergarten Cop","Presumed Innocent","Pretty Woman","Teenage Mutant Ninja Turtles","Total Recall","Back to the Future Part II","Batman","Born on the Fourth of July","Dead Poets Society","Ghostbusters II","Honey, I Shrunk the Kids","Indiana Jones and the Last Crusade","Lethal Weapon 2","Look Who's Talking","The Little Mermaid","\"Crocodile\" Dundee II","Beetlejuice","Big","Cocktail","Coming to America","Die Hard","Rain Man","The Naked Gun: From the Files of Police Squad!","Twins","Who Framed Roger Rabbit","Beverly Hills Cop II","Fatal Attraction","Good Morning, Vietnam","Lethal Weapon","Moonstruck","Stakeout","The Secret of My Success","The Untouchables","The Witches of Eastwick","Three Men and a Baby","\"Crocodile\" Dundee","Aliens","An American Tail","Back to School","Platoon","Ruthless People","Star Trek IV: The Voyage Home","The Golden Child","The Karate Kid, Part II","Top Gun","Back to the Future","Cocoon","Out Of Africa","Rambo: First Blood Part II","Rocky IV","Spies Like Us","The Color Purple","The Goonies","The Jewel of the Nile","Witness","Beverly Hills Cop","Footloose","Ghostbusters","Gremlins","Indiana Jones and the Temple of Doom","Police Academy","Romancing the Stone","Star Trek III: The Search for Spock","The Karate Kid","The Terminator","Flashdance","Mr. Mom","Octopussy","Risky Business","Star Wars Episode VI: Return of the Jedi","Staying Alive","Sudden Impact","Terms of Endearment","Trading Places","WarGames","48 Hrs.","An Officer and a Gentleman","Annie","E.T. the Extra-Terrestrial","Poltergeist","Porky's","Rocky III","Star Trek II: The Wrath of Khan","The Best Little Whorehouse in Texas","Tootsie","Arthur","Chariots of Fire","For Your Eyes Only","On Golden Pond","Raiders of the Lost Ark","Stripes","Superman II","The Cannonball Run","The Four Seasons","Time Bandits","9 to 5","Airplane!","Any Which Way You Can","Coal Miner's Daughter","Private Benjamin","Smokey and the Bandit II","Star Wars Episode V: The Empire Strikes Back","Stir Crazy","The Blue Lagoon","The Blues Brothers","10","Alien","Apocalypse Now","Kramer vs. Kramer","Moonraker","Rocky II","Star Trek: The Motion Picture","The Amityville Horror","The Jerk","The Muppet Movie","Dawn of the Dead","Every Which Way but Loose","Grease","Heaven Can Wait","Hooper","Jaws 2","National Lampoon's Animal House","Revenge of the Pink Panther","Superman","The Deer Hunter","A Bridge Too Far","Annie Hall","Close Encounters of the Third Kind","Oh, God!","Saturday Night Fever","Smokey and the Bandit","Star Wars","The Deep","The Goodbye Girl","The Spy Who Loved Me","A Star Is Born","All the President's Men","King Kong","Midway","Rocky","Silver Streak","The Enforcer","The Omen","Dog Day Afternoon","Funny Lady","Shampoo","The Apple Dumpling Gang","The Return of the Pink Panther","Signs"]}},"id":"010223e2-f215-4c81-bdb8-f36ee805da7f","type":"ColumnDataSource"},{"attributes":{"axis_label":"Audience Rating","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"d2e4d898-45e9-47e7-870b-afb9e2e518c4","type":"BasicTickFormatter"},"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"c6219ddb-bf56-4ed2-bffc-656bd99df910","subtype":"Figure","type":"Plot"},"ticker":{"id":"9ab9ad4d-1c16-441b-8864-defb64c2162c","type":"BasicTicker"}},"id":"b51be1bb-4833-4cc9-bf4a-0bba5903c6aa","type":"LinearAxis"},{"attributes":{"callback":null,"end":2.634629390026345,"start":-3.2888788534450852},"id":"bdb7b5cd-4a1f-4c25-8a97-8f35f0f01fc1","type":"Range1d"}],"root_ids":["c6219ddb-bf56-4ed2-bffc-656bd99df910"]},"title":"Bokeh Application","version":"0.12.4"}};
var render_items = [{"docid":"ab8d509f-3521-4516-9fb9-bc3b111f4117","elementid":"a54e96a0-1e33-4cb6-834b-960e835a72c5","modelid":"c6219ddb-bf56-4ed2-bffc-656bd99df910"}];
Bokeh.embed.embed_items(docs_json, render_items);
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
},
function(Bokeh) {
}
];
function run_inline_js() {
if ((window.Bokeh !== undefined) || (force === true)) {
for (var i = 0; i < inline_js.length; i++) {
inline_js[i](window.Bokeh);
}if (force === true) {
display_loaded();
}} else if (Date.now() < window._bokeh_timeout) {
setTimeout(run_inline_js, 100);
} else if (!window._bokeh_failed_load) {
console.log("Bokeh: BokehJS failed to load within specified timeout.");
window._bokeh_failed_load = true;
} else if (force !== true) {
var cell = $(document.getElementById("a54e96a0-1e33-4cb6-834b-960e835a72c5")).parents('.cell').data().cell;
cell.output_area.append_execute_result(NB_LOAD_WARNING)
}
}
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: BokehJS loaded, going straight to plotting");
run_inline_js();
} else {
load_libs(js_urls, function() {
console.log("Bokeh: BokehJS plotting callback run at", now());
run_inline_js();
});
}
}(this));
</script>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>The audience and critic ratings have about the same ranges, and the red line seems to go straight through the center of the movies. Great! Now we can look at how this changes things by genre.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [5]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">##DATA PREP FOR GENRE PLOTS</span>
<span class="c1">#Melt the genre columns so we only have one. This will give multiple entries for movies with more than one genre</span>
<span class="n">melted_mov</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">melt</span><span class="p">(</span>
<span class="n">mov</span><span class="o">.</span><span class="n">drop</span><span class="p">([</span><span class="s1">'colors'</span><span class="p">,</span> <span class="s1">'Genre_str'</span><span class="p">],</span><span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">),</span>
<span class="n">id_vars</span><span class="o">=</span><span class="p">[</span><span class="s1">'title'</span><span class="p">,</span>
<span class="s1">'rt_audience_score'</span><span class="p">,</span>
<span class="s1">'rt_score'</span><span class="p">,</span>
<span class="s1">'dif'</span><span class="p">],</span>
<span class="n">value_name</span><span class="o">=</span><span class="s1">'genre'</span><span class="p">)</span>
<span class="c1">#A little bit of clean up</span>
<span class="n">melted_mov</span> <span class="o">=</span> <span class="n">melted_mov</span><span class="o">.</span><span class="n">drop</span><span class="p">(</span><span class="s1">'variable'</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
<span class="n">melted_mov</span> <span class="o">=</span> <span class="n">melted_mov</span><span class="o">.</span><span class="n">dropna</span><span class="p">()</span>
<span class="c1">#Group by genre</span>
<span class="n">genre_groups</span> <span class="o">=</span> <span class="n">melted_mov</span><span class="o">.</span><span class="n">groupby</span><span class="p">(</span><span class="s1">'genre'</span><span class="p">)</span>
<span class="c1">#Excluding genres with less than 20 entries</span>
<span class="n">genre_revs</span> <span class="o">=</span> <span class="n">genre_groups</span><span class="o">.</span><span class="n">mean</span><span class="p">()[</span><span class="n">genre_groups</span><span class="p">[</span><span class="s1">'genre'</span><span class="p">]</span><span class="o">.</span><span class="n">count</span><span class="p">()</span> <span class="o">></span> <span class="mi">20</span><span class="p">]</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [6]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">##SCATTER PLOT FOR GENRE SCORES</span>
<span class="c1">#Make a data source for bokeh</span>
<span class="n">genre_revs_source</span> <span class="o">=</span> <span class="n">ColumnDataSource</span><span class="p">(</span><span class="n">genre_revs</span><span class="p">)</span>
<span class="c1">#Get axes ranges</span>
<span class="n">low</span> <span class="o">=</span> <span class="n">genre_revs</span><span class="p">[[</span><span class="s1">'rt_audience_score'</span><span class="p">,</span><span class="s1">'rt_score'</span><span class="p">]]</span><span class="o">.</span><span class="n">min</span><span class="p">()</span><span class="o">.</span><span class="n">min</span><span class="p">()</span> <span class="o">-</span> <span class="mf">0.05</span>
<span class="n">high</span> <span class="o">=</span> <span class="n">genre_revs</span><span class="p">[[</span><span class="s1">'rt_audience_score'</span><span class="p">,</span><span class="s1">'rt_score'</span><span class="p">]]</span><span class="o">.</span><span class="n">max</span><span class="p">()</span><span class="o">.</span><span class="n">max</span><span class="p">()</span> <span class="o">+</span> <span class="mf">0.05</span>
<span class="c1">#Define the hover over tooltisp</span>
<span class="n">hover</span> <span class="o">=</span> <span class="n">HoverTool</span><span class="p">(</span>
<span class="n">tooltips</span><span class="o">=</span><span class="p">[(</span><span class="s2">"Genre"</span><span class="p">,</span> <span class="s2">"@genre"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Audience Score"</span><span class="p">,</span> <span class="s2">"@rt_audience_score</span><span class="si">{0.0}</span><span class="s2">"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Critic Score"</span><span class="p">,</span> <span class="s2">"@rt_score</span><span class="si">{0.0}</span><span class="s2">"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Difference"</span><span class="p">,</span> <span class="s2">"@dif"</span><span class="p">)</span>
<span class="p">]</span>
<span class="p">)</span>
<span class="n">p</span> <span class="o">=</span> <span class="n">figure</span><span class="p">(</span><span class="n">title</span><span class="o">=</span><span class="s1">'Audience and critic ratings by genre'</span><span class="p">,</span>
<span class="n">x_range</span><span class="o">=</span><span class="n">Range1d</span><span class="p">(</span><span class="n">low</span><span class="p">,</span> <span class="n">high</span><span class="p">),</span>
<span class="n">y_range</span><span class="o">=</span><span class="n">Range1d</span><span class="p">(</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span>
<span class="n">tools</span><span class="o">=</span><span class="p">[</span><span class="n">hover</span><span class="p">])</span>
<span class="n">p</span><span class="o">.</span><span class="n">xaxis</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">axis_label</span> <span class="o">=</span> <span class="s1">'Critic Rating'</span>
<span class="n">p</span><span class="o">.</span><span class="n">yaxis</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">axis_label</span> <span class="o">=</span> <span class="s1">'Audience Rating'</span>
<span class="c1">#Add a line for where critic score = audience score</span>
<span class="n">p</span><span class="o">.</span><span class="n">line</span><span class="p">((</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span> <span class="p">(</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span><span class="n">line_color</span><span class="o">=</span><span class="s2">"red"</span><span class="p">,</span> <span class="n">line_width</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
<span class="c1">#Scatter plot the genre scores</span>
<span class="n">p</span><span class="o">.</span><span class="n">scatter</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s1">'rt_score'</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s1">'rt_audience_score'</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">genre_revs_source</span><span class="p">,</span>
<span class="n">size</span><span class="o">=</span><span class="mi">6</span><span class="p">)</span>
<span class="c1">#Add labels for each genre</span>
<span class="n">labels</span> <span class="o">=</span> <span class="n">LabelSet</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s1">'rt_score'</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s1">'rt_audience_score'</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s1">'genre'</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">genre_revs_source</span><span class="p">,</span>
<span class="n">x_offset</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">y_offset</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">text_font_size</span><span class="o">=</span><span class="s2">"7.5pt"</span><span class="p">,</span> <span class="n">text_align</span><span class="o">=</span><span class="s1">'center'</span><span class="p">)</span>
<span class="n">p</span><span class="o">.</span><span class="n">add_layout</span><span class="p">(</span><span class="n">labels</span><span class="p">)</span>
<span class="c1">#Hide the bokeh toolbar</span>
<span class="n">p</span><span class="o">.</span><span class="n">toolbar_location</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">styleBokeh</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="n">show</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt"></div>
<div class="output_html rendered_html output_subarea">
<div class="bk-root">
<div class="bk-plotdiv" id="768b02f5-64d0-46c4-abc6-01df46dcc3f4"></div>
</div>
<script type="text/javascript">
(function(global) {
function now() {
return new Date();
}
var force = false;
if (typeof (window._bokeh_onload_callbacks) === "undefined" || force === true) {
window._bokeh_onload_callbacks = [];
window._bokeh_is_loading = undefined;
}
if (typeof (window._bokeh_timeout) === "undefined" || force === true) {
window._bokeh_timeout = Date.now() + 0;
window._bokeh_failed_load = false;
}
var NB_LOAD_WARNING = {'data': {'text/html':
"<div style='background-color: #fdd'>\n"+
"<p>\n"+
"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \n"+
"may be due to a slow or bad network connection. Possible fixes:\n"+
"</p>\n"+
"<ul>\n"+
"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\n"+
"<li>use INLINE resources instead, as so:</li>\n"+
"</ul>\n"+
"<code>\n"+
"from bokeh.resources import INLINE\n"+
"output_notebook(resources=INLINE)\n"+
"</code>\n"+
"</div>"}};
function display_loaded() {
if (window.Bokeh !== undefined) {
document.getElementById("768b02f5-64d0-46c4-abc6-01df46dcc3f4").textContent = "BokehJS successfully loaded.";
} else if (Date.now() < window._bokeh_timeout) {
setTimeout(display_loaded, 100)
}
}
function run_callbacks() {
window._bokeh_onload_callbacks.forEach(function(callback) { callback() });
delete window._bokeh_onload_callbacks
console.info("Bokeh: all callbacks have finished");
}
function load_libs(js_urls, callback) {
window._bokeh_onload_callbacks.push(callback);
if (window._bokeh_is_loading > 0) {
console.log("Bokeh: BokehJS is being loaded, scheduling callback at", now());
return null;
}
if (js_urls == null || js_urls.length === 0) {
run_callbacks();
return null;
}
console.log("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
window._bokeh_is_loading = js_urls.length;
for (var i = 0; i < js_urls.length; i++) {
var url = js_urls[i];
var s = document.createElement('script');
s.src = url;
s.async = false;
s.onreadystatechange = s.onload = function() {
window._bokeh_is_loading--;
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: all BokehJS libraries loaded");
run_callbacks()
}
};
s.onerror = function() {
console.warn("failed to load library " + url);
};
console.log("Bokeh: injecting script tag for BokehJS library: ", url);
document.getElementsByTagName("head")[0].appendChild(s);
}
};var element = document.getElementById("768b02f5-64d0-46c4-abc6-01df46dcc3f4");
if (element == null) {
console.log("Bokeh: ERROR: autoload.js configured with elementid '768b02f5-64d0-46c4-abc6-01df46dcc3f4' but no matching script tag was found. ")
return false;
}
var js_urls = [];
var inline_js = [
function(Bokeh) {
(function() {
var fn = function() {
var docs_json = {"fca4fd5b-ce07-4058-8f60-a379903243ff":{"roots":{"references":[{"attributes":{"callback":null,"column_names":["x","y"],"data":{"x":[-0.3880550558624497,0.508035488414276],"y":[-0.3880550558624497,0.508035488414276]}},"id":"07163069-b61e-49ff-8047-4e51beb6a3ca","type":"ColumnDataSource"},{"attributes":{"axis_label":"Audience Rating","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"a55bb7f4-6f9c-4c9c-88f7-05984031b358","type":"BasicTickFormatter"},"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"95e42788-b3ea-443d-8d7b-57180c014cc8","subtype":"Figure","type":"Plot"},"ticker":{"id":"c18a29b0-2080-4a13-9256-940ee03d9069","type":"BasicTicker"}},"id":"bc76481a-7ad0-47ac-832f-466f6ccab152","type":"LinearAxis"},{"attributes":{},"id":"c18a29b0-2080-4a13-9256-940ee03d9069","type":"BasicTicker"},{"attributes":{"data_source":{"id":"07163069-b61e-49ff-8047-4e51beb6a3ca","type":"ColumnDataSource"},"glyph":{"id":"fa2b8cfa-7697-48a1-87d1-b83bd74b74d7","type":"Line"},"hover_glyph":null,"nonselection_glyph":{"id":"0d4c434b-c6a1-4bae-bd84-5269756481ae","type":"Line"},"selection_glyph":null},"id":"936a52c1-df59-4c56-89dd-fe0655d92d27","type":"GlyphRenderer"},{"attributes":{"line_alpha":{"value":0.5},"line_color":{"value":"red"},"line_width":{"value":5},"x":{"field":"x"},"y":{"field":"y"}},"id":"fa2b8cfa-7697-48a1-87d1-b83bd74b74d7","type":"Line"},{"attributes":{},"id":"bd8873f8-3ef4-45c2-b869-3c090d896001","type":"ToolEvents"},{"attributes":{"active_drag":"auto","active_scroll":"auto","active_tap":"auto","tools":[{"id":"58887044-600f-4e36-8d87-3be9df6b4352","type":"HoverTool"}]},"id":"18774a80-dc9d-4ed1-9d04-89b35cbf951e","type":"Toolbar"},{"attributes":{"plot":null,"text":"Audience and critic ratings by genre","text_font_size":{"value":"14pt"}},"id":"4ca04deb-f632-4a8b-a0ca-f7294c0d9683","type":"Title"},{"attributes":{"callback":null,"end":0.508035488414276,"start":-0.3880550558624497},"id":"078794b7-8d04-4c3f-b364-7775ddeeaed3","type":"Range1d"},{"attributes":{"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"line_width":{"value":5},"x":{"field":"x"},"y":{"field":"y"}},"id":"0d4c434b-c6a1-4bae-bd84-5269756481ae","type":"Line"},{"attributes":{"axis_label":"Critic Rating","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"d5cb61e1-4073-4f09-bdce-cc79794122d2","type":"BasicTickFormatter"},"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"95e42788-b3ea-443d-8d7b-57180c014cc8","subtype":"Figure","type":"Plot"},"ticker":{"id":"a8b49797-4a83-416d-818d-f4ea71d9a53c","type":"BasicTicker"}},"id":"83d74957-ebbf-4740-b822-44be9bbf8b79","type":"LinearAxis"},{"attributes":{},"id":"a8b49797-4a83-416d-818d-f4ea71d9a53c","type":"BasicTicker"},{"attributes":{"plot":{"id":"95e42788-b3ea-443d-8d7b-57180c014cc8","subtype":"Figure","type":"Plot"},"ticker":{"id":"a8b49797-4a83-416d-818d-f4ea71d9a53c","type":"BasicTicker"}},"id":"3c52f03b-cda7-4923-a89f-321556d4d92f","type":"Grid"},{"attributes":{"callback":null,"end":0.508035488414276,"start":-0.3880550558624497},"id":"de725a82-e25f-4a24-bb3b-0d7c3cf3b576","type":"Range1d"},{"attributes":{"fill_color":{"value":"#1f77b4"},"line_color":{"value":"#1f77b4"},"size":{"units":"screen","value":6},"x":{"field":"rt_score"},"y":{"field":"rt_audience_score"}},"id":"b7d19b64-d142-4a9b-83c2-c08da3026f6a","type":"Circle"},{"attributes":{"dimension":1,"plot":{"id":"95e42788-b3ea-443d-8d7b-57180c014cc8","subtype":"Figure","type":"Plot"},"ticker":{"id":"c18a29b0-2080-4a13-9256-940ee03d9069","type":"BasicTicker"}},"id":"4dddd1d1-92ea-410b-ba46-c6be9fb25599","type":"Grid"},{"attributes":{"callback":null,"plot":{"id":"95e42788-b3ea-443d-8d7b-57180c014cc8","subtype":"Figure","type":"Plot"},"tooltips":[["Genre","@genre"],["Audience Score","@rt_audience_score{0.0}"],["Critic Score","@rt_score{0.0}"],["Difference","@dif"]]},"id":"58887044-600f-4e36-8d87-3be9df6b4352","type":"HoverTool"},{"attributes":{"data_source":{"id":"fba00737-5b0a-4113-9062-a8a75649631a","type":"ColumnDataSource"},"glyph":{"id":"b7d19b64-d142-4a9b-83c2-c08da3026f6a","type":"Circle"},"hover_glyph":null,"nonselection_glyph":{"id":"f6ba4029-6cc6-4a86-ac74-26512b996d7e","type":"Circle"},"selection_glyph":null},"id":"bdd23dfd-b959-4ae7-82d1-a901df1377c2","type":"GlyphRenderer"},{"attributes":{"plot":{"id":"95e42788-b3ea-443d-8d7b-57180c014cc8","subtype":"Figure","type":"Plot"},"source":{"id":"fba00737-5b0a-4113-9062-a8a75649631a","type":"ColumnDataSource"},"text":{"field":"genre"},"text_align":"center","text_font_size":{"value":"7.5pt"},"x":{"field":"rt_score"},"y":{"field":"rt_audience_score"},"y_offset":{"value":5}},"id":"4def14ab-cf24-4ea6-88f0-7f3b165019d0","type":"LabelSet"},{"attributes":{"callback":null,"column_names":["genre","rt_audience_score","dif","rt_score"],"data":{"dif":[0.19066447775251041,0.19809275441955893,0.002355277955377706,-0.15366198402231931,-0.16139229747257772,-0.1437463174465955,-0.020684212634298663,0.3004613971397926,-0.1921486939034225,0.04303571809511935,-0.12800157360238437],"genre":["Action","Adventure","Animation","Comedy","Crime","Drama","Family","Fantasy","Romance","Sci-Fi","Thriller"],"rt_audience_score":[0.010075309683544517,0.18038242899242532,0.458035488414276,-0.32100154076838755,-0.1896109353282165,0.004899122448377198,-0.07940776958219095,0.22321919738943125,-0.3380550558624497,0.19469739667407926,-0.10937337142349081],"rt_score":[-0.1805891680689662,-0.01771032542713343,0.4556802104588981,-0.1673395567460683,-0.02821863785563877,0.14864543989497261,-0.058723556947892414,-0.07724219975036149,-0.14590636195902718,0.15166167857896004,0.018628202178893532]}},"id":"fba00737-5b0a-4113-9062-a8a75649631a","type":"ColumnDataSource"},{"attributes":{},"id":"d5cb61e1-4073-4f09-bdce-cc79794122d2","type":"BasicTickFormatter"},{"attributes":{"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"size":{"units":"screen","value":6},"x":{"field":"rt_score"},"y":{"field":"rt_audience_score"}},"id":"f6ba4029-6cc6-4a86-ac74-26512b996d7e","type":"Circle"},{"attributes":{"below":[{"id":"83d74957-ebbf-4740-b822-44be9bbf8b79","type":"LinearAxis"}],"left":[{"id":"bc76481a-7ad0-47ac-832f-466f6ccab152","type":"LinearAxis"}],"renderers":[{"id":"83d74957-ebbf-4740-b822-44be9bbf8b79","type":"LinearAxis"},{"id":"3c52f03b-cda7-4923-a89f-321556d4d92f","type":"Grid"},{"id":"bc76481a-7ad0-47ac-832f-466f6ccab152","type":"LinearAxis"},{"id":"4dddd1d1-92ea-410b-ba46-c6be9fb25599","type":"Grid"},{"id":"936a52c1-df59-4c56-89dd-fe0655d92d27","type":"GlyphRenderer"},{"id":"bdd23dfd-b959-4ae7-82d1-a901df1377c2","type":"GlyphRenderer"},{"id":"4def14ab-cf24-4ea6-88f0-7f3b165019d0","type":"LabelSet"}],"title":{"id":"4ca04deb-f632-4a8b-a0ca-f7294c0d9683","type":"Title"},"tool_events":{"id":"bd8873f8-3ef4-45c2-b869-3c090d896001","type":"ToolEvents"},"toolbar":{"id":"18774a80-dc9d-4ed1-9d04-89b35cbf951e","type":"Toolbar"},"toolbar_location":null,"x_range":{"id":"de725a82-e25f-4a24-bb3b-0d7c3cf3b576","type":"Range1d"},"y_range":{"id":"078794b7-8d04-4c3f-b364-7775ddeeaed3","type":"Range1d"}},"id":"95e42788-b3ea-443d-8d7b-57180c014cc8","subtype":"Figure","type":"Plot"},{"attributes":{},"id":"a55bb7f4-6f9c-4c9c-88f7-05984031b358","type":"BasicTickFormatter"}],"root_ids":["95e42788-b3ea-443d-8d7b-57180c014cc8"]},"title":"Bokeh Application","version":"0.12.4"}};
var render_items = [{"docid":"fca4fd5b-ce07-4058-8f60-a379903243ff","elementid":"768b02f5-64d0-46c4-abc6-01df46dcc3f4","modelid":"95e42788-b3ea-443d-8d7b-57180c014cc8"}];
Bokeh.embed.embed_items(docs_json, render_items);
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
},
function(Bokeh) {
}
];
function run_inline_js() {
if ((window.Bokeh !== undefined) || (force === true)) {
for (var i = 0; i < inline_js.length; i++) {
inline_js[i](window.Bokeh);
}if (force === true) {
display_loaded();
}} else if (Date.now() < window._bokeh_timeout) {
setTimeout(run_inline_js, 100);
} else if (!window._bokeh_failed_load) {
console.log("Bokeh: BokehJS failed to load within specified timeout.");
window._bokeh_failed_load = true;
} else if (force !== true) {
var cell = $(document.getElementById("768b02f5-64d0-46c4-abc6-01df46dcc3f4")).parents('.cell').data().cell;
cell.output_area.append_execute_result(NB_LOAD_WARNING)
}
}
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: BokehJS loaded, going straight to plotting");
run_inline_js();
} else {
load_libs(js_urls, function() {
console.log("Bokeh: BokehJS plotting callback run at", now());
run_inline_js();
});
}
}(this));
</script>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Now we can see what genres audiences like more than average (above 0 on the y-axis), what critics like more than average (to the right of 0 on the x-axis). We can also see where audiences and critics disagree most <em>relative to their normal ratings</em>. So while audience members rate drama movies higher than critics do on average, when you take the audience's tendency to rate everything pretty high into account, critics actually like drama more.</p>
<p>Again this is easier to see if we take the difference.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [7]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="n">genre_revs</span> <span class="o">=</span> <span class="n">genre_revs</span><span class="o">.</span><span class="n">sort_values</span><span class="p">(</span><span class="s1">'dif'</span><span class="p">,</span> <span class="n">ascending</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span>
<span class="n">p</span> <span class="o">=</span> <span class="n">Bar</span><span class="p">(</span><span class="n">genre_revs</span><span class="o">.</span><span class="n">reset_index</span><span class="p">(),</span>
<span class="n">values</span><span class="o">=</span><span class="s1">'dif'</span><span class="p">,</span>
<span class="n">label</span><span class="o">=</span><span class="n">CatAttr</span><span class="p">(</span><span class="n">columns</span><span class="o">=</span><span class="p">[</span><span class="s1">'genre'</span><span class="p">],</span> <span class="n">sort</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span>
<span class="n">legend</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">title</span><span class="o">=</span><span class="s1">'Difference between critics and audience ratings by genre'</span><span class="p">,</span>
<span class="n">ylabel</span><span class="o">=</span><span class="s1">'Audience ratings minus critic ratings'</span><span class="p">,</span>
<span class="n">tools</span><span class="o">=</span><span class="p">[])</span>
<span class="n">p</span><span class="o">.</span><span class="n">toolbar_location</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">styleBokeh</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="n">show</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt"></div>
<div class="output_html rendered_html output_subarea">
<div class="bk-root">
<div class="bk-plotdiv" id="1806a496-af20-4ff0-831d-822c670996b8"></div>
</div>
<script type="text/javascript">
(function(global) {
function now() {
return new Date();
}
var force = false;
if (typeof (window._bokeh_onload_callbacks) === "undefined" || force === true) {
window._bokeh_onload_callbacks = [];
window._bokeh_is_loading = undefined;
}
if (typeof (window._bokeh_timeout) === "undefined" || force === true) {
window._bokeh_timeout = Date.now() + 0;
window._bokeh_failed_load = false;
}
var NB_LOAD_WARNING = {'data': {'text/html':
"<div style='background-color: #fdd'>\n"+
"<p>\n"+
"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \n"+
"may be due to a slow or bad network connection. Possible fixes:\n"+
"</p>\n"+
"<ul>\n"+
"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\n"+
"<li>use INLINE resources instead, as so:</li>\n"+
"</ul>\n"+
"<code>\n"+
"from bokeh.resources import INLINE\n"+
"output_notebook(resources=INLINE)\n"+
"</code>\n"+
"</div>"}};
function display_loaded() {
if (window.Bokeh !== undefined) {
document.getElementById("1806a496-af20-4ff0-831d-822c670996b8").textContent = "BokehJS successfully loaded.";
} else if (Date.now() < window._bokeh_timeout) {
setTimeout(display_loaded, 100)
}
}
function run_callbacks() {
window._bokeh_onload_callbacks.forEach(function(callback) { callback() });
delete window._bokeh_onload_callbacks
console.info("Bokeh: all callbacks have finished");
}
function load_libs(js_urls, callback) {
window._bokeh_onload_callbacks.push(callback);
if (window._bokeh_is_loading > 0) {
console.log("Bokeh: BokehJS is being loaded, scheduling callback at", now());
return null;
}
if (js_urls == null || js_urls.length === 0) {
run_callbacks();
return null;
}
console.log("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
window._bokeh_is_loading = js_urls.length;
for (var i = 0; i < js_urls.length; i++) {
var url = js_urls[i];
var s = document.createElement('script');
s.src = url;
s.async = false;
s.onreadystatechange = s.onload = function() {
window._bokeh_is_loading--;
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: all BokehJS libraries loaded");
run_callbacks()
}
};
s.onerror = function() {
console.warn("failed to load library " + url);
};
console.log("Bokeh: injecting script tag for BokehJS library: ", url);
document.getElementsByTagName("head")[0].appendChild(s);
}
};var element = document.getElementById("1806a496-af20-4ff0-831d-822c670996b8");
if (element == null) {
console.log("Bokeh: ERROR: autoload.js configured with elementid '1806a496-af20-4ff0-831d-822c670996b8' but no matching script tag was found. ")
return false;
}
var js_urls = [];
var inline_js = [
function(Bokeh) {
(function() {
var fn = function() {
var docs_json = {"8cf0d1ff-24d1-455f-8e77-0c0cc2d9747b":{"roots":{"references":[{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"f76445a0-6033-4563-904c-9c97ba18da64","type":"Rect"},{"attributes":{"callback":null,"column_names":["width","color","y","x","fill_alpha","label","height","line_color","line_alpha"],"data":{"chart_index":[{"genre":"Crime"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Crime"],"height":[-0.16139229747257772],"label":[{"genre":"Crime"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Crime"],"y":[-0.08069614873628886]}},"id":"f0a1122c-2ed1-485a-9a7f-6af4f3f16b03","type":"ColumnDataSource"},{"attributes":{"data_source":{"id":"56d7a684-14ec-437b-921d-18c14c2dc149","type":"ColumnDataSource"},"glyph":{"id":"a9e14a34-20a5-4bf6-9605-2ab3014375bc","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"8923928c-aa57-46cc-b5ab-b33b26ec8487","type":"GlyphRenderer"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"84f81392-530a-47b6-be14-c83dab081a97","type":"Rect"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"e9cebe9b-7ebd-4177-9211-3f7734dbd699","type":"Rect"},{"attributes":{"callback":null,"column_names":["width","color","y","x","fill_alpha","label","height","line_color","line_alpha"],"data":{"chart_index":[{"genre":"Drama"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Drama"],"height":[-0.1437463174465955],"label":[{"genre":"Drama"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Drama"],"y":[-0.07187315872329775]}},"id":"b1c6462e-cacf-4827-9e21-fd9768ae12e3","type":"ColumnDataSource"},{"attributes":{"below":[{"id":"61185b4b-5264-4429-b89f-0a1398d36443","type":"CategoricalAxis"}],"css_classes":null,"left":[{"id":"45ebacb7-a254-497f-8995-b520f97d2190","type":"LinearAxis"}],"renderers":[{"id":"a4e9416c-fd57-4407-a1a7-d76823318d00","type":"GlyphRenderer"},{"id":"b37955da-644a-4f51-bd45-5c1a7b6f3806","type":"GlyphRenderer"},{"id":"07f2eed4-b583-4ab1-9977-26502dc22a76","type":"GlyphRenderer"},{"id":"8923928c-aa57-46cc-b5ab-b33b26ec8487","type":"GlyphRenderer"},{"id":"94354ee3-826b-4616-91b5-7e8850440262","type":"GlyphRenderer"},{"id":"d6bd7be8-3638-4726-94d4-42495cb2d1ed","type":"GlyphRenderer"},{"id":"2d117feb-a685-4c04-8594-1afec608da4a","type":"GlyphRenderer"},{"id":"dcef912e-cc4c-4e01-923f-9cedce496921","type":"GlyphRenderer"},{"id":"67611060-9cc7-46d9-a2da-664e6212f945","type":"GlyphRenderer"},{"id":"9469284b-030f-45a4-b6c2-6f5953d96612","type":"GlyphRenderer"},{"id":"eeb79713-1c4f-4f86-ba32-e4b24b04e8f5","type":"GlyphRenderer"},{"id":"61185b4b-5264-4429-b89f-0a1398d36443","type":"CategoricalAxis"},{"id":"45ebacb7-a254-497f-8995-b520f97d2190","type":"LinearAxis"},{"id":"afb2c3af-6850-486a-aa6f-0fd1441becbf","type":"Grid"}],"title":{"id":"6bbbe3c8-af29-4edb-839c-3512cb97fcbd","type":"Title"},"tool_events":{"id":"8ebd1ac5-a51e-473b-ba6d-19f49731218f","type":"ToolEvents"},"toolbar":{"id":"b6ede3f1-9291-4b7e-b2a5-734930dec871","type":"Toolbar"},"toolbar_location":null,"x_mapper_type":"auto","x_range":{"id":"4fa910a6-d688-4c13-8f5d-15729243098c","type":"FactorRange"},"y_mapper_type":"auto","y_range":{"id":"cb1fb782-24f9-442a-af3e-d552e59ca1da","type":"Range1d"}},"id":"fd302159-123d-4be5-8038-57c899dbffe8","subtype":"Chart","type":"Plot"},{"attributes":{"data_source":{"id":"b1c6462e-cacf-4827-9e21-fd9768ae12e3","type":"ColumnDataSource"},"glyph":{"id":"84f81392-530a-47b6-be14-c83dab081a97","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"dcef912e-cc4c-4e01-923f-9cedce496921","type":"GlyphRenderer"},{"attributes":{},"id":"9197e264-388b-4697-af8e-20590f9c25e8","type":"CategoricalTickFormatter"},{"attributes":{"dimension":1,"plot":{"id":"fd302159-123d-4be5-8038-57c899dbffe8","subtype":"Chart","type":"Plot"},"ticker":{"id":"cd54216c-8263-4b23-9e24-44c18b6e6bd3","type":"BasicTicker"}},"id":"afb2c3af-6850-486a-aa6f-0fd1441becbf","type":"Grid"},{"attributes":{"data_source":{"id":"f2c8e7ac-e38a-4bb0-a56d-91385dfa8964","type":"ColumnDataSource"},"glyph":{"id":"72f62ade-b3d0-4c3f-9779-80471614917d","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"d6bd7be8-3638-4726-94d4-42495cb2d1ed","type":"GlyphRenderer"},{"attributes":{"axis_label":"Genre","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"9197e264-388b-4697-af8e-20590f9c25e8","type":"CategoricalTickFormatter"},"major_label_orientation":0.7853981633974483,"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"fd302159-123d-4be5-8038-57c899dbffe8","subtype":"Chart","type":"Plot"},"ticker":{"id":"799e098a-8bed-44bf-b653-54efc2fb2faa","type":"CategoricalTicker"}},"id":"61185b4b-5264-4429-b89f-0a1398d36443","type":"CategoricalAxis"},{"attributes":{"callback":null,"factors":["Fantasy","Adventure","Action","Sci-Fi","Animation","Family","Thriller","Drama","Comedy","Crime","Romance"]},"id":"4fa910a6-d688-4c13-8f5d-15729243098c","type":"FactorRange"},{"attributes":{"data_source":{"id":"2ebe1cda-f70c-4d8d-a373-dc8ea7ab8a6c","type":"ColumnDataSource"},"glyph":{"id":"f76445a0-6033-4563-904c-9c97ba18da64","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"a4e9416c-fd57-4407-a1a7-d76823318d00","type":"GlyphRenderer"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"a9e14a34-20a5-4bf6-9605-2ab3014375bc","type":"Rect"},{"attributes":{"axis_label":"Audience ratings minus critic ratings","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"4f8060dd-710b-4b0a-9e77-cf2ef1c2b734","type":"BasicTickFormatter"},"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"fd302159-123d-4be5-8038-57c899dbffe8","subtype":"Chart","type":"Plot"},"ticker":{"id":"cd54216c-8263-4b23-9e24-44c18b6e6bd3","type":"BasicTicker"}},"id":"45ebacb7-a254-497f-8995-b520f97d2190","type":"LinearAxis"},{"attributes":{"callback":null,"column_names":["width","color","y","x","fill_alpha","label","height","line_color","line_alpha"],"data":{"chart_index":[{"genre":"Action"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Action"],"height":[0.19066447775251041],"label":[{"genre":"Action"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Action"],"y":[0.09533223887625521]}},"id":"7d664dd1-f409-4de7-9130-8bcbb82cba26","type":"ColumnDataSource"},{"attributes":{"callback":null,"column_names":["width","color","y","x","fill_alpha","label","height","line_color","line_alpha"],"data":{"chart_index":[{"genre":"Animation"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Animation"],"height":[0.002355277955377706],"label":[{"genre":"Animation"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Animation"],"y":[0.001177638977688853]}},"id":"c78a4ecb-6bc7-40e0-8477-ca9ce8f365e5","type":"ColumnDataSource"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"8399844e-0be3-48cf-9d28-466b2016da10","type":"Rect"},{"attributes":{"callback":null,"column_names":["width","color","y","x","fill_alpha","label","height","line_color","line_alpha"],"data":{"chart_index":[{"genre":"Romance"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Romance"],"height":[-0.1921486939034225],"label":[{"genre":"Romance"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Romance"],"y":[-0.09607434695171126]}},"id":"fd2644b9-7128-405f-a943-9298c6f2d77c","type":"ColumnDataSource"},{"attributes":{"active_drag":"auto","active_scroll":"auto","active_tap":"auto"},"id":"b6ede3f1-9291-4b7e-b2a5-734930dec871","type":"Toolbar"},{"attributes":{"data_source":{"id":"7d664dd1-f409-4de7-9130-8bcbb82cba26","type":"ColumnDataSource"},"glyph":{"id":"e9cebe9b-7ebd-4177-9211-3f7734dbd699","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"07f2eed4-b583-4ab1-9977-26502dc22a76","type":"GlyphRenderer"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"65d69d5a-c7af-4c58-bcb3-129fbe986d30","type":"Rect"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"72f62ade-b3d0-4c3f-9779-80471614917d","type":"Rect"},{"attributes":{},"id":"cd54216c-8263-4b23-9e24-44c18b6e6bd3","type":"BasicTicker"},{"attributes":{"data_source":{"id":"c564a2f4-ea8c-4469-b406-454296e936f2","type":"ColumnDataSource"},"glyph":{"id":"b2d0b2a9-278a-49cd-b402-0dae835e29c6","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"2d117feb-a685-4c04-8594-1afec608da4a","type":"GlyphRenderer"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"93a47d8d-7781-48c2-b37a-15607b4afb13","type":"Rect"},{"attributes":{"callback":null,"column_names":["width","color","y","x","fill_alpha","label","height","line_color","line_alpha"],"data":{"chart_index":[{"genre":"Fantasy"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Fantasy"],"height":[0.3004613971397926],"label":[{"genre":"Fantasy"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Fantasy"],"y":[0.1502306985698963]}},"id":"2ebe1cda-f70c-4d8d-a373-dc8ea7ab8a6c","type":"ColumnDataSource"},{"attributes":{"callback":null,"end":0.30587703230161106,"start":-0.19756432906524102},"id":"cb1fb782-24f9-442a-af3e-d552e59ca1da","type":"Range1d"},{"attributes":{},"id":"4f8060dd-710b-4b0a-9e77-cf2ef1c2b734","type":"BasicTickFormatter"},{"attributes":{"data_source":{"id":"b6ba5f4b-fdca-4618-aeb8-8911aed8a3ce","type":"ColumnDataSource"},"glyph":{"id":"93a47d8d-7781-48c2-b37a-15607b4afb13","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"b37955da-644a-4f51-bd45-5c1a7b6f3806","type":"GlyphRenderer"},{"attributes":{"plot":null,"text":"Difference between critics and audience ratings by genre","text_font_size":{"value":"14pt"}},"id":"6bbbe3c8-af29-4edb-839c-3512cb97fcbd","type":"Title"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"b196796e-d372-41e3-95aa-536772eaa4ab","type":"Rect"},{"attributes":{"data_source":{"id":"c78a4ecb-6bc7-40e0-8477-ca9ce8f365e5","type":"ColumnDataSource"},"glyph":{"id":"8399844e-0be3-48cf-9d28-466b2016da10","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"94354ee3-826b-4616-91b5-7e8850440262","type":"GlyphRenderer"},{"attributes":{"callback":null,"column_names":["width","color","y","x","fill_alpha","label","height","line_color","line_alpha"],"data":{"chart_index":[{"genre":"Adventure"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Adventure"],"height":[0.19809275441955893],"label":[{"genre":"Adventure"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Adventure"],"y":[0.09904637720977946]}},"id":"b6ba5f4b-fdca-4618-aeb8-8911aed8a3ce","type":"ColumnDataSource"},{"attributes":{"data_source":{"id":"004e03ef-5d31-4281-99fe-137655f61f9f","type":"ColumnDataSource"},"glyph":{"id":"f8c162c1-c3d7-4b51-ad91-84103b5bb501","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"67611060-9cc7-46d9-a2da-664e6212f945","type":"GlyphRenderer"},{"attributes":{"callback":null,"column_names":["width","color","y","x","fill_alpha","label","height","line_color","line_alpha"],"data":{"chart_index":[{"genre":"Thriller"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Thriller"],"height":[-0.12800157360238437],"label":[{"genre":"Thriller"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Thriller"],"y":[-0.06400078680119219]}},"id":"c564a2f4-ea8c-4469-b406-454296e936f2","type":"ColumnDataSource"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"f8c162c1-c3d7-4b51-ad91-84103b5bb501","type":"Rect"},{"attributes":{"callback":null,"column_names":["width","color","y","x","fill_alpha","label","height","line_color","line_alpha"],"data":{"chart_index":[{"genre":"Family"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Family"],"height":[-0.020684212634298663],"label":[{"genre":"Family"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Family"],"y":[-0.010342106317149331]}},"id":"f2c8e7ac-e38a-4bb0-a56d-91385dfa8964","type":"ColumnDataSource"},{"attributes":{},"id":"8ebd1ac5-a51e-473b-ba6d-19f49731218f","type":"ToolEvents"},{"attributes":{"callback":null,"column_names":["width","color","y","x","fill_alpha","label","height","line_color","line_alpha"],"data":{"chart_index":[{"genre":"Comedy"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Comedy"],"height":[-0.15366198402231931],"label":[{"genre":"Comedy"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Comedy"],"y":[-0.07683099201115966]}},"id":"004e03ef-5d31-4281-99fe-137655f61f9f","type":"ColumnDataSource"},{"attributes":{},"id":"799e098a-8bed-44bf-b653-54efc2fb2faa","type":"CategoricalTicker"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"b2d0b2a9-278a-49cd-b402-0dae835e29c6","type":"Rect"},{"attributes":{"data_source":{"id":"fd2644b9-7128-405f-a943-9298c6f2d77c","type":"ColumnDataSource"},"glyph":{"id":"b196796e-d372-41e3-95aa-536772eaa4ab","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"eeb79713-1c4f-4f86-ba32-e4b24b04e8f5","type":"GlyphRenderer"},{"attributes":{"callback":null,"column_names":["width","color","y","x","fill_alpha","label","height","line_color","line_alpha"],"data":{"chart_index":[{"genre":"Sci-Fi"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Sci-Fi"],"height":[0.04303571809511935],"label":[{"genre":"Sci-Fi"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Sci-Fi"],"y":[0.021517859047559675]}},"id":"56d7a684-14ec-437b-921d-18c14c2dc149","type":"ColumnDataSource"},{"attributes":{"data_source":{"id":"f0a1122c-2ed1-485a-9a7f-6af4f3f16b03","type":"ColumnDataSource"},"glyph":{"id":"65d69d5a-c7af-4c58-bcb3-129fbe986d30","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"9469284b-030f-45a4-b6c2-6f5953d96612","type":"GlyphRenderer"}],"root_ids":["fd302159-123d-4be5-8038-57c899dbffe8"]},"title":"Bokeh Application","version":"0.12.4"}};
var render_items = [{"docid":"8cf0d1ff-24d1-455f-8e77-0c0cc2d9747b","elementid":"1806a496-af20-4ff0-831d-822c670996b8","modelid":"fd302159-123d-4be5-8038-57c899dbffe8"}];
Bokeh.embed.embed_items(docs_json, render_items);
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
},
function(Bokeh) {
}
];
function run_inline_js() {
if ((window.Bokeh !== undefined) || (force === true)) {
for (var i = 0; i < inline_js.length; i++) {
inline_js[i](window.Bokeh);
}if (force === true) {
display_loaded();
}} else if (Date.now() < window._bokeh_timeout) {
setTimeout(run_inline_js, 100);
} else if (!window._bokeh_failed_load) {
console.log("Bokeh: BokehJS failed to load within specified timeout.");
window._bokeh_failed_load = true;
} else if (force !== true) {
var cell = $(document.getElementById("1806a496-af20-4ff0-831d-822c670996b8")).parents('.cell').data().cell;
cell.output_area.append_execute_result(NB_LOAD_WARNING)
}
}
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: BokehJS loaded, going straight to plotting");
run_inline_js();
} else {
load_libs(js_urls, function() {
console.log("Bokeh: BokehJS plotting callback run at", now());
run_inline_js();
});
}
}(this));
</script>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Now we see that Fantasy is still the genre audiences disagree with critics most about, but we also get a neat separation - there are genres audiences like relatively more (fantasy, adventure, and action), and those that critics like relatively more (thriller, drama, comedy, crime, romance). Sci-fi, animation, and family is where there is the most agreement.</p>
<p>For completeness, I'm including the top 10 lists I generated for the last post. The lists are notably quite similar.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [8]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">#Make mov presentable for printing</span>
<span class="n">print_mov</span> <span class="o">=</span> <span class="n">mov</span><span class="o">.</span><span class="n">drop</span><span class="p">([</span><span class="s1">'Genre_1'</span><span class="p">,</span> <span class="s1">'Genre_2'</span><span class="p">,</span> <span class="s1">'Genre_3'</span><span class="p">,</span> <span class="s1">'colors'</span><span class="p">],</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="n">print_mov</span><span class="o">.</span><span class="n">columns</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'Title'</span><span class="p">,</span> <span class="s1">'Audience Score'</span><span class="p">,</span> <span class="s1">'Critic Score'</span><span class="p">,</span> <span class="s1">'Difference'</span><span class="p">,</span> <span class="s1">'Genres'</span><span class="p">]</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="Top-10-Fantasy-Movies-Audiences-Love-More-Than-Critics">Top 10 Fantasy Movies Audiences Love More Than Critics<a class="anchor-link" href="#Top-10-Fantasy-Movies-Audiences-Love-More-Than-Critics">¶</a></h1><p>We still get lots of twilight and superhero movies on this scale.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [9]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">#Get the titles of the 10 fantasy movies with the greatest difference between audience and critics</span>
<span class="n">fantasy_movie_titles</span> <span class="o">=</span> <span class="p">(</span><span class="n">melted_mov</span><span class="p">[</span><span class="n">melted_mov</span><span class="p">[</span><span class="s1">'genre'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Fantasy'</span><span class="p">]</span><span class="o">.</span>
<span class="n">sort_values</span><span class="p">(</span><span class="n">by</span><span class="o">=</span><span class="s1">'dif'</span><span class="p">,</span> <span class="n">ascending</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">10</span><span class="p">]</span>
<span class="p">[</span><span class="s1">'title'</span><span class="p">])</span>
<span class="c1">#Make the table pretty and output it</span>
<span class="n">fantasy_table</span> <span class="o">=</span> <span class="p">(</span><span class="n">print_mov</span>
<span class="p">[</span><span class="n">print_mov</span><span class="p">[</span><span class="s1">'Title'</span><span class="p">]</span><span class="o">.</span><span class="n">isin</span><span class="p">(</span><span class="n">fantasy_movie_titles</span><span class="p">)]</span><span class="o">.</span>
<span class="n">sort_values</span><span class="p">(</span><span class="s1">'Difference'</span><span class="p">,</span> <span class="n">ascending</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="p">)</span>
<span class="n">fantasy_table</span><span class="o">.</span><span class="n">index</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">11</span><span class="p">)</span>
<span class="n">fantasy_table</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[9]:</div>
<div class="output_html rendered_html output_subarea output_execute_result">
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>Title</th>
<th>Audience Score</th>
<th>Critic Score</th>
<th>Difference</th>
<th>Genres</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<td>300</td>
<td>1.6</td>
<td>-0.4</td>
<td>2.0</td>
<td>War Fantasy Action</td>
</tr>
<tr>
<th>2</th>
<td>The Twilight Saga: Breaking Dawn - Part 2</td>
<td>0.8</td>
<td>-1.1</td>
<td>2.0</td>
<td>Fantasy Drama Adventure</td>
</tr>
<tr>
<th>3</th>
<td>The Twilight Saga: New Moon</td>
<td>0.3</td>
<td>-1.5</td>
<td>1.8</td>
<td>Fantasy Drama Adventure</td>
</tr>
<tr>
<th>4</th>
<td>Pirates of the Caribbean: At World's End</td>
<td>0.8</td>
<td>-0.9</td>
<td>1.7</td>
<td>Fantasy Adventure Action</td>
</tr>
<tr>
<th>5</th>
<td>The Hobbit: An Unexpected Journey</td>
<td>1.6</td>
<td>0.0</td>
<td>1.6</td>
<td>Fantasy Adventure</td>
</tr>
<tr>
<th>6</th>
<td>Pirates of the Caribbean: Dead Man's Chest</td>
<td>1.1</td>
<td>-0.5</td>
<td>1.6</td>
<td>Fantasy Adventure Action</td>
</tr>
<tr>
<th>7</th>
<td>The Hobbit: The Desolation of Smaug</td>
<td>1.6</td>
<td>0.2</td>
<td>1.5</td>
<td>Fantasy Adventure</td>
</tr>
<tr>
<th>8</th>
<td>Man of Steel</td>
<td>1.1</td>
<td>-0.3</td>
<td>1.4</td>
<td>Fantasy Adventure Action</td>
</tr>
<tr>
<th>9</th>
<td>Thor: The Dark World</td>
<td>1.1</td>
<td>-0.3</td>
<td>1.4</td>
<td>Fantasy Adventure Action</td>
</tr>
<tr>
<th>10</th>
<td>The Hobbit: The Battle of the Five Armies</td>
<td>1.1</td>
<td>-0.2</td>
<td>1.3</td>
<td>Fantasy Adventure</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="-Top-10-Movies-Audiences-Love-More-Than-Critics"><center> Top 10 Movies Audiences Love More Than Critics</center><a class="anchor-link" href="#-Top-10-Movies-Audiences-Love-More-Than-Critics">¶</a></h1><p>This list has mostly the same movies as the unstandardized version, with some of the ordering slightly different.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [10]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="n">top10_table</span> <span class="o">=</span> <span class="n">print_mov</span><span class="o">.</span><span class="n">sort_values</span><span class="p">(</span><span class="s1">'Difference'</span><span class="p">,</span> <span class="n">ascending</span><span class="o">=</span><span class="kc">False</span><span class="p">)[</span><span class="mi">0</span><span class="p">:</span><span class="mi">10</span><span class="p">]</span>
<span class="n">top10_table</span><span class="o">.</span><span class="n">index</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">11</span><span class="p">)</span>
<span class="n">top10_table</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[10]:</div>
<div class="output_html rendered_html output_subarea output_execute_result">
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>Title</th>
<th>Audience Score</th>
<th>Critic Score</th>
<th>Difference</th>
<th>Genres</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<td>Bad Boys II</td>
<td>0.3</td>
<td>-2.0</td>
<td>2.3</td>
<td>Crime Comedy Action</td>
</tr>
<tr>
<th>2</th>
<td>Transformers</td>
<td>1.6</td>
<td>-0.6</td>
<td>2.3</td>
<td>Sci-Fi Adventure Action</td>
</tr>
<tr>
<th>3</th>
<td>Fast & Furious 6</td>
<td>1.9</td>
<td>-0.3</td>
<td>2.2</td>
<td>Thriller Crime Action</td>
</tr>
<tr>
<th>4</th>
<td>Transformers: Revenge of the Fallen</td>
<td>0.1</td>
<td>-2.1</td>
<td>2.2</td>
<td>Sci-Fi Adventure Action</td>
</tr>
<tr>
<th>5</th>
<td>300</td>
<td>1.6</td>
<td>-0.4</td>
<td>2.0</td>
<td>War Fantasy Action</td>
</tr>
<tr>
<th>6</th>
<td>The Twilight Saga: Breaking Dawn - Part 2</td>
<td>0.8</td>
<td>-1.1</td>
<td>2.0</td>
<td>Fantasy Drama Adventure</td>
</tr>
<tr>
<th>7</th>
<td>Despicable Me 2</td>
<td>1.9</td>
<td>0.0</td>
<td>1.9</td>
<td>Family Comedy Animation</td>
</tr>
<tr>
<th>8</th>
<td>The Twilight Saga: New Moon</td>
<td>0.3</td>
<td>-1.5</td>
<td>1.8</td>
<td>Fantasy Drama Adventure</td>
</tr>
<tr>
<th>9</th>
<td>National Treasure: Book of Secrets</td>
<td>0.3</td>
<td>-1.4</td>
<td>1.7</td>
<td>Mystery Adventure Action</td>
</tr>
<tr>
<th>10</th>
<td>Pirates of the Caribbean: At World's End</td>
<td>0.8</td>
<td>-0.9</td>
<td>1.7</td>
<td>Fantasy Adventure Action</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="-Movies-Critics-Love-More-Than-Audiences-"><center> Movies Critics Love More Than Audiences </center><a class="anchor-link" href="#-Movies-Critics-Love-More-Than-Audiences-">¶</a></h1><p>Again, this mostly looks the same as the unstandardized list.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [11]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="n">bot10_table</span> <span class="o">=</span> <span class="n">print_mov</span><span class="o">.</span><span class="n">sort_values</span><span class="p">(</span><span class="s1">'Difference'</span><span class="p">,</span> <span class="n">ascending</span><span class="o">=</span><span class="kc">True</span><span class="p">)[</span><span class="mi">0</span><span class="p">:</span><span class="mi">10</span><span class="p">]</span>
<span class="n">bot10_table</span><span class="o">.</span><span class="n">index</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">11</span><span class="p">)</span>
<span class="n">bot10_table</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[11]:</div>
<div class="output_html rendered_html output_subarea output_execute_result">
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>Title</th>
<th>Audience Score</th>
<th>Critic Score</th>
<th>Difference</th>
<th>Genres</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<td>King Kong</td>
<td>-1.8</td>
<td>0.9</td>
<td>-2.7</td>
<td>Drama Adventure Action</td>
</tr>
<tr>
<th>2</th>
<td>Rocky</td>
<td>-0.7</td>
<td>1.4</td>
<td>-2.1</td>
<td>Sport Drama</td>
</tr>
<tr>
<th>3</th>
<td>E.T. the Extra-Terrestrial</td>
<td>0.1</td>
<td>2.0</td>
<td>-1.9</td>
<td>Sci-Fi Family Western</td>
</tr>
<tr>
<th>4</th>
<td>War of the Worlds</td>
<td>-1.5</td>
<td>0.3</td>
<td>-1.9</td>
<td>Thriller Sci-Fi Adventure</td>
</tr>
<tr>
<th>5</th>
<td>Charlie and the Chocolate Factory</td>
<td>-1.3</td>
<td>0.5</td>
<td>-1.8</td>
<td>Comedy Adventure Family</td>
</tr>
<tr>
<th>6</th>
<td>Titanic</td>
<td>-0.5</td>
<td>1.1</td>
<td>-1.6</td>
<td>Romance Drama</td>
</tr>
<tr>
<th>7</th>
<td>Back to School</td>
<td>-1.3</td>
<td>0.3</td>
<td>-1.6</td>
<td>Sport Romance Comedy</td>
</tr>
<tr>
<th>8</th>
<td>The Incredibles</td>
<td>-0.2</td>
<td>1.4</td>
<td>-1.6</td>
<td>Animation Adventure Action</td>
</tr>
<tr>
<th>9</th>
<td>Shakespeare in Love</td>
<td>-0.2</td>
<td>1.4</td>
<td>-1.6</td>
<td>Romance Drama Comedy</td>
</tr>
<tr>
<th>10</th>
<td>Toy Story 2</td>
<td>0.1</td>
<td>1.6</td>
<td>-1.5</td>
<td>Comedy Animation Adventure</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="Conclusion"><center>Conclusion</center><a class="anchor-link" href="#Conclusion">¶</a></h1><p>I think you could spend a lot of time discussing what the best way of interpreting the audience and critic scores - it's a strange case where we have a seemingly intuitive score (a 10-point scale), but we don't know if our populations (critics and audiences) are using them the same. It's nice that for the most part, this difference in interpretation doesn't change much in terms of what genres or movies audiences and critics disagree on most.</p>
</div>
</div>
</div>
<script type="text/javascript">if (!document.getElementById('mathjaxscript_pelican_#%@#$@#')) {
var mathjaxscript = document.createElement('script');
mathjaxscript.id = 'mathjaxscript_pelican_#%@#$@#';
mathjaxscript.type = 'text/javascript';
mathjaxscript.src = '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
mathjaxscript[(window.opera ? "innerHTML" : "text")] =
"MathJax.Hub.Config({" +
" config: ['MMLorHTML.js']," +
" TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'AMS' } }," +
" jax: ['input/TeX','input/MathML','output/HTML-CSS']," +
" extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']," +
" displayAlign: 'center'," +
" displayIndent: '0em'," +
" showMathMenu: true," +
" tex2jax: { " +
" inlineMath: [ ['$','$'] ], " +
" displayMath: [ ['$$','$$'] ]," +
" processEscapes: true," +
" preview: 'TeX'," +
" }, " +
" 'HTML-CSS': { " +
" styles: { '.MathJax_Display, .MathJax .mo, .MathJax .mi, .MathJax .mn': {color: 'black ! important'} }" +
" } " +
"}); ";
(document.body || document.getElementsByTagName('head')[0]).appendChild(mathjaxscript);
}
</script>
Genres Where Audiences and Critics Disagree Most2017-02-23T00:00:00-05:002017-02-23T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2017-02-23:/movie-genre-ratings<p>An investigation of what movie genres audiences and critics disagree on most</p><br /><header id="attribution" style="color:#999; font-size: 120%; text-align: center">
<b>This article was created with Jupyter. To see the code generating all figures and outputs, click 'Show Code'</b>
</header>
<script>
function code_toggle() {
if (code_shown){
$('div.input').hide('500');
$('#toggleButton').val('Show Code')
} else {
$('div.input').show('500');
$('#toggleButton').val('Hide Code')
}
code_shown = !code_shown
}
$( document ).ready(function(){
code_shown=false;
$('div.input').hide()
});
</script>
<div style="text-align: center;"><form action="javascript:code_toggle()"><input id="toggleButton" style="font-size: 200%; width: 10em" type="submit" value="Show Code" /></form></div><br /><div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="Introduction"><center>Introduction</center><a class="anchor-link" href="#Introduction">¶</a></h1><p>I recently browsing the Rotten Tomatoes page all-time favorite sci-fi series, <em><a href="https://www.rottentomatoes.com/tv/firefly/s01">Firefly</a></em>. I was surprised that critics were not impressed with the series (average rating of 7.96/10). Among 'Top Critics', this score dropped to an average of 7.25/10. But everyone I know who has seen it loves the series!</p>
<p>Unwilling to accept that my beloved sci-fi franchise deserved this low rating from critics, I thought that maybe this was a bias with science fiction. Critics end up seeing most big movies and shows regardless of their personal tastes, so on average they might not be geeky enough to really appreciate a good science fiction movie. The typical audience who has decided to view science fiction, on the other hand, presumably are geeks who really 'get' science fiction. So we might expect audiences to rate good science fiction higher than critics, because the geeks who see science fiction really 'get it'. Consistent with this, the average audience rating of <em>Firefly</em> is 9.2/10 - a score closer to what I (a self-styled science-fiction connoisseur) think it really deserves.</p>
<p>Is this true of the genre more generally? Do audiences tend to appreciate (or at least more highly rate) science fiction media more than the critics? Unsatisfied with just hypothesizing about this, I decided to look at some data. It turns out I was very wrong.</p>
<h1 id="Data-Source-and-Disclaimers"><center>Data Source and Disclaimers</center><a class="anchor-link" href="#Data-Source-and-Disclaimers">¶</a></h1><p>The data I analyzed is from the 10 most popular movies every year from 1975-2015. I obtained the data from <a href="https://www.crowdflower.com/data/blockbuster-database/">Crowdflower</a>. The data used was largely a matter of convenience - it was the first data source I found that was fairly large and had genre labels, audience ratings, and critic ratings. That said, since these are 'blockbuster movies', the results might be a bit different than if we included less popular movies.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [1]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="o">%</span><span class="k">matplotlib</span> inline
<span class="c1">#Import some tools we'll use</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">bokeh.palettes</span> <span class="k">import</span> <span class="n">Category20</span><span class="p">,</span> <span class="n">Category20b</span>
<span class="kn">from</span> <span class="nn">bokeh.plotting</span> <span class="k">import</span> <span class="n">figure</span><span class="p">,</span> <span class="n">show</span><span class="p">,</span> <span class="n">output_notebook</span>
<span class="kn">from</span> <span class="nn">bokeh.models</span> <span class="k">import</span> <span class="n">ColumnDataSource</span><span class="p">,</span> <span class="n">Range1d</span><span class="p">,</span> <span class="n">LabelSet</span><span class="p">,</span> <span class="n">Label</span><span class="p">,</span> <span class="n">HoverTool</span>
<span class="kn">from</span> <span class="nn">bokeh.charts.attributes</span> <span class="k">import</span> <span class="n">CatAttr</span>
<span class="kn">from</span> <span class="nn">bokeh.charts</span> <span class="k">import</span> <span class="n">Bar</span>
<span class="kn">from</span> <span class="nn">scipy.stats.mstats</span> <span class="k">import</span> <span class="n">zscore</span>
<span class="n">output_notebook</span><span class="p">(</span><span class="n">hide_banner</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="c1">#Display floats in pandas tables only to one decimal</span>
<span class="n">pd</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">display</span><span class="o">.</span><span class="n">float_format</span> <span class="o">=</span> <span class="s1">'</span><span class="si">{:,.1f}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt"></div>
<div class="output_html rendered_html output_subarea">
</div>
</div>
<div class="output_area">
<div class="prompt"></div>
<div id="f589fbff-b93d-4d98-85f5-4acc3e3ff45c"></div>
<div class="output_subarea output_javascript">
<script type="text/javascript">
var element = $('#f589fbff-b93d-4d98-85f5-4acc3e3ff45c');
(function(global) {
function now() {
return new Date();
}
var force = true;
if (typeof (window._bokeh_onload_callbacks) === "undefined" || force === true) {
window._bokeh_onload_callbacks = [];
window._bokeh_is_loading = undefined;
}
if (typeof (window._bokeh_timeout) === "undefined" || force === true) {
window._bokeh_timeout = Date.now() + 5000;
window._bokeh_failed_load = false;
}
var NB_LOAD_WARNING = {'data': {'text/html':
"<div style='background-color: #fdd'>\n"+
"<p>\n"+
"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \n"+
"may be due to a slow or bad network connection. Possible fixes:\n"+
"</p>\n"+
"<ul>\n"+
"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\n"+
"<li>use INLINE resources instead, as so:</li>\n"+
"</ul>\n"+
"<code>\n"+
"from bokeh.resources import INLINE\n"+
"output_notebook(resources=INLINE)\n"+
"</code>\n"+
"</div>"}};
function display_loaded() {
if (window.Bokeh !== undefined) {
document.getElementById("").textContent = "BokehJS successfully loaded.";
} else if (Date.now() < window._bokeh_timeout) {
setTimeout(display_loaded, 100)
}
}
function run_callbacks() {
window._bokeh_onload_callbacks.forEach(function(callback) { callback() });
delete window._bokeh_onload_callbacks
console.info("Bokeh: all callbacks have finished");
}
function load_libs(js_urls, callback) {
window._bokeh_onload_callbacks.push(callback);
if (window._bokeh_is_loading > 0) {
console.log("Bokeh: BokehJS is being loaded, scheduling callback at", now());
return null;
}
if (js_urls == null || js_urls.length === 0) {
run_callbacks();
return null;
}
console.log("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
window._bokeh_is_loading = js_urls.length;
for (var i = 0; i < js_urls.length; i++) {
var url = js_urls[i];
var s = document.createElement('script');
s.src = url;
s.async = false;
s.onreadystatechange = s.onload = function() {
window._bokeh_is_loading--;
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: all BokehJS libraries loaded");
run_callbacks()
}
};
s.onerror = function() {
console.warn("failed to load library " + url);
};
console.log("Bokeh: injecting script tag for BokehJS library: ", url);
document.getElementsByTagName("head")[0].appendChild(s);
}
};
var js_urls = ["https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.js", "https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.js"];
var inline_js = [
function(Bokeh) {
Bokeh.set_log_level("info");
},
function(Bokeh) {
console.log("Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css");
Bokeh.embed.inject_css("https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css");
console.log("Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css");
Bokeh.embed.inject_css("https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css");
}
];
function run_inline_js() {
if ((window.Bokeh !== undefined) || (force === true)) {
for (var i = 0; i < inline_js.length; i++) {
inline_js[i](window.Bokeh);
}} else if (Date.now() < window._bokeh_timeout) {
setTimeout(run_inline_js, 100);
} else if (!window._bokeh_failed_load) {
console.log("Bokeh: BokehJS failed to load within specified timeout.");
window._bokeh_failed_load = true;
} else if (force !== true) {
var cell = $(document.getElementById("")).parents('.cell').data().cell;
cell.output_area.append_execute_result(NB_LOAD_WARNING)
}
}
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: BokehJS loaded, going straight to plotting");
run_inline_js();
} else {
load_libs(js_urls, function() {
console.log("Bokeh: BokehJS plotting callback run at", now());
run_inline_js();
});
}
}(this));
</script>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [2]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="kn">import</span> <span class="nn">bokeh</span>
<span class="n">bokeh</span><span class="o">.</span><span class="n">__version__</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[2]:</div>
<div class="output_text output_subarea output_execute_result">
<pre>'0.13.0'</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [2]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">##DATA PREP</span>
<span class="c1">#Read in the data</span>
<span class="n">mov</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_csv</span><span class="p">(</span><span class="s1">'blockbuster-top_ten_movies_per_year_DFE.csv'</span><span class="p">)</span>
<span class="c1">#Remove columns where data is missing</span>
<span class="n">mov</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[(</span><span class="n">mov</span><span class="p">[</span><span class="s1">'rt_score'</span><span class="p">]</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">&</span> <span class="p">(</span><span class="n">mov</span><span class="p">[</span><span class="s1">'rt_audience_score'</span><span class="p">]</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">&</span> <span class="p">(</span><span class="o">~</span><span class="n">pd</span><span class="o">.</span><span class="n">isnull</span><span class="p">(</span><span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_1'</span><span class="p">]))]</span>
<span class="c1">#rt_score is on a 1 to 10 scale, rt_audience_score is 0.5 to 5. Let's rescale</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'rt_audience_score'</span><span class="p">]</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[</span><span class="s1">'rt_audience_score'</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span>
<span class="c1">#Only include those columns we want</span>
<span class="n">mov</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[[</span><span class="s1">'title'</span><span class="p">,</span> <span class="s1">'rt_audience_score'</span><span class="p">,</span><span class="s1">'rt_score'</span><span class="p">,</span><span class="s1">'Genre_1'</span><span class="p">,</span><span class="s1">'Genre_2'</span><span class="p">,</span><span class="s1">'Genre_3'</span><span class="p">]]</span>
<span class="c1">#Calculate difference between audience and critic scores (to use later)</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'dif'</span><span class="p">]</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[</span><span class="s1">'rt_audience_score'</span><span class="p">]</span> <span class="o">-</span> <span class="n">mov</span><span class="p">[</span><span class="s1">'rt_score'</span><span class="p">]</span>
<span class="c1">#Generate a unique color based on whatever the first genre is for each movie, for plotting</span>
<span class="n">cat</span> <span class="o">=</span> <span class="n">Category20</span><span class="p">[</span><span class="mi">20</span><span class="p">]</span>
<span class="n">cat</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Category20b</span><span class="p">[</span><span class="mi">3</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
<span class="n">genres</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_1'</span><span class="p">]</span><span class="o">.</span><span class="n">unique</span><span class="p">()</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'colors'</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="n">cat</span><span class="p">[</span><span class="n">np</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">genres</span> <span class="o">==</span> <span class="n">genre</span><span class="p">)[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">]]</span> <span class="k">for</span> <span class="n">genre</span> <span class="ow">in</span> <span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_1'</span><span class="p">]]</span>
<span class="c1">#Generate a genre string based on the three genres (to prevent hover tooltips from displaying nans)</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_str'</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_1'</span><span class="p">]</span> <span class="o">+</span> <span class="s1">' '</span> <span class="o">+</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_2'</span><span class="p">]</span><span class="o">.</span><span class="n">fillna</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span> <span class="o">+</span> <span class="s1">' '</span> <span class="o">+</span>
<span class="n">mov</span><span class="p">[</span><span class="s1">'Genre_3'</span><span class="p">]</span><span class="o">.</span><span class="n">fillna</span><span class="p">(</span><span class="s1">''</span><span class="p">))</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [3]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">#Themes aren't really supported yet in Bokeh, so define a function to do styling</span>
<span class="k">def</span> <span class="nf">styleBokeh</span><span class="p">(</span><span class="n">p</span><span class="p">):</span>
<span class="c1">#Hide the bokeh toolbar</span>
<span class="n">p</span><span class="o">.</span><span class="n">toolbar_location</span> <span class="o">=</span> <span class="kc">None</span>
<span class="c1">#Format axis label fonts</span>
<span class="n">p</span><span class="o">.</span><span class="n">yaxis</span><span class="o">.</span><span class="n">axis_label_text_font_size</span> <span class="o">=</span> <span class="s2">"12pt"</span>
<span class="n">p</span><span class="o">.</span><span class="n">yaxis</span><span class="o">.</span><span class="n">axis_label_text_font_style</span> <span class="o">=</span> <span class="s2">"normal"</span>
<span class="n">p</span><span class="o">.</span><span class="n">xaxis</span><span class="o">.</span><span class="n">axis_label_text_font_size</span> <span class="o">=</span> <span class="s2">"12pt"</span>
<span class="n">p</span><span class="o">.</span><span class="n">xaxis</span><span class="o">.</span><span class="n">axis_label_text_font_style</span> <span class="o">=</span> <span class="s2">"normal"</span>
<span class="n">p</span><span class="o">.</span><span class="n">xaxis</span><span class="o">.</span><span class="n">major_label_text_font_size</span> <span class="o">=</span> <span class="s2">"10pt"</span>
<span class="n">p</span><span class="o">.</span><span class="n">yaxis</span><span class="o">.</span><span class="n">major_label_text_font_size</span> <span class="o">=</span> <span class="s2">"10pt"</span>
<span class="c1">#Change title font size</span>
<span class="n">p</span><span class="o">.</span><span class="n">title</span><span class="o">.</span><span class="n">text_font_size</span><span class="o">=</span><span class="s1">'14pt'</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="Critics-Are-More-Critical?"><center>Critics Are More Critical?</center><a class="anchor-link" href="#Critics-Are-More-Critical?">¶</a></h1><p>Here is a plot of each movie's audience and critic ratings, coloring by one of their genres. You can hover over a point to find out what movie it corresponds to. Note that most movies have multiple genres, so the coloring is a bit arbitrary. The red diagonal indicates where audience scores and critic scores are equal. Above the line means audiences rate the film higher, below means critics rate it higher.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [4]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">##SCATTER PLOT ALL MOVIES</span>
<span class="c1">#Make a data source for bokeh to use</span>
<span class="n">mov_source</span> <span class="o">=</span> <span class="n">ColumnDataSource</span><span class="p">(</span><span class="n">mov</span><span class="p">)</span>
<span class="c1">#We want the axes on the same scale, so figure out min of both and max of both</span>
<span class="n">low</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[[</span><span class="s1">'rt_audience_score'</span><span class="p">,</span><span class="s1">'rt_score'</span><span class="p">]]</span><span class="o">.</span><span class="n">min</span><span class="p">()</span><span class="o">.</span><span class="n">min</span><span class="p">()</span> <span class="o">-</span> <span class="mf">0.2</span>
<span class="n">high</span> <span class="o">=</span> <span class="n">mov</span><span class="p">[[</span><span class="s1">'rt_audience_score'</span><span class="p">,</span><span class="s1">'rt_score'</span><span class="p">]]</span><span class="o">.</span><span class="n">max</span><span class="p">()</span><span class="o">.</span><span class="n">max</span><span class="p">()</span> <span class="o">+</span> <span class="mf">0.2</span>
<span class="c1">#Define the hover over tooltips</span>
<span class="n">hover</span> <span class="o">=</span> <span class="n">HoverTool</span><span class="p">(</span>
<span class="n">tooltips</span><span class="o">=</span><span class="p">[(</span><span class="s2">"Title"</span><span class="p">,</span> <span class="s2">"@title"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Audience Score"</span><span class="p">,</span> <span class="s2">"@rt_audience_score</span><span class="si">{0.0}</span><span class="s2">"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Critic Score"</span><span class="p">,</span> <span class="s2">"@rt_score</span><span class="si">{0.0}</span><span class="s2">"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Genres"</span><span class="p">,</span> <span class="s2">"@Genre_str"</span><span class="p">)</span>
<span class="p">]</span>
<span class="p">)</span>
<span class="c1">#Make the figure</span>
<span class="n">p</span> <span class="o">=</span> <span class="n">figure</span><span class="p">(</span><span class="n">title</span> <span class="o">=</span> <span class="s2">"Movie critic and audience ratings"</span><span class="p">,</span>
<span class="n">x_range</span><span class="o">=</span><span class="n">Range1d</span><span class="p">(</span><span class="n">low</span><span class="p">,</span> <span class="n">high</span><span class="p">),</span>
<span class="n">y_range</span><span class="o">=</span><span class="n">Range1d</span><span class="p">(</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span>
<span class="n">tools</span><span class="o">=</span><span class="p">[</span><span class="n">hover</span><span class="p">])</span>
<span class="c1">#We'll put critic ratings on the x-axis and audience on the y-axis</span>
<span class="n">p</span><span class="o">.</span><span class="n">xaxis</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">axis_label</span> <span class="o">=</span> <span class="s1">'Critic Rating'</span>
<span class="n">p</span><span class="o">.</span><span class="n">yaxis</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">axis_label</span> <span class="o">=</span> <span class="s1">'Audience Rating'</span>
<span class="c1">#Add a diagonal line for where audience rating = critic rating</span>
<span class="n">p</span><span class="o">.</span><span class="n">line</span><span class="p">((</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span> <span class="p">(</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span><span class="n">line_color</span><span class="o">=</span><span class="s2">"red"</span><span class="p">,</span> <span class="n">line_width</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
<span class="c1">#Plot the points, coloring by Genre_1</span>
<span class="n">p</span><span class="o">.</span><span class="n">scatter</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s1">'rt_score'</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s1">'rt_audience_score'</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">mov_source</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s1">'colors'</span><span class="p">,</span>
<span class="n">size</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span> <span class="n">fill_alpha</span> <span class="o">=</span> <span class="mi">1</span><span class="p">)</span>
<span class="n">styleBokeh</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="n">show</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt"></div>
<div class="output_html rendered_html output_subarea">
<div class="bk-root">
<div class="bk-plotdiv" id="458481f2-c6c2-464a-8af3-c103c8a75b95"></div>
</div>
<script type="text/javascript">
(function(global) {
function now() {
return new Date();
}
var force = false;
if (typeof (window._bokeh_onload_callbacks) === "undefined" || force === true) {
window._bokeh_onload_callbacks = [];
window._bokeh_is_loading = undefined;
}
if (typeof (window._bokeh_timeout) === "undefined" || force === true) {
window._bokeh_timeout = Date.now() + 0;
window._bokeh_failed_load = false;
}
var NB_LOAD_WARNING = {'data': {'text/html':
"<div style='background-color: #fdd'>\n"+
"<p>\n"+
"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \n"+
"may be due to a slow or bad network connection. Possible fixes:\n"+
"</p>\n"+
"<ul>\n"+
"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\n"+
"<li>use INLINE resources instead, as so:</li>\n"+
"</ul>\n"+
"<code>\n"+
"from bokeh.resources import INLINE\n"+
"output_notebook(resources=INLINE)\n"+
"</code>\n"+
"</div>"}};
function display_loaded() {
if (window.Bokeh !== undefined) {
document.getElementById("458481f2-c6c2-464a-8af3-c103c8a75b95").textContent = "BokehJS successfully loaded.";
} else if (Date.now() < window._bokeh_timeout) {
setTimeout(display_loaded, 100)
}
}
function run_callbacks() {
window._bokeh_onload_callbacks.forEach(function(callback) { callback() });
delete window._bokeh_onload_callbacks
console.info("Bokeh: all callbacks have finished");
}
function load_libs(js_urls, callback) {
window._bokeh_onload_callbacks.push(callback);
if (window._bokeh_is_loading > 0) {
console.log("Bokeh: BokehJS is being loaded, scheduling callback at", now());
return null;
}
if (js_urls == null || js_urls.length === 0) {
run_callbacks();
return null;
}
console.log("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
window._bokeh_is_loading = js_urls.length;
for (var i = 0; i < js_urls.length; i++) {
var url = js_urls[i];
var s = document.createElement('script');
s.src = url;
s.async = false;
s.onreadystatechange = s.onload = function() {
window._bokeh_is_loading--;
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: all BokehJS libraries loaded");
run_callbacks()
}
};
s.onerror = function() {
console.warn("failed to load library " + url);
};
console.log("Bokeh: injecting script tag for BokehJS library: ", url);
document.getElementsByTagName("head")[0].appendChild(s);
}
};var element = document.getElementById("458481f2-c6c2-464a-8af3-c103c8a75b95");
if (element == null) {
console.log("Bokeh: ERROR: autoload.js configured with elementid '458481f2-c6c2-464a-8af3-c103c8a75b95' but no matching script tag was found. ")
return false;
}
var js_urls = [];
var inline_js = [
function(Bokeh) {
(function() {
var fn = function() {
var docs_json = {"cc2032ca-af09-4c38-9978-aa3c50177c5d":{"roots":{"references":[{"attributes":{"dimension":1,"plot":{"id":"0cafff65-fbae-4e6a-ae31-f95d52943a73","subtype":"Figure","type":"Plot"},"ticker":{"id":"67b9d79f-62ec-407a-ae54-544d7a854e93","type":"BasicTicker"}},"id":"589923e1-1951-46fe-b1eb-95598adf3d18","type":"Grid"},{"attributes":{},"id":"cc71ce1b-fbf1-43c8-8483-5b32f7ba7230","type":"ToolEvents"},{"attributes":{},"id":"e0623931-4906-4696-a347-e216c358622a","type":"BasicTicker"},{"attributes":{"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"line_width":{"value":5},"x":{"field":"x"},"y":{"field":"y"}},"id":"05e1a719-9903-48b2-9832-6526745a4889","type":"Line"},{"attributes":{"plot":null,"text":"Movie critic and audience ratings","text_font_size":{"value":"14pt"}},"id":"e5375509-10d6-437f-b056-62bc1dd78b61","type":"Title"},{"attributes":{"active_drag":"auto","active_scroll":"auto","active_tap":"auto","tools":[{"id":"724edae9-39c0-4e00-90ad-7d6d4530cfc0","type":"HoverTool"}]},"id":"e61ee07c-7b53-4be8-9c5f-74901c3517f2","type":"Toolbar"},{"attributes":{"line_alpha":{"value":0.5},"line_color":{"value":"red"},"line_width":{"value":5},"x":{"field":"x"},"y":{"field":"y"}},"id":"43adeefc-97aa-4d35-9a67-a3967c60eb52","type":"Line"},{"attributes":{"callback":null,"column_names":["y","x"],"data":{"x":[2.5,9.299999999999999],"y":[2.5,9.299999999999999]}},"id":"750d0396-50db-4eda-8dd0-238732a68533","type":"ColumnDataSource"},{"attributes":{"callback":null,"end":9.299999999999999,"start":2.5},"id":"df36ef66-2163-4a09-8278-cda200614580","type":"Range1d"},{"attributes":{},"id":"67b9d79f-62ec-407a-ae54-544d7a854e93","type":"BasicTicker"},{"attributes":{"callback":null,"column_names":["Genre_1","Genre_3","index","rt_audience_score","dif","rt_score","Genre_2","title","colors","Genre_str"],"data":{"Genre_1":["Sci-Fi","Sci-Fi","Sci-Fi","Sci-Fi","Family","Fantasy","Fantasy","Sci-Fi","Sci-Fi","Sci-Fi","Family","Thriller","Comedy","Thriller","Sci-Fi","Fantasy","Comedy","Fantasy","Adventure","Fantasy","Comedy","Comedy","Sci-Fi","Thriller","Fantasy","Sci-Fi","Thriller","Fantasy","Sci-Fi","Fantasy","Comedy","Thriller","Mystery","Animation","Thriller","Fantasy","Comedy","Comedy","Sci-Fi","Fantasy","Family","Fantasy","Family","Sci-Fi","Sci-Fi","Comedy","Family","Fantasy","Comedy","Sci-Fi","Thriller","Fantasy","Fantasy","Animation","Crime","Comedy","Fantasy","Sci-Fi","Comedy","Fantasy","Adventure","Sci-Fi","Animation","Animation","Romance","Adventure","Family","Drama","Family","War","Fantasy","Thriller","Mystery","Fantasy","Family","Comedy","Adventure","Comedy","Sci-Fi","Comedy","Thriller","Family","Animation","Thriller","Comedy","Fantasy","Fantasy","Thriller","Sci-Fi","Adventure","Comedy","Fantasy","Romance","Drama","Comedy","Crime","Fantasy","Fantasy","Thriller","Fantasy","Romance","Thriller","Comedy","Comedy","Adventure","Sci-Fi","Animation","Drama","Adventure","Crime","Fantasy","Comedy","Fantasy","Sci-Fi","History","Fantasy","Sci-Fi","Sci-Fi","Sci-Fi","Crime","Fantasy","Comedy","Fantasy","Sci-Fi","Romance","Thriller","Adventure","Fantasy","Fantasy","Thriller","Fantasy","Sci-Fi","Comedy","Thriller","Romance","Sci-Fi","Comedy","Fantasy","Fantasy","Drama","Family","Drama","Fantasy","Comedy","Thriller","Drama","Mystery","Romance","Sci-Fi","Romance","Comedy","Romance","Fantasy","Drama","Sci-Fi","Fantasy","Thriller","Crime","Comedy","Comedy","Sci-Fi","Sci-Fi","Fantasy","Thriller","Thriller","Family","War","Romance","Romance","Drama","Romance","Comedy","Sci-Fi","Romance","Sci-Fi","Music","Sci-Fi","Romance","Thriller","Family","Mystery","Sci-Fi","Romance","Thriller","Thriller","Family","Sci-Fi","Thriller","Drama","History","Fantasy","Fantasy","Thriller","Thriller","Fantasy","Drama","Mystery","Comedy","Sci-Fi","Drama","Comedy","Romance","Romance","Romance","Thriller","Fantasy","Drama","Fantasy","Thriller","Thriller","Romance","Thriller","Family","Drama","History","Romance","Thriller","Crime","Drama","Thriller","Comedy","Thriller","Action","Romance","Family","Thriller","Music","Music","Music","Fantasy","Thriller","Western","Family","Comedy","Thriller","Drama","Sci-Fi","Fantasy","Thriller","Romance","Western","Thriller","Romance","Family","Crime","Mystery","Romance","Comedy","Action","Sci-Fi","Adventure","War","Drama","Horror","Family","Adventure","Thriller","Romance","Fantasy","Comedy","Comedy","Fantasy","Romance","Romance","Thriller","Drama","Crime","Comedy","Crime","Crime","Thriller","War","Thriller","Romance","Thriller","Comedy","Thriller","Horror","Family","Adventure","Sci-Fi","Drama","Sport","War","Crime","Comedy","Comedy","Romance","Romance","Romance","Sci-Fi","Romance","Thriller","Sport","Comedy","Drama","Family","Comedy","Romance","Comedy","Romance","Fantasy","Horror","Action","Comedy","Comedy","Sci-Fi","Family","Sci-Fi","Romance","Drama","Thriller","Drama","Fantasy","Romance","Thriller","Drama","Comedy","Thriller","Crime","Romance","Family","Sci-Fi","Horror","Comedy","Sport","Drama","Musical","Romance","Romance","Sport","Thriller","Drama","Adventure","War","Sci-Fi","Comedy","Drama","Fantasy","Comedy","Comedy","Comedy","Music","War","Crime","Adventure","Crime","Romance","Crime","Romance","Sci-Fi","War","Drama","Crime","Sport","Sci-Fi","Horror","Comedy","Family","Horror","Comedy","Romance","Sport","Comedy","Thriller","Comedy","Mystery","Sci-Fi","War","War","Romance","Sci-Fi","Fantasy","Romance","Romance","Fantasy","Thriller","Romance","Thriller","Romance","Thriller","Horror","History","Sport","Crime","Thriller","Mystery","Drama","Musical","Romance","Western","Mystery","Thriller"],"Genre_2":["Adventure","Drama","Adventure","Adventure","Adventure","Adventure","Adventure","Adventure","Adventure","Adventure","Comedy","Crime","Animation","Sci-Fi","Adventure","Adventure","Animation","Adventure","Sci-Fi","Adventure","Animation","Adventure","Comedy","Adventure","Adventure","Adventure","Action","Adventure","Adventure","Drama","Animation","Crime","Fantasy","Adventure","Adventure","Adventure","NaN","Animation","Adventure","Family","Comedy","Family","Animation","Mystery","Adventure","Animation","Comedy","Drama","Animation","Adventure","Mystery","Adventure","Family","Adventure","Adventure","NaN","Drama","Adventure","Animation","Action","Action","Adventure","Adventure","Adventure","Musical","Action","Adventure","Crime","Animation","Fantasy","Family","Sci-Fi","Adventure","Adventure","Comedy","Animation","Action","Animation","Adventure","Animation","Adventure","Comedy","Adventure","Adventure","Adventure","Adventure","Adventure","Mystery","Adventure","Action","Adventure","Family","Comedy","Adventure","Animation","Comedy","Adventure","Family","Sci-Fi","Family","Comedy","Crime","Adventure","Animation","Action","Adventure","Adventure","NaN","NaN","Comedy","Drama","Animation","Adventure","Action","Drama","Adventure","Action","Action","Adventure","Adventure","Family","Animation","Comedy","Mystery","Comedy","Sci-Fi","Action","Adventure","Adventure","Drama","Family","Adventure","Animation","Crime","Drama","Adventure","Animation","Adventure","Adventure","Adventure","Animation","Action","Family","NaN","Adventure","Adventure","Horror","Fantasy","Adventure","Drama","Adventure","Drama","Adventure","Animation","Action","Adventure","Mystery","Adventure","Animation","Animation","Adventure","Drama","Family","Sci-Fi","Crime","Animation","Drama","Drama","Comedy","Adventure","Drama","NaN","Comedy","Comedy","Adventure","Drama","Adventure","Drama","Adventure","Comedy","Drama","Adventure","Drama","Adventure","Crime","Drama","Romance","Adventure","Adventure","Drama","Adventure","Family","Adventure","Adventure","Family","Animation","Drama","Animation","Adventure","Crime","NaN","Drama","Drama","Horror","Crime","Family","Animation","Crime","Comedy","Adventure","Drama","Sci-Fi","Drama","NaN","Drama","Drama","Mystery","Adventure","Crime","Drama","Animation","Mystery","NaN","Horror","Comedy","Crime","Comedy","Drama","Comedy","Family","Crime","Comedy","Comedy","NaN","History","Adventure","Action","Comedy","NaN","Comedy","Drama","Action","Fantasy","Comedy","Comedy","Drama","Comedy","Adventure","Sci-Fi","Comedy","Action","Drama","NaN","Fantasy","Comedy","Action","Crime","Comedy","Family","Adventure","NaN","Drama","Drama","Comedy","Action","NaN","Comedy","NaN","Comedy","Comedy","Drama","Drama","Crime","Drama","Comedy","NaN","Drama","Fantasy","Drama","Comedy","Adventure","Comedy","Romance","Drama","Comedy","Adventure","Adventure","Family","Drama","Comedy","NaN","Drama","Adventure","Drama","Adventure","NaN","Comedy","Adventure","Drama","Action","Music","Comedy","Comedy","Adventure","NaN","Adventure","Adventure","Drama","Action","Music","Comedy","Adventure","Crime","Adventure","Music","Action","Comedy","NaN","Sci-Fi","Comedy","Drama","Drama","Family","NaN","NaN","Drama","Adventure","Comedy","Comedy","Comedy","History","Adventure","NaN","Action","Comedy","Romance","Action","Comedy","Comedy","NaN","NaN","Action","Drama","Comedy","Comedy","Action","Comedy","Drama","Comedy","Comedy","Horror","Drama","NaN","Adventure","Drama","Mystery","Drama","NaN","Comedy","Drama","Action","Musical","Romance","Action","Horror","NaN","Comedy","Drama","Drama","History","Drama","Drama","Comedy","Music","Comedy","Adventure","Mystery","Drama","Adventure","Music","Drama","Fantasy","Drama","Drama","Comedy","Crime","Horror","Crime","Drama","Drama","Family","Crime","Sci-Fi"],"Genre_3":["Action","Action","Action","NaN","Action","Action","NaN","NaN","Action","Action","Animation","Action","Adventure","Western","Action","Action","Adventure","NaN","NaN","Action","Adventure","Animation","Action","Action","Action","Action","NaN","NaN","NaN","Adventure","Adventure","Action","Adventure","Action","Action","Action","NaN","Adventure","Action","Adventure","Animation","Adventure","Adventure","Action","Action","Adventure","Animation","Adventure","Adventure","Action","NaN","Action","Adventure","Action","Action","NaN","Adventure","Action","Adventure","NaN","NaN","Action","Action","Action","Comedy","NaN","Action","Action","Adventure","Action","Adventure","Drama","Action","Action","Animation","Adventure","NaN","Adventure","Action","Adventure","Action","Animation","Action","Action","Action","Action","Action","NaN","Action","NaN","Family","Adventure","NaN","Action","Adventure","Action","Action","Adventure","Adventure","Adventure","NaN","NaN","Animation","Adventure","NaN","Action","Action","NaN","NaN","Action","Comedy","Adventure","NaN","NaN","Action","Western","NaN","NaN","Action","Action","Adventure","Adventure","Action","Action","NaN","Drama","NaN","Action","NaN","Crime","Adventure","Action","Adventure","NaN","Action","Action","Adventure","NaN","Action","NaN","Adventure","NaN","Comedy","NaN","Action","Action","Drama","Comedy","Action","NaN","Action","Comedy","Action","Adventure","NaN","Action","Drama","Action","Adventure","Adventure","Action","Action","Comedy","Action","Action","Adventure","Action","Comedy","NaN","Action","Comedy","NaN","NaN","NaN","Action","Comedy","Action","NaN","Action","Adventure","Action","Action","Comedy","Action","NaN","Animation","Comedy","Action","Action","Adventure","Action","Comedy","Action","Action","Adventure","Adventure","Thriller","Adventure","Action","Action","NaN","NaN","Comedy","NaN","Action","Comedy","Adventure","Comedy","Action","Action","NaN","Adventure","Comedy","NaN","Biography","Comedy","Drama","Action","Action","NaN","Adventure","Drama","NaN","NaN","Adventure","Action","NaN","Action","NaN","Animation","NaN","NaN","Adventure","NaN","Drama","Action","NaN","NaN","NaN","Adventure","Adventure","NaN","Drama","NaN","Action","Crime","NaN","Action","Mystery","Adventure","NaN","Biography","NaN","Comedy","Adventure","NaN","Action","NaN","Animation","Action","NaN","Comedy","Comedy","NaN","NaN","NaN","NaN","NaN","Animation","Action","NaN","Comedy","Action","Comedy","NaN","NaN","Crime","Comedy","Comedy","Crime","Action","Animation","Comedy","NaN","NaN","Action","Action","Action","Action","Adventure","NaN","Biography","Action","NaN","NaN","NaN","Adventure","Action","Crime","NaN","Drama","NaN","NaN","Drama","NaN","Action","Action","Action","NaN","Drama","Western","Action","Comedy","Action","Drama","NaN","NaN","NaN","NaN","Action","NaN","Comedy","Western","NaN","NaN","NaN","Action","NaN","NaN","NaN","Drama","Action","NaN","NaN","NaN","Action","NaN","NaN","Adventure","NaN","NaN","NaN","Biography","NaN","Action","Fantasy","NaN","Adventure","Action","NaN","NaN","NaN","NaN","Action","Action","Adventure","NaN","NaN","Adventure","NaN","NaN","NaN","Comedy","NaN","NaN","NaN","Crime","Action","NaN","Drama","Comedy","NaN","NaN","Drama","Action","Action","Adventure","Comedy","Action","Drama","NaN","Adventure","Action","NaN","Action","Action","Drama","NaN","Comedy","NaN","Comedy","Comedy","Drama"],"Genre_str":["Sci-Fi Adventure Action","Sci-Fi Drama Action","Sci-Fi Adventure Action","Sci-Fi Adventure ","Family Adventure Action","Fantasy Adventure Action","Fantasy Adventure ","Sci-Fi Adventure ","Sci-Fi Adventure Action","Sci-Fi Adventure Action","Family Comedy Animation","Thriller Crime Action","Comedy Animation Adventure","Thriller Sci-Fi Western","Sci-Fi Adventure Action","Fantasy Adventure Action","Comedy Animation Adventure","Fantasy Adventure ","Adventure Sci-Fi ","Fantasy Adventure Action","Comedy Animation Adventure","Comedy Adventure Animation","Sci-Fi Comedy Action","Thriller Adventure Action","Fantasy Adventure Action","Sci-Fi Adventure Action","Thriller Action ","Fantasy Adventure ","Sci-Fi Adventure ","Fantasy Drama Adventure","Comedy Animation Adventure","Thriller Crime Action","Mystery Fantasy Adventure","Animation Adventure Action","Thriller Adventure Action","Fantasy Adventure Action","Comedy ","Comedy Animation Adventure","Sci-Fi Adventure Action","Fantasy Family Adventure","Family Comedy Animation","Fantasy Family Adventure","Family Animation Adventure","Sci-Fi Mystery Action","Sci-Fi Adventure Action","Comedy Animation Adventure","Family Comedy Animation","Fantasy Drama Adventure","Comedy Animation Adventure","Sci-Fi Adventure Action","Thriller Mystery ","Fantasy Adventure Action","Fantasy Family Adventure","Animation Adventure Action","Crime Adventure Action","Comedy ","Fantasy Drama Adventure","Sci-Fi Adventure Action","Comedy Animation Adventure","Fantasy Action ","Adventure Action ","Sci-Fi Adventure Action","Animation Adventure Action","Animation Adventure Action","Romance Musical Comedy","Adventure Action ","Family Adventure Action","Drama Crime Action","Family Animation Adventure","War Fantasy Action","Fantasy Family Adventure","Thriller Sci-Fi Drama","Mystery Adventure Action","Fantasy Adventure Action","Family Comedy Animation","Comedy Animation Adventure","Adventure Action ","Comedy Animation Adventure","Sci-Fi Adventure Action","Comedy Animation Adventure","Thriller Adventure Action","Family Comedy Animation","Animation Adventure Action","Thriller Adventure Action","Comedy Adventure Action","Fantasy Adventure Action","Fantasy Adventure Action","Thriller Mystery ","Sci-Fi Adventure Action","Adventure Action ","Comedy Adventure Family","Fantasy Family Adventure","Romance Comedy ","Drama Adventure Action","Comedy Animation Adventure","Crime Comedy Action","Fantasy Adventure Action","Fantasy Family Adventure","Thriller Sci-Fi Adventure","Fantasy Family Adventure","Romance Comedy ","Thriller Crime ","Comedy Adventure Animation","Comedy Animation Adventure","Adventure Action ","Sci-Fi Adventure Action","Animation Adventure Action","Drama ","Adventure ","Crime Comedy Action","Fantasy Drama Comedy","Comedy Animation Adventure","Fantasy Adventure ","Sci-Fi Action ","History Drama Action","Fantasy Adventure Western","Sci-Fi Action ","Sci-Fi Action ","Sci-Fi Adventure Action","Crime Adventure Action","Fantasy Family Adventure","Comedy Animation Adventure","Fantasy Comedy Action","Sci-Fi Mystery Action","Romance Comedy ","Thriller Sci-Fi Drama","Adventure Action ","Fantasy Adventure Action","Fantasy Adventure ","Thriller Drama Crime","Fantasy Family Adventure","Sci-Fi Adventure Action","Comedy Animation Adventure","Thriller Crime ","Romance Drama Action","Sci-Fi Adventure Action","Comedy Animation Adventure","Fantasy Adventure ","Fantasy Adventure Action","Drama Adventure ","Family Animation Adventure","Drama Action ","Fantasy Family Comedy","Comedy ","Thriller Adventure Action","Drama Adventure Action","Mystery Horror Drama","Romance Fantasy Comedy","Sci-Fi Adventure Action","Romance Drama ","Comedy Adventure Action","Romance Drama Comedy","Fantasy Adventure Action","Drama Animation Adventure","Sci-Fi Action ","Fantasy Adventure Action","Thriller Mystery Drama","Crime Adventure Action","Comedy Animation Adventure","Comedy Animation Adventure","Sci-Fi Adventure Action","Sci-Fi Drama Action","Fantasy Family Comedy","Thriller Sci-Fi Action","Thriller Crime Action","Family Animation Adventure","War Drama Action","Romance Drama Comedy","Romance Comedy ","Drama Adventure Action","Romance Drama Comedy","Comedy ","Sci-Fi Comedy ","Romance Comedy ","Sci-Fi Adventure Action","Music Drama Comedy","Sci-Fi Adventure Action","Romance Drama ","Thriller Adventure Action","Family Comedy Adventure","Mystery Drama Action","Sci-Fi Adventure Action","Romance Drama Comedy","Thriller Adventure Action","Thriller Crime ","Family Drama Animation","Sci-Fi Romance Comedy","Thriller Adventure Action","Drama Adventure Action","History Drama Adventure","Fantasy Adventure Action","Fantasy Family Comedy","Thriller Adventure Action","Thriller Adventure Action","Fantasy Family Adventure","Drama Animation Adventure","Mystery Drama Thriller","Comedy Animation Adventure","Sci-Fi Adventure Action","Drama Crime Action","Comedy ","Romance Drama ","Romance Drama Comedy","Romance Horror ","Thriller Crime Action","Fantasy Family Comedy","Drama Animation Adventure","Fantasy Crime Comedy","Thriller Comedy Action","Thriller Adventure Action","Romance Drama ","Thriller Sci-Fi Adventure","Family Drama Comedy","Drama ","History Drama Biography","Romance Drama Comedy","Thriller Mystery Drama","Crime Adventure Action","Drama Crime Action","Thriller Drama ","Comedy Animation Adventure","Thriller Mystery Drama","Action ","Romance Horror ","Family Comedy Adventure","Thriller Crime Action","Music Comedy ","Music Drama Action","Music Comedy ","Fantasy Family Animation","Thriller Crime ","Western Comedy ","Family Comedy Adventure","Comedy ","Thriller History Drama","Drama Adventure Action","Sci-Fi Action ","Fantasy Comedy ","Thriller ","Romance Comedy Adventure","Western Drama Adventure","Thriller Action ","Romance Fantasy Drama","Family Comedy ","Crime Comedy Action","Mystery Drama Crime","Romance Comedy ","Comedy Adventure Action","Action Sci-Fi Mystery","Sci-Fi Comedy Adventure","Adventure Action ","War Drama Biography","Drama ","Horror Fantasy Comedy","Family Comedy Adventure","Adventure Action ","Thriller Crime Action","Romance Comedy ","Fantasy Family Animation","Comedy Adventure Action","Comedy ","Fantasy Drama Comedy","Romance Drama Comedy","Romance Comedy ","Thriller Action ","Drama ","Crime Comedy ","Comedy ","Crime Comedy Animation","Crime Comedy Action","Thriller Drama ","War Drama Comedy","Thriller Crime Action","Romance Drama Comedy","Thriller Comedy ","Comedy ","Thriller Drama Crime","Horror Fantasy Comedy","Family Drama Comedy","Adventure Comedy Crime","Sci-Fi Adventure Action","Drama Comedy Animation","Sport Romance Comedy","War Drama ","Crime Comedy ","Comedy Adventure Action","Comedy Adventure Action","Romance Family Action","Romance Drama Action","Romance Comedy Adventure","Sci-Fi ","Romance Drama Biography","Thriller Adventure Action","Sport Drama ","Comedy Adventure ","Drama ","Family Comedy Adventure","Comedy Adventure Action","Romance Drama Crime","Comedy Action ","Romance Music Drama","Fantasy Comedy ","Horror Comedy ","Action Adventure Drama","Comedy ","Comedy Adventure Action","Sci-Fi Adventure Action","Family Drama Action","Sci-Fi Action ","Romance Music Drama","Drama Comedy Western","Thriller Adventure Action","Drama Crime Comedy","Fantasy Adventure Action","Romance Music Drama","Thriller Action ","Drama Comedy ","Comedy ","Thriller Sci-Fi ","Crime Comedy Action","Romance Drama ","Family Drama Comedy","Sci-Fi Family Western","Horror ","Comedy ","Sport Drama ","Drama Adventure Action","Musical Comedy ","Romance Comedy ","Romance Comedy ","Sport History Drama","Thriller Adventure Action","Drama ","Adventure Action ","War Comedy ","Sci-Fi Romance Action","Comedy Action ","Drama Comedy ","Fantasy Comedy Adventure","Comedy ","Comedy ","Comedy Action ","Music Drama Biography","War Comedy ","Crime Comedy Action","Adventure Action Fantasy","Crime Comedy ","Romance Drama Adventure","Crime Comedy Action","Romance Comedy ","Sci-Fi Horror ","War Drama ","Drama ","Crime Adventure Action","Sport Drama Action","Sci-Fi Mystery Adventure","Horror Drama ","Comedy ","Family Comedy Adventure","Horror Drama ","Comedy Action ","Romance Musical ","Sport Romance Comedy","Comedy Action ","Thriller Horror ","Comedy ","Mystery Comedy Crime","Sci-Fi Drama Action","War Drama ","War History Drama","Romance Drama Comedy","Sci-Fi Drama ","Fantasy Comedy ","Romance Music Drama","Romance Comedy Action","Fantasy Adventure Action","Thriller Mystery Adventure","Romance Drama Comedy","Thriller Adventure Action","Romance Music Drama","Thriller Drama ","Horror Fantasy Adventure","History Drama Action","Sport Drama ","Crime Comedy Action","Thriller Crime Action","Mystery Horror Drama","Drama Crime ","Musical Drama Comedy","Romance Drama ","Western Family Comedy","Mystery Crime Comedy","Thriller Sci-Fi Drama"],"colors":["#1f77b4","#1f77b4","#1f77b4","#1f77b4","#aec7e8","#ff7f0e","#ff7f0e","#1f77b4","#1f77b4","#1f77b4","#aec7e8","#ffbb78","#2ca02c","#ffbb78","#1f77b4","#ff7f0e","#2ca02c","#ff7f0e","#98df8a","#ff7f0e","#2ca02c","#2ca02c","#1f77b4","#ffbb78","#ff7f0e","#1f77b4","#ffbb78","#ff7f0e","#1f77b4","#ff7f0e","#2ca02c","#ffbb78","#d62728","#ff9896","#ffbb78","#ff7f0e","#2ca02c","#2ca02c","#1f77b4","#ff7f0e","#aec7e8","#ff7f0e","#aec7e8","#1f77b4","#1f77b4","#2ca02c","#aec7e8","#ff7f0e","#2ca02c","#1f77b4","#ffbb78","#ff7f0e","#ff7f0e","#ff9896","#9467bd","#2ca02c","#ff7f0e","#1f77b4","#2ca02c","#ff7f0e","#98df8a","#1f77b4","#ff9896","#ff9896","#c5b0d5","#98df8a","#aec7e8","#8c564b","#aec7e8","#c49c94","#ff7f0e","#ffbb78","#d62728","#ff7f0e","#aec7e8","#2ca02c","#98df8a","#2ca02c","#1f77b4","#2ca02c","#ffbb78","#aec7e8","#ff9896","#ffbb78","#2ca02c","#ff7f0e","#ff7f0e","#ffbb78","#1f77b4","#98df8a","#2ca02c","#ff7f0e","#c5b0d5","#8c564b","#2ca02c","#9467bd","#ff7f0e","#ff7f0e","#ffbb78","#ff7f0e","#c5b0d5","#ffbb78","#2ca02c","#2ca02c","#98df8a","#1f77b4","#ff9896","#8c564b","#98df8a","#9467bd","#ff7f0e","#2ca02c","#ff7f0e","#1f77b4","#e377c2","#ff7f0e","#1f77b4","#1f77b4","#1f77b4","#9467bd","#ff7f0e","#2ca02c","#ff7f0e","#1f77b4","#c5b0d5","#ffbb78","#98df8a","#ff7f0e","#ff7f0e","#ffbb78","#ff7f0e","#1f77b4","#2ca02c","#ffbb78","#c5b0d5","#1f77b4","#2ca02c","#ff7f0e","#ff7f0e","#8c564b","#aec7e8","#8c564b","#ff7f0e","#2ca02c","#ffbb78","#8c564b","#d62728","#c5b0d5","#1f77b4","#c5b0d5","#2ca02c","#c5b0d5","#ff7f0e","#8c564b","#1f77b4","#ff7f0e","#ffbb78","#9467bd","#2ca02c","#2ca02c","#1f77b4","#1f77b4","#ff7f0e","#ffbb78","#ffbb78","#aec7e8","#c49c94","#c5b0d5","#c5b0d5","#8c564b","#c5b0d5","#2ca02c","#1f77b4","#c5b0d5","#1f77b4","#f7b6d2","#1f77b4","#c5b0d5","#ffbb78","#aec7e8","#d62728","#1f77b4","#c5b0d5","#ffbb78","#ffbb78","#aec7e8","#1f77b4","#ffbb78","#8c564b","#e377c2","#ff7f0e","#ff7f0e","#ffbb78","#ffbb78","#ff7f0e","#8c564b","#d62728","#2ca02c","#1f77b4","#8c564b","#2ca02c","#c5b0d5","#c5b0d5","#c5b0d5","#ffbb78","#ff7f0e","#8c564b","#ff7f0e","#ffbb78","#ffbb78","#c5b0d5","#ffbb78","#aec7e8","#8c564b","#e377c2","#c5b0d5","#ffbb78","#9467bd","#8c564b","#ffbb78","#2ca02c","#ffbb78","#7f7f7f","#c5b0d5","#aec7e8","#ffbb78","#f7b6d2","#f7b6d2","#f7b6d2","#ff7f0e","#ffbb78","#c7c7c7","#aec7e8","#2ca02c","#ffbb78","#8c564b","#1f77b4","#ff7f0e","#ffbb78","#c5b0d5","#c7c7c7","#ffbb78","#c5b0d5","#aec7e8","#9467bd","#d62728","#c5b0d5","#2ca02c","#7f7f7f","#1f77b4","#98df8a","#c49c94","#8c564b","#bcbd22","#aec7e8","#98df8a","#ffbb78","#c5b0d5","#ff7f0e","#2ca02c","#2ca02c","#ff7f0e","#c5b0d5","#c5b0d5","#ffbb78","#8c564b","#9467bd","#2ca02c","#9467bd","#9467bd","#ffbb78","#c49c94","#ffbb78","#c5b0d5","#ffbb78","#2ca02c","#ffbb78","#bcbd22","#aec7e8","#98df8a","#1f77b4","#8c564b","#dbdb8d","#c49c94","#9467bd","#2ca02c","#2ca02c","#c5b0d5","#c5b0d5","#c5b0d5","#1f77b4","#c5b0d5","#ffbb78","#dbdb8d","#2ca02c","#8c564b","#aec7e8","#2ca02c","#c5b0d5","#2ca02c","#c5b0d5","#ff7f0e","#bcbd22","#7f7f7f","#2ca02c","#2ca02c","#1f77b4","#aec7e8","#1f77b4","#c5b0d5","#8c564b","#ffbb78","#8c564b","#ff7f0e","#c5b0d5","#ffbb78","#8c564b","#2ca02c","#ffbb78","#9467bd","#c5b0d5","#aec7e8","#1f77b4","#bcbd22","#2ca02c","#dbdb8d","#8c564b","#17becf","#c5b0d5","#c5b0d5","#dbdb8d","#ffbb78","#8c564b","#98df8a","#c49c94","#1f77b4","#2ca02c","#8c564b","#ff7f0e","#2ca02c","#2ca02c","#2ca02c","#f7b6d2","#c49c94","#9467bd","#98df8a","#9467bd","#c5b0d5","#9467bd","#c5b0d5","#1f77b4","#c49c94","#8c564b","#9467bd","#dbdb8d","#1f77b4","#bcbd22","#2ca02c","#aec7e8","#bcbd22","#2ca02c","#c5b0d5","#dbdb8d","#2ca02c","#ffbb78","#2ca02c","#d62728","#1f77b4","#c49c94","#c49c94","#c5b0d5","#1f77b4","#ff7f0e","#c5b0d5","#c5b0d5","#ff7f0e","#ffbb78","#c5b0d5","#ffbb78","#c5b0d5","#ffbb78","#bcbd22","#e377c2","#dbdb8d","#9467bd","#ffbb78","#d62728","#8c564b","#17becf","#c5b0d5","#c7c7c7","#d62728","#ffbb78"],"dif":[1.0999999999999996,0.5,1.1000000000000005,1.4000000000000004,1.8999999999999995,1.5,1.5,1.2999999999999998,2.6999999999999997,1.0,1.8000000000000007,2.2,0.8999999999999995,-1.0,1.0,1.5999999999999996,1.2000000000000002,1.3999999999999995,1.0999999999999996,1.5999999999999996,2.1000000000000005,0.7999999999999998,1.5,0.0,1.0999999999999996,0.8000000000000007,0.5999999999999996,1.5999999999999996,0.9999999999999991,2.3999999999999995,1.0999999999999996,1.5999999999999996,0.29999999999999893,0.6999999999999993,0.09999999999999964,1.9000000000000004,1.7999999999999998,2.2,2.0999999999999996,1.2999999999999998,1.2000000000000002,1.0999999999999996,0.5,0.40000000000000036,0.9000000000000004,1.0999999999999996,0.6999999999999993,1.7999999999999998,-0.3000000000000007,1.4000000000000004,1.7000000000000002,0.7999999999999989,0.39999999999999947,1.7999999999999998,1.2000000000000002,1.2000000000000002,2.5,3.1,-1.0999999999999996,1.7999999999999998,-0.3000000000000007,0.8000000000000007,0.5999999999999996,1.2999999999999998,1.7000000000000002,0.7000000000000002,1.1000000000000005,0.20000000000000107,-0.09999999999999964,2.0999999999999996,0.8999999999999995,0.7999999999999998,2.4000000000000004,2.0999999999999996,-0.7000000000000002,1.3999999999999995,0.39999999999999947,-0.1999999999999993,2.3999999999999995,0.5,0.0,0.2999999999999998,1.1000000000000005,0.0,1.7000000000000002,1.7999999999999998,-0.40000000000000036,1.6000000000000005,1.2999999999999998,0.09999999999999964,-1.2000000000000002,-0.7000000000000002,0.5,-2.1000000000000005,0.7000000000000002,0.7999999999999998,-1.0,-0.7000000000000002,-1.2000000000000002,-0.3000000000000007,1.7999999999999998,0.6999999999999993,1.2000000000000002,-0.7000000000000002,-1.3000000000000007,1.1000000000000005,-1.5000000000000009,1.5,1.0,3.1000000000000005,1.0,-1.0,0.7000000000000002,-0.39999999999999947,1.0,-1.299999999999999,0.0,1.5,0.0,0.10000000000000053,0.20000000000000018,0.40000000000000036,1.0,-1.2999999999999998,-0.2999999999999998,-0.39999999999999947,-1.0,0.0,-0.3000000000000007,1.7000000000000002,0.3000000000000007,0.7999999999999998,-0.40000000000000036,0.2999999999999998,2.0,-0.09999999999999964,0.09999999999999964,0.0,1.3999999999999995,-0.40000000000000036,-0.20000000000000018,0.39999999999999947,0.8000000000000007,0.2999999999999998,0.0,0.9000000000000004,0.7000000000000002,0.5,0.40000000000000036,-0.5999999999999996,0.5999999999999996,-0.5,0.7999999999999998,-1.1999999999999993,-0.39999999999999947,1.0999999999999996,0.0,0.2999999999999998,-1.5999999999999996,-1.3000000000000007,1.7999999999999998,0.0,0.2999999999999998,1.0,0.7999999999999998,-0.7000000000000002,-0.5999999999999996,-1.5000000000000009,-0.40000000000000036,-0.5999999999999996,-0.20000000000000018,-0.10000000000000053,-0.5,0.1999999999999993,1.1000000000000005,-1.0,0.8000000000000007,-1.4000000000000004,0.20000000000000018,0.5,0.6999999999999993,0.7000000000000002,-0.8000000000000007,0.6999999999999993,-0.39999999999999947,-0.8999999999999995,-0.10000000000000053,0.6000000000000005,0.40000000000000036,-0.8999999999999995,0.5999999999999996,1.2000000000000002,1.5,-0.10000000000000053,0.8000000000000007,0.40000000000000036,0.5999999999999996,-1.5999999999999996,0.0,-0.10000000000000053,0.6999999999999993,0.9999999999999991,-1.1999999999999993,1.5,-1.3000000000000007,1.2999999999999998,-0.1999999999999993,0.0,-0.1999999999999993,-0.6000000000000005,1.2000000000000002,-1.1000000000000005,1.0,0.8000000000000007,-0.40000000000000036,0.09999999999999964,0.20000000000000018,-0.7000000000000002,0.9000000000000004,0.20000000000000018,-0.6999999999999993,0.2999999999999998,-0.10000000000000053,0.7000000000000002,2.4,0.9000000000000004,0.5,1.2000000000000002,0.0,-1.0,-0.09999999999999964,-0.7999999999999998,2.1999999999999993,-0.5,-0.10000000000000053,1.0999999999999996,-0.9000000000000004,0.8000000000000007,-0.3000000000000007,0.2999999999999998,-0.2999999999999998,0.9000000000000004,0.20000000000000018,1.5,0.9000000000000004,-0.6000000000000005,1.2999999999999998,1.7999999999999998,-0.7000000000000002,0.9000000000000004,0.40000000000000036,-0.6000000000000005,0.39999999999999947,1.2000000000000002,-0.40000000000000036,0.09999999999999964,0.0,0.7999999999999998,-0.8999999999999995,1.9000000000000004,0.0,-0.9000000000000004,2.2,1.0,-0.6000000000000005,-0.3000000000000007,-0.7000000000000002,0.6000000000000005,-1.4000000000000004,1.2999999999999998,-0.10000000000000053,-0.40000000000000036,0.10000000000000053,-1.0,-0.7000000000000002,0.5999999999999996,0.39999999999999947,0.20000000000000018,-0.10000000000000053,-0.7000000000000002,-1.4000000000000004,0.2999999999999998,-1.0,-0.2999999999999998,-0.5999999999999996,0.09999999999999964,1.9,1.0999999999999996,1.2000000000000002,-1.0,0.0,0.9000000000000004,2.1000000000000005,2.0,1.7999999999999998,0.8999999999999995,1.5,1.2000000000000002,-1.0999999999999996,-0.2999999999999998,0.8999999999999995,-0.9999999999999991,-0.5,0.39999999999999947,1.9000000000000004,-0.8999999999999995,0.1999999999999993,-0.3000000000000007,-1.4999999999999991,1.5,-0.09999999999999964,1.0,-1.0999999999999996,1.2000000000000002,2.7,0.8000000000000007,-0.09999999999999964,-0.20000000000000018,-1.0,-0.8999999999999995,-0.40000000000000036,1.2000000000000002,-2.0999999999999996,-0.40000000000000036,1.6000000000000005,1.1999999999999993,-0.3000000000000007,1.3000000000000007,-0.9000000000000004,-0.6000000000000005,-0.5,0.2999999999999998,-0.1999999999999993,-1.0999999999999996,0.40000000000000036,-1.0999999999999996,2.0,0.9000000000000004,-0.9000000000000004,-0.39999999999999947,-1.1000000000000005,1.2999999999999998,-1.1000000000000005,-0.7999999999999998,1.5999999999999996,-0.5,0.7000000000000002,3.0999999999999996,0.3000000000000007,-0.6000000000000005,-1.1000000000000005,-0.7000000000000011,-0.39999999999999947,0.2999999999999998,0.39999999999999947,0.5,2.1999999999999993,0.6000000000000005,-0.7999999999999998,-1.3999999999999995,1.7000000000000002,0.8000000000000007,-0.5,0.9000000000000004,0.2999999999999998,-0.2999999999999998,0.0,-1.0,-0.40000000000000036,0.6000000000000005,-1.1000000000000005,-1.4000000000000004,0.3000000000000007,-1.0999999999999996,0.5,-0.10000000000000142,1.0999999999999996,1.0999999999999996,0.0,1.7000000000000002,-1.2999999999999998,0.8999999999999995,1.2999999999999998,-1.9000000000000004,0.2999999999999998,0.5,-0.09999999999999964,-0.5,1.8000000000000007,0.20000000000000018,0.20000000000000018,0.09999999999999964,-0.39999999999999947],"index":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,383,384,385,386,387,388,391,392,393,394,396,398],"rt_audience_score":[8.6,8.4,8.8,8.4,7.6,7.4,7.8,7.6,6.6,8.6,8.4,8.4,8.6,8.0,8.0,7.8,8.0,8.2,8.6,7.8,7.2,7.6,7.6,8.2,7.8,8.8,8.6,8.2,8.2,7.6,6.6,8.0,8.6,7.6,7.8,7.0,6.8,6.2,7.0,7.0,8.0,8.2,8.4,8.4,7.4,7.0,8.2,7.2,8.6,6.4,6.8,8.2,7.6,7.2,7.4,8.0,7.2,7.0,7.6,7.2,6.6,8.4,7.8,7.2,7.2,6.8,7.4,8.8,8.4,8.2,7.8,7.2,7.2,7.6,7.8,6.8,6.6,7.4,8.2,7.4,7.8,7.2,7.2,6.6,7.0,7.8,6.6,6.4,7.2,7.8,6.0,6.8,6.8,5.6,6.8,6.8,6.2,6.2,5.8,7.6,7.0,6.6,6.4,7.0,7.0,6.4,6.8,7.4,7.0,7.2,6.6,7.6,7.8,6.2,7.4,7.4,6.8,6.8,7.4,6.2,7.4,7.2,6.2,6.8,6.4,6.4,6.6,6.6,8.2,6.8,7.4,6.0,7.6,7.2,6.6,5.4,7.8,8.2,6.6,7.0,6.0,7.6,6.4,7.2,6.0,6.4,6.2,6.2,7.4,7.6,6.6,6.6,6.6,6.4,7.2,6.8,7.6,6.0,7.0,6.6,7.0,5.8,5.6,5.0,6.6,6.8,8.0,6.8,6.6,6.4,7.0,6.8,7.0,6.6,7.4,6.6,6.4,6.6,6.2,5.8,5.6,7.0,6.6,6.6,6.2,6.2,5.8,7.2,6.4,7.2,5.8,6.0,7.2,6.8,6.4,6.4,8.2,7.4,5.2,6.8,6.6,8.2,6.4,7.4,6.6,5.0,8.0,6.4,6.4,5.6,5.8,7.2,6.8,7.4,8.6,6.6,6.4,7.2,6.4,7.2,7.4,6.2,6.6,7.2,6.0,6.4,6.2,6.0,6.8,7.4,7.0,6.2,6.6,6.0,7.6,6.8,7.4,6.4,8.2,6.8,7.2,7.0,7.0,6.6,6.0,6.8,7.0,6.6,6.6,7.0,7.0,6.8,7.6,6.4,5.8,8.0,6.6,5.8,7.2,5.4,7.0,7.0,6.0,6.8,7.8,7.6,6.6,5.4,7.0,6.2,6.6,7.0,7.2,6.8,5.8,6.0,7.8,6.4,5.8,6.0,7.6,6.6,6.0,7.8,6.4,7.0,5.8,6.0,7.0,7.6,6.2,7.4,6.2,6.8,6.2,7.8,7.6,6.0,7.0,6.8,6.6,7.2,6.8,7.6,6.4,6.4,6.6,6.6,7.2,6.2,6.0,6.2,6.4,8.0,5.4,6.4,7.4,7.0,6.6,6.4,7.0,6.2,7.0,6.8,6.2,6.6,7.6,6.4,6.8,6.6,7.2,6.6,7.4,8.0,7.0,6.4,6.2,7.0,7.0,6.4,7.2,6.2,7.2,6.0,5.6,8.2,6.8,5.8,7.4,5.8,7.8,8.2,7.4,6.0,6.8,6.2,6.6,7.2,7.0,7.2,6.2,7.4,6.6,6.2,5.6,7.4,6.6,7.0,8.2,7.4,7.8,7.4,6.4,6.4,6.8,8.2,5.8,7.6,6.8,7.0,7.8,5.6,7.2,6.4,6.8,6.8,7.0,8.0,6.4,6.4,6.4,6.8,6.4],"rt_score":[7.5,7.9,7.7,7.0,5.7,5.9,6.3,6.3,3.9,7.6,6.6,6.2,7.7,9.0,7.0,6.2,6.8,6.8,7.5,6.2,5.1,6.8,6.1,8.2,6.7,8.0,8.0,6.6,7.2,5.2,5.5,6.4,8.3,6.9,7.7,5.1,5.0,4.0,4.9,5.7,6.8,7.1,7.9,8.0,6.5,5.9,7.5,5.4,8.9,5.0,5.1,7.4,7.2,5.4,6.2,6.8,4.7,3.9,8.7,5.4,6.9,7.6,7.2,5.9,5.5,6.1,6.3,8.6,8.5,6.1,6.9,6.4,4.8,5.5,8.5,5.4,6.2,7.6,5.8,6.9,7.8,6.9,6.1,6.6,5.3,6.0,7.0,4.8,5.9,7.7,7.2,7.5,6.3,7.7,6.1,6.0,7.2,6.9,7.0,7.9,5.2,5.9,5.2,7.7,8.3,5.3,8.3,5.9,6.0,4.1,5.6,8.6,7.1,6.6,6.4,8.7,6.8,5.3,7.4,6.1,7.2,6.8,5.2,8.1,6.7,6.8,7.6,6.6,8.5,5.1,7.1,5.2,8.0,6.9,4.6,5.5,7.7,8.2,5.2,7.4,6.2,7.2,5.6,6.9,6.0,5.5,5.5,5.7,7.0,8.2,6.0,7.1,5.8,7.6,7.6,5.7,7.6,5.7,8.6,7.9,5.2,5.8,5.3,4.0,5.8,7.5,8.6,8.3,7.0,7.0,7.2,6.9,7.5,6.4,6.3,7.6,5.6,8.0,6.0,5.3,4.9,6.3,7.4,5.9,6.6,7.1,5.9,6.6,6.0,8.1,5.2,4.8,5.7,6.9,5.6,6.0,7.6,9.0,5.2,6.9,5.9,7.2,7.6,5.9,7.9,3.7,8.2,6.4,6.6,6.2,4.6,8.3,5.8,6.6,9.0,6.5,6.2,7.9,5.5,7.0,8.1,5.9,6.7,6.5,3.6,5.5,5.7,4.8,6.8,8.4,7.1,7.0,4.4,6.5,7.7,5.7,8.3,5.6,8.5,6.5,7.5,6.1,6.8,5.1,5.1,7.4,5.7,4.8,7.3,6.1,6.6,7.4,7.2,5.2,6.2,7.9,6.6,5.0,8.1,3.5,7.0,7.9,3.8,5.8,8.4,7.9,7.3,4.8,8.4,4.9,6.7,7.4,7.1,7.8,6.5,5.4,7.4,6.2,5.9,6.7,9.0,6.3,7.0,8.1,7.0,6.9,3.9,4.9,5.8,8.6,6.2,6.5,4.1,4.8,4.4,6.9,6.1,4.8,8.1,7.1,5.7,8.2,7.3,7.2,4.5,7.3,6.4,6.9,8.7,4.7,6.1,5.2,7.5,6.8,2.7,5.6,7.5,7.2,7.6,7.3,7.4,5.0,9.1,7.2,4.6,5.4,7.9,5.1,7.7,7.2,7.7,6.3,7.6,9.1,6.6,7.5,4.2,6.1,7.9,6.8,8.3,4.9,8.3,6.8,4.0,8.7,6.1,2.7,7.1,6.4,8.9,8.9,7.8,5.7,6.4,5.7,4.4,6.6,7.8,8.6,4.5,6.6,7.1,5.3,5.3,7.7,6.6,8.0,8.6,6.8,8.9,8.8,6.1,7.5,6.3,8.3,4.7,6.5,6.8,5.3,9.1,4.7,5.9,8.3,6.5,6.3,7.1,8.5,4.6,6.2,6.2,6.7,6.8],"title":["Captain America: The Winter Soldier","Dawn of the Planet of the Apes","Guardians of the Galaxy","Interstellar","Maleficent","The Amazing Spider-Man 2","The Hobbit: The Battle of the Five Armies","The Hunger Games: Mockingjay - Part 1","Transformers: Age of Extinction","X-Men: Days of Future Past","Despicable Me 2","Fast & Furious 6","Frozen","Gravity","Iron Man 3","Man of Steel","Monsters University","The Hobbit: The Desolation of Smaug","The Hunger Games: Catching Fire","Thor: The Dark World","Ice Age: Continental Drift","Madagascar 3: Europe's Most Wanted","Men in Black 3","Skyfall","The Amazing Spider-Man","The Avengers","The Dark Knight Rises","The Hobbit: An Unexpected Journey","The Hunger Games","The Twilight Saga: Breaking Dawn - Part 2","Cars 2","Fast Five","Harry Potter and the Deathly Hallows - Part 2","Kung Fu Panda 2","Mission: Impossible - Ghost Protocol","Pirates of the Caribbean: On Stranger Tides","The Hangover Part II","The Smurfs","Transformers: Dark of the Moon","Alice in Wonderland","Despicable Me","Harry Potter and the Deathly Hallows - Part 1","How to Train Your Dragon","Inception","Iron Man 2","Shrek Forever After","Tangled","The Twilight Saga: Eclipse","Toy Story 3","2012","Angels & Demons","Avatar","Harry Potter and the Half-Blood Prince","Ice Age: Dawn of the Dinosaurs","Sherlock Holmes","The Hangover","The Twilight Saga: New Moon","Transformers: Revenge of the Fallen","Up","Hancock","Indiana Jones and the Kingdom of the Crystal Skull","Iron Man","Kung Fu Panda","Madagascar: Escape 2 Africa","Mamma Mia!","Quantum of Solace","The Chronicles of Narnia: Prince Caspian","The Dark Knight","WALL-E","300","Harry Potter and the Order of the Phoenix","I Am Legend","National Treasure: Book of Secrets","Pirates of the Caribbean: At World's End","Ratatouille","Shrek the Third","Spider-Man 3","The Simpsons Movie","Transformers","Cars","Casino Royale","Happy Feet","Ice Age: The Meltdown","Mission: Impossible III","Night at the Museum","Pirates of the Caribbean: Dead Man's Chest","Superman Returns","The Da Vinci Code","X-Men: The Last Stand","Batman Begins","Charlie and the Chocolate Factory","Harry Potter and the Goblet of Fire","Hitch","King Kong","Madagascar","Mr. & Mrs. Smith","Star Wars Episode III: Revenge of the Sith","The Chronicles of Narnia: The Lion, the Witch and the Wardrobe","War of the Worlds","Harry Potter and the Prisoner of Azkaban","Meet the Fockers","Ocean's Twelve","Shark Tale","Shrek 2","Spider-Man 2","The Day After Tomorrow","The Incredibles","The Passion of the Christ","Troy","Bad Boys II","Bruce Almighty","Finding Nemo","Pirates of the Caribbean: The Curse of the Black Pearl","Terminator 3: Rise of the Machines","The Last Samurai","The Lord of the Rings: The Return of the King","The Matrix Reloaded","The Matrix Revolutions","X2","Die Another Day","Harry Potter and the Chamber of Secrets","Ice Age","Men in Black II","Minority Report","My Big Fat Greek Wedding","Signs","Spider-Man","Star Wars Episode II: Attack of the Clones","The Lord of the Rings: The Two Towers","Hannibal","Harry Potter and the Sorcerer's Stone","Jurassic Park III","Monsters, Inc.","Ocean's Eleven","Pearl Harbor","Planet of the Apes","Shrek","The Lord of the Rings: The Fellowship of the Ring","The Mummy Returns","Cast Away","Dinosaur","Gladiator","How the Grinch Stole Christmas","Meet the Parents","Mission: Impossible II","The Perfect Storm","What Lies Beneath","What Women Want","X-Men","American Beauty","Austin Powers: The Spy Who Shagged Me","Notting Hill","Star Wars Episode I: The Phantom Menace","Tarzan","The Matrix","The Mummy","The Sixth Sense","The World Is Not Enough","Toy Story 2","A Bug's Life","Armageddon","Deep Impact","Dr. Dolittle","Godzilla","Lethal Weapon 4","Mulan","Saving Private Ryan","Shakespeare in Love","There's Something About Mary","Air Force One","As Good as It Gets","Liar Liar","Men in Black","My Best Friend's Wedding","The Fifth Element","The Full Monty","The Lost World: Jurassic Park","Titanic","Tomorrow Never Dies","101 Dalmatians","Eraser","Independence Day","Jerry Maguire","Mission: Impossible","Ransom","The Hunchback of Notre Dame","The Nutty Professor","The Rock","Twister","Apollo 13","Batman Forever","Casper","Die Hard with a Vengeance","GoldenEye","Jumanji","Pocahontas","Seven","Toy Story","Waterworld","Clear and Present Danger","Dumb and Dumber","Forrest Gump","Four Weddings and a Funeral","Interview with the Vampire: The Vampire Chronicles","Speed","The Flintstones","The Lion King","The Mask","True Lies","Cliffhanger","Indecent Proposal","Jurassic Park","Mrs. Doubtfire","Philadelphia","Schindler's List","Sleepless in Seattle","The Firm","The Fugitive","The Pelican Brief","A Few Good Men","Aladdin","Basic Instinct","Batman Returns","Bram Stoker's Dracula","Home Alone 2: Lost in New York","Lethal Weapon 3","Sister Act","The Bodyguard","Wayne's World","Beauty and the Beast","Cape Fear","City Slickers","Hook","Hot Shots!","JFK","Robin Hood: Prince of Thieves","Terminator 2: Judgment Day","The Addams Family","The Silence of the Lambs","Back to the Future Part III","Dances with Wolves","Die Hard 2","Ghost","Home Alone","Kindergarten Cop","Presumed Innocent","Pretty Woman","Teenage Mutant Ninja Turtles","Total Recall","Back to the Future Part II","Batman","Born on the Fourth of July","Dead Poets Society","Ghostbusters II","Honey, I Shrunk the Kids","Indiana Jones and the Last Crusade","Lethal Weapon 2","Look Who's Talking","The Little Mermaid","\"Crocodile\" Dundee II","Beetlejuice","Big","Cocktail","Coming to America","Die Hard","Rain Man","The Naked Gun: From the Files of Police Squad!","Twins","Who Framed Roger Rabbit","Beverly Hills Cop II","Fatal Attraction","Good Morning, Vietnam","Lethal Weapon","Moonstruck","Stakeout","The Secret of My Success","The Untouchables","The Witches of Eastwick","Three Men and a Baby","\"Crocodile\" Dundee","Aliens","An American Tail","Back to School","Platoon","Ruthless People","Star Trek IV: The Voyage Home","The Golden Child","The Karate Kid, Part II","Top Gun","Back to the Future","Cocoon","Out Of Africa","Rambo: First Blood Part II","Rocky IV","Spies Like Us","The Color Purple","The Goonies","The Jewel of the Nile","Witness","Beverly Hills Cop","Footloose","Ghostbusters","Gremlins","Indiana Jones and the Temple of Doom","Police Academy","Romancing the Stone","Star Trek III: The Search for Spock","The Karate Kid","The Terminator","Flashdance","Mr. Mom","Octopussy","Risky Business","Star Wars Episode VI: Return of the Jedi","Staying Alive","Sudden Impact","Terms of Endearment","Trading Places","WarGames","48 Hrs.","An Officer and a Gentleman","Annie","E.T. the Extra-Terrestrial","Poltergeist","Porky's","Rocky III","Star Trek II: The Wrath of Khan","The Best Little Whorehouse in Texas","Tootsie","Arthur","Chariots of Fire","For Your Eyes Only","On Golden Pond","Raiders of the Lost Ark","Stripes","Superman II","The Cannonball Run","The Four Seasons","Time Bandits","9 to 5","Airplane!","Any Which Way You Can","Coal Miner's Daughter","Private Benjamin","Smokey and the Bandit II","Star Wars Episode V: The Empire Strikes Back","Stir Crazy","The Blue Lagoon","The Blues Brothers","10","Alien","Apocalypse Now","Kramer vs. Kramer","Moonraker","Rocky II","Star Trek: The Motion Picture","The Amityville Horror","The Jerk","The Muppet Movie","Dawn of the Dead","Every Which Way but Loose","Grease","Heaven Can Wait","Hooper","Jaws 2","National Lampoon's Animal House","Revenge of the Pink Panther","Superman","The Deer Hunter","A Bridge Too Far","Annie Hall","Close Encounters of the Third Kind","Oh, God!","Saturday Night Fever","Smokey and the Bandit","Star Wars","The Deep","The Goodbye Girl","The Spy Who Loved Me","A Star Is Born","All the President's Men","King Kong","Midway","Rocky","Silver Streak","The Enforcer","The Omen","Dog Day Afternoon","Funny Lady","Shampoo","The Apple Dumpling Gang","The Return of the Pink Panther","Signs"]}},"id":"c63751e2-2cd1-4f08-bbc0-c98c190dbde6","type":"ColumnDataSource"},{"attributes":{"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"size":{"units":"screen","value":8},"x":{"field":"rt_score"},"y":{"field":"rt_audience_score"}},"id":"cb074810-f511-44f8-a1a7-2d216041a97d","type":"Circle"},{"attributes":{"data_source":{"id":"750d0396-50db-4eda-8dd0-238732a68533","type":"ColumnDataSource"},"glyph":{"id":"43adeefc-97aa-4d35-9a67-a3967c60eb52","type":"Line"},"hover_glyph":null,"nonselection_glyph":{"id":"05e1a719-9903-48b2-9832-6526745a4889","type":"Line"},"selection_glyph":null},"id":"efc71a9c-b04e-4f6d-aac6-ce6403605177","type":"GlyphRenderer"},{"attributes":{},"id":"fc3886ed-669f-4442-90b9-db31f5b44861","type":"BasicTickFormatter"},{"attributes":{"below":[{"id":"276b9ea7-d3d8-4ee4-b224-f4e688e191e5","type":"LinearAxis"}],"left":[{"id":"bd9f8276-5675-440f-bdd8-aa1db6a785f5","type":"LinearAxis"}],"renderers":[{"id":"276b9ea7-d3d8-4ee4-b224-f4e688e191e5","type":"LinearAxis"},{"id":"c3beecee-7e65-4cc9-98ac-af74025c5a15","type":"Grid"},{"id":"bd9f8276-5675-440f-bdd8-aa1db6a785f5","type":"LinearAxis"},{"id":"589923e1-1951-46fe-b1eb-95598adf3d18","type":"Grid"},{"id":"efc71a9c-b04e-4f6d-aac6-ce6403605177","type":"GlyphRenderer"},{"id":"5f2bd142-ab9b-40a2-a80a-c0bcea3d7ba1","type":"GlyphRenderer"}],"title":{"id":"e5375509-10d6-437f-b056-62bc1dd78b61","type":"Title"},"tool_events":{"id":"cc71ce1b-fbf1-43c8-8483-5b32f7ba7230","type":"ToolEvents"},"toolbar":{"id":"e61ee07c-7b53-4be8-9c5f-74901c3517f2","type":"Toolbar"},"toolbar_location":null,"x_range":{"id":"df36ef66-2163-4a09-8278-cda200614580","type":"Range1d"},"y_range":{"id":"c7383f2d-7b3d-4b20-b754-e9ab3f74a1bc","type":"Range1d"}},"id":"0cafff65-fbae-4e6a-ae31-f95d52943a73","subtype":"Figure","type":"Plot"},{"attributes":{"data_source":{"id":"c63751e2-2cd1-4f08-bbc0-c98c190dbde6","type":"ColumnDataSource"},"glyph":{"id":"7c81bb6c-f37b-485d-b21b-cc7d3ed92ad5","type":"Circle"},"hover_glyph":null,"nonselection_glyph":{"id":"cb074810-f511-44f8-a1a7-2d216041a97d","type":"Circle"},"selection_glyph":null},"id":"5f2bd142-ab9b-40a2-a80a-c0bcea3d7ba1","type":"GlyphRenderer"},{"attributes":{"callback":null,"plot":{"id":"0cafff65-fbae-4e6a-ae31-f95d52943a73","subtype":"Figure","type":"Plot"},"tooltips":[["Title","@title"],["Audience Score","@rt_audience_score{0.0}"],["Critic Score","@rt_score{0.0}"],["Genres","@Genre_str"]]},"id":"724edae9-39c0-4e00-90ad-7d6d4530cfc0","type":"HoverTool"},{"attributes":{"axis_label":"Critic Rating","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"08be78f3-c1b5-4fbc-84a2-869ebf604e3f","type":"BasicTickFormatter"},"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"0cafff65-fbae-4e6a-ae31-f95d52943a73","subtype":"Figure","type":"Plot"},"ticker":{"id":"e0623931-4906-4696-a347-e216c358622a","type":"BasicTicker"}},"id":"276b9ea7-d3d8-4ee4-b224-f4e688e191e5","type":"LinearAxis"},{"attributes":{"callback":null,"end":9.299999999999999,"start":2.5},"id":"c7383f2d-7b3d-4b20-b754-e9ab3f74a1bc","type":"Range1d"},{"attributes":{"axis_label":"Audience Rating","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"fc3886ed-669f-4442-90b9-db31f5b44861","type":"BasicTickFormatter"},"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"0cafff65-fbae-4e6a-ae31-f95d52943a73","subtype":"Figure","type":"Plot"},"ticker":{"id":"67b9d79f-62ec-407a-ae54-544d7a854e93","type":"BasicTicker"}},"id":"bd9f8276-5675-440f-bdd8-aa1db6a785f5","type":"LinearAxis"},{"attributes":{},"id":"08be78f3-c1b5-4fbc-84a2-869ebf604e3f","type":"BasicTickFormatter"},{"attributes":{"plot":{"id":"0cafff65-fbae-4e6a-ae31-f95d52943a73","subtype":"Figure","type":"Plot"},"ticker":{"id":"e0623931-4906-4696-a347-e216c358622a","type":"BasicTicker"}},"id":"c3beecee-7e65-4cc9-98ac-af74025c5a15","type":"Grid"},{"attributes":{"fill_color":{"field":"colors"},"line_color":{"field":"colors"},"size":{"units":"screen","value":8},"x":{"field":"rt_score"},"y":{"field":"rt_audience_score"}},"id":"7c81bb6c-f37b-485d-b21b-cc7d3ed92ad5","type":"Circle"}],"root_ids":["0cafff65-fbae-4e6a-ae31-f95d52943a73"]},"title":"Bokeh Application","version":"0.12.4"}};
var render_items = [{"docid":"cc2032ca-af09-4c38-9978-aa3c50177c5d","elementid":"458481f2-c6c2-464a-8af3-c103c8a75b95","modelid":"0cafff65-fbae-4e6a-ae31-f95d52943a73"}];
Bokeh.embed.embed_items(docs_json, render_items);
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
},
function(Bokeh) {
}
];
function run_inline_js() {
if ((window.Bokeh !== undefined) || (force === true)) {
for (var i = 0; i < inline_js.length; i++) {
inline_js[i](window.Bokeh);
}if (force === true) {
display_loaded();
}} else if (Date.now() < window._bokeh_timeout) {
setTimeout(run_inline_js, 100);
} else if (!window._bokeh_failed_load) {
console.log("Bokeh: BokehJS failed to load within specified timeout.");
window._bokeh_failed_load = true;
} else if (force !== true) {
var cell = $(document.getElementById("458481f2-c6c2-464a-8af3-c103c8a75b95")).parents('.cell').data().cell;
cell.output_area.append_execute_result(NB_LOAD_WARNING)
}
}
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: BokehJS loaded, going straight to plotting");
run_inline_js();
} else {
load_libs(js_urls, function() {
console.log("Bokeh: BokehJS plotting callback run at", now());
run_inline_js();
});
}
}(this));
</script>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>One immediately obvious observation is that critics just use a wider range of ratings. Specifically, critic scores go much lower than audience scores. Average critic scores go as low as 2.7/10 (for <em>The Blue Lagoon</em> and <em>Staying Alive</em>) and as high as 9.1 (for <em>E.T.</em>, <em>Raiders of the Lost Ark</em>, and <em>All the President's Men</em>). Audience scores, on the other hand, only go from 5 (<em>Godzilla</em>, <em>The Flinstones</em>) to 8.8 (<em>The Avengers</em>, <em>The Dark Knight</em>, <em>Guardians of the Galaxy</em>). Unsurprisingly, the average critic score is lower than the average audience score - 6.58 for critics compared to 6.96 for audiences. This bias for critics to rate films lower than audiences <a href="https://economix.blogs.nytimes.com/2013/08/14/reviewing-the-movies-audiences-vs-critics/">is consistent with what others have found</a>.</p>
<p>So across the board, audiences rate films higher than critics. But does science fiction stand out as a genre, taking into account the overall bias? While the points are colored by genre, there aren't any obvious patterns. The data becomes more interpretable when we average across genre.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [5]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">##DATA PREP FOR GENRE PLOTS</span>
<span class="c1">#Melt the genre columns so we only have one. This will give multiple entries for movies with more than one genre</span>
<span class="n">melted_mov</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">melt</span><span class="p">(</span>
<span class="n">mov</span><span class="o">.</span><span class="n">drop</span><span class="p">([</span><span class="s1">'colors'</span><span class="p">,</span> <span class="s1">'Genre_str'</span><span class="p">],</span><span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">),</span>
<span class="n">id_vars</span><span class="o">=</span><span class="p">[</span><span class="s1">'title'</span><span class="p">,</span>
<span class="s1">'rt_audience_score'</span><span class="p">,</span>
<span class="s1">'rt_score'</span><span class="p">,</span>
<span class="s1">'dif'</span><span class="p">],</span>
<span class="n">value_name</span><span class="o">=</span><span class="s1">'genre'</span><span class="p">)</span>
<span class="c1">#A little bit of clean up</span>
<span class="n">melted_mov</span> <span class="o">=</span> <span class="n">melted_mov</span><span class="o">.</span><span class="n">drop</span><span class="p">(</span><span class="s1">'variable'</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
<span class="n">melted_mov</span> <span class="o">=</span> <span class="n">melted_mov</span><span class="o">.</span><span class="n">dropna</span><span class="p">()</span>
<span class="c1">#Group by genre</span>
<span class="n">genre_groups</span> <span class="o">=</span> <span class="n">melted_mov</span><span class="o">.</span><span class="n">groupby</span><span class="p">(</span><span class="s1">'genre'</span><span class="p">)</span>
<span class="c1">#Excluding genres with less than 20 entries</span>
<span class="n">genre_revs</span> <span class="o">=</span> <span class="n">genre_groups</span><span class="o">.</span><span class="n">mean</span><span class="p">()[</span><span class="n">genre_groups</span><span class="p">[</span><span class="s1">'genre'</span><span class="p">]</span><span class="o">.</span><span class="n">count</span><span class="p">()</span> <span class="o">></span> <span class="mi">20</span><span class="p">]</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [6]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">##SCATTER PLOT FOR GENRE SCORES</span>
<span class="c1">#Make a data source for bokeh</span>
<span class="n">genre_revs_source</span> <span class="o">=</span> <span class="n">ColumnDataSource</span><span class="p">(</span><span class="n">genre_revs</span><span class="p">)</span>
<span class="c1">#Get axes ranges</span>
<span class="n">low</span> <span class="o">=</span> <span class="n">genre_revs</span><span class="p">[[</span><span class="s1">'rt_audience_score'</span><span class="p">,</span><span class="s1">'rt_score'</span><span class="p">]]</span><span class="o">.</span><span class="n">min</span><span class="p">()</span><span class="o">.</span><span class="n">min</span><span class="p">()</span> <span class="o">-</span> <span class="mf">0.05</span>
<span class="n">high</span> <span class="o">=</span> <span class="n">genre_revs</span><span class="p">[[</span><span class="s1">'rt_audience_score'</span><span class="p">,</span><span class="s1">'rt_score'</span><span class="p">]]</span><span class="o">.</span><span class="n">max</span><span class="p">()</span><span class="o">.</span><span class="n">max</span><span class="p">()</span> <span class="o">+</span> <span class="mf">0.05</span>
<span class="c1">#Define the hover over tooltisp</span>
<span class="n">hover</span> <span class="o">=</span> <span class="n">HoverTool</span><span class="p">(</span>
<span class="n">tooltips</span><span class="o">=</span><span class="p">[(</span><span class="s2">"Genre"</span><span class="p">,</span> <span class="s2">"@genre"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Audience Score"</span><span class="p">,</span> <span class="s2">"@rt_audience_score</span><span class="si">{0.0}</span><span class="s2">"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Critic Score"</span><span class="p">,</span> <span class="s2">"@rt_score</span><span class="si">{0.0}</span><span class="s2">"</span><span class="p">),</span>
<span class="p">(</span><span class="s2">"Difference"</span><span class="p">,</span> <span class="s2">"@dif"</span><span class="p">)</span>
<span class="p">]</span>
<span class="p">)</span>
<span class="n">p</span> <span class="o">=</span> <span class="n">figure</span><span class="p">(</span><span class="n">title</span><span class="o">=</span><span class="s1">'Audience and critic ratings by genre'</span><span class="p">,</span>
<span class="n">x_range</span><span class="o">=</span><span class="n">Range1d</span><span class="p">(</span><span class="n">low</span><span class="p">,</span> <span class="n">high</span><span class="p">),</span>
<span class="n">y_range</span><span class="o">=</span><span class="n">Range1d</span><span class="p">(</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span>
<span class="n">tools</span><span class="o">=</span><span class="p">[</span><span class="n">hover</span><span class="p">])</span>
<span class="n">p</span><span class="o">.</span><span class="n">xaxis</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">axis_label</span> <span class="o">=</span> <span class="s1">'Critic Rating'</span>
<span class="n">p</span><span class="o">.</span><span class="n">yaxis</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">axis_label</span> <span class="o">=</span> <span class="s1">'Audience Rating'</span>
<span class="c1">#Add a line for where critic score = audience score</span>
<span class="n">p</span><span class="o">.</span><span class="n">line</span><span class="p">((</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span> <span class="p">(</span><span class="n">low</span><span class="p">,</span><span class="n">high</span><span class="p">),</span><span class="n">line_color</span><span class="o">=</span><span class="s2">"red"</span><span class="p">,</span> <span class="n">line_width</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
<span class="c1">#Scatter plot the genre scores</span>
<span class="n">p</span><span class="o">.</span><span class="n">scatter</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s1">'rt_score'</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s1">'rt_audience_score'</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">genre_revs_source</span><span class="p">,</span>
<span class="n">size</span><span class="o">=</span><span class="mi">6</span><span class="p">)</span>
<span class="c1">#Add labels for each genre</span>
<span class="n">labels</span> <span class="o">=</span> <span class="n">LabelSet</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s1">'rt_score'</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s1">'rt_audience_score'</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s1">'genre'</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">genre_revs_source</span><span class="p">,</span>
<span class="n">x_offset</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">y_offset</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">text_font_size</span><span class="o">=</span><span class="s2">"7.5pt"</span><span class="p">,</span> <span class="n">text_align</span><span class="o">=</span><span class="s1">'center'</span><span class="p">)</span>
<span class="n">p</span><span class="o">.</span><span class="n">add_layout</span><span class="p">(</span><span class="n">labels</span><span class="p">)</span>
<span class="c1">#Hide the bokeh toolbar</span>
<span class="n">p</span><span class="o">.</span><span class="n">toolbar_location</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">styleBokeh</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="n">show</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt"></div>
<div class="output_html rendered_html output_subarea">
<div class="bk-root">
<div class="bk-plotdiv" id="afae11a4-abe3-433e-a9d0-456a025f1c30"></div>
</div>
<script type="text/javascript">
(function(global) {
function now() {
return new Date();
}
var force = false;
if (typeof (window._bokeh_onload_callbacks) === "undefined" || force === true) {
window._bokeh_onload_callbacks = [];
window._bokeh_is_loading = undefined;
}
if (typeof (window._bokeh_timeout) === "undefined" || force === true) {
window._bokeh_timeout = Date.now() + 0;
window._bokeh_failed_load = false;
}
var NB_LOAD_WARNING = {'data': {'text/html':
"<div style='background-color: #fdd'>\n"+
"<p>\n"+
"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \n"+
"may be due to a slow or bad network connection. Possible fixes:\n"+
"</p>\n"+
"<ul>\n"+
"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\n"+
"<li>use INLINE resources instead, as so:</li>\n"+
"</ul>\n"+
"<code>\n"+
"from bokeh.resources import INLINE\n"+
"output_notebook(resources=INLINE)\n"+
"</code>\n"+
"</div>"}};
function display_loaded() {
if (window.Bokeh !== undefined) {
document.getElementById("afae11a4-abe3-433e-a9d0-456a025f1c30").textContent = "BokehJS successfully loaded.";
} else if (Date.now() < window._bokeh_timeout) {
setTimeout(display_loaded, 100)
}
}
function run_callbacks() {
window._bokeh_onload_callbacks.forEach(function(callback) { callback() });
delete window._bokeh_onload_callbacks
console.info("Bokeh: all callbacks have finished");
}
function load_libs(js_urls, callback) {
window._bokeh_onload_callbacks.push(callback);
if (window._bokeh_is_loading > 0) {
console.log("Bokeh: BokehJS is being loaded, scheduling callback at", now());
return null;
}
if (js_urls == null || js_urls.length === 0) {
run_callbacks();
return null;
}
console.log("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
window._bokeh_is_loading = js_urls.length;
for (var i = 0; i < js_urls.length; i++) {
var url = js_urls[i];
var s = document.createElement('script');
s.src = url;
s.async = false;
s.onreadystatechange = s.onload = function() {
window._bokeh_is_loading--;
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: all BokehJS libraries loaded");
run_callbacks()
}
};
s.onerror = function() {
console.warn("failed to load library " + url);
};
console.log("Bokeh: injecting script tag for BokehJS library: ", url);
document.getElementsByTagName("head")[0].appendChild(s);
}
};var element = document.getElementById("afae11a4-abe3-433e-a9d0-456a025f1c30");
if (element == null) {
console.log("Bokeh: ERROR: autoload.js configured with elementid 'afae11a4-abe3-433e-a9d0-456a025f1c30' but no matching script tag was found. ")
return false;
}
var js_urls = [];
var inline_js = [
function(Bokeh) {
(function() {
var fn = function() {
var docs_json = {"265f5e25-7f90-4820-8cd0-fda0fed0758b":{"roots":{"references":[{"attributes":{"axis_label":"Critic Rating","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"def868c2-201a-441b-949e-18989bba6e51","type":"BasicTickFormatter"},"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"4ea9b42d-c418-4e28-b348-e912ce4f2ab1","subtype":"Figure","type":"Plot"},"ticker":{"id":"21e2ece7-6261-4950-9fc5-34dbeb64c3ec","type":"BasicTicker"}},"id":"7924b069-2746-48bd-b23f-61b408c06713","type":"LinearAxis"},{"attributes":{"axis_label":"Audience Rating","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"3df93c1f-418d-4294-b7f8-7a48006b5432","type":"BasicTickFormatter"},"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"4ea9b42d-c418-4e28-b348-e912ce4f2ab1","subtype":"Figure","type":"Plot"},"ticker":{"id":"67f2d63a-a699-435d-bcf8-bb8f54903b06","type":"BasicTicker"}},"id":"e0664b1e-45a6-4aff-96d5-81cd6b4bd729","type":"LinearAxis"},{"attributes":{"callback":null,"end":7.354347826086956,"start":6.308333333333331},"id":"a4ada992-e704-4aeb-8c1e-26638e97c9b8","type":"Range1d"},{"attributes":{"plot":null,"text":"Audience and critic ratings by genre","text_font_size":{"value":"14pt"}},"id":"e56b276e-07b0-4a43-bbfa-bdbaca5a95b5","type":"Title"},{"attributes":{"below":[{"id":"7924b069-2746-48bd-b23f-61b408c06713","type":"LinearAxis"}],"left":[{"id":"e0664b1e-45a6-4aff-96d5-81cd6b4bd729","type":"LinearAxis"}],"renderers":[{"id":"7924b069-2746-48bd-b23f-61b408c06713","type":"LinearAxis"},{"id":"dcd7657c-e17d-477b-a378-b0f1a14de356","type":"Grid"},{"id":"e0664b1e-45a6-4aff-96d5-81cd6b4bd729","type":"LinearAxis"},{"id":"509d363e-45a1-42b3-a384-01cfa213af6a","type":"Grid"},{"id":"d85e3353-cc9e-4d53-b938-30054b1f4351","type":"GlyphRenderer"},{"id":"81ac1d8b-0966-41af-af78-310910bc5bc9","type":"GlyphRenderer"},{"id":"104a6486-b76c-47aa-8591-4fbe2f4e7fe0","type":"LabelSet"}],"title":{"id":"e56b276e-07b0-4a43-bbfa-bdbaca5a95b5","type":"Title"},"tool_events":{"id":"d9ead7ec-a3f7-4c92-89ca-e396747c376b","type":"ToolEvents"},"toolbar":{"id":"0905b46e-3281-47bf-9290-4b8b3d7cd5e9","type":"Toolbar"},"toolbar_location":null,"x_range":{"id":"a4ada992-e704-4aeb-8c1e-26638e97c9b8","type":"Range1d"},"y_range":{"id":"d38815ed-cd44-445f-94b8-613569bba9d7","type":"Range1d"}},"id":"4ea9b42d-c418-4e28-b348-e912ce4f2ab1","subtype":"Figure","type":"Plot"},{"attributes":{"data_source":{"id":"fd4e2a82-a5f5-4f57-a688-9ab260fb31d9","type":"ColumnDataSource"},"glyph":{"id":"370e3653-d673-4bef-8e9c-26948d80301a","type":"Circle"},"hover_glyph":null,"nonselection_glyph":{"id":"d254c830-e99c-47a3-9be9-53412a932249","type":"Circle"},"selection_glyph":null},"id":"81ac1d8b-0966-41af-af78-310910bc5bc9","type":"GlyphRenderer"},{"attributes":{"callback":null,"plot":{"id":"4ea9b42d-c418-4e28-b348-e912ce4f2ab1","subtype":"Figure","type":"Plot"},"tooltips":[["Genre","@genre"],["Audience Score","@rt_audience_score{0.0}"],["Critic Score","@rt_score{0.0}"],["Difference","@dif"]]},"id":"3df64374-387c-4032-926f-f977439106b4","type":"HoverTool"},{"attributes":{"callback":null,"column_names":["y","x"],"data":{"x":[6.308333333333331,7.354347826086956],"y":[6.308333333333331,7.354347826086956]}},"id":"2a4e488b-7398-4111-9771-b6c327249087","type":"ColumnDataSource"},{"attributes":{"plot":{"id":"4ea9b42d-c418-4e28-b348-e912ce4f2ab1","subtype":"Figure","type":"Plot"},"ticker":{"id":"21e2ece7-6261-4950-9fc5-34dbeb64c3ec","type":"BasicTicker"}},"id":"dcd7657c-e17d-477b-a378-b0f1a14de356","type":"Grid"},{"attributes":{"callback":null,"column_names":["genre","rt_audience_score","dif","rt_score"],"data":{"dif":[0.607051282051282,0.5310344827586205,0.14565217391304355,0.3398648648648648,0.2642857142857143,0.18899082568807327,0.386046511627907,0.6383333333333334,0.29999999999999977,0.32881355932203393,0.26607142857142857],"genre":["Action","Adventure","Animation","Comedy","Crime","Drama","Family","Fantasy","Romance","Sci-Fi","Thriller"],"rt_audience_score":[6.965384615384615,7.094252873563219,7.304347826086956,6.71486486486486,6.814285714285715,6.961467889908261,6.897674418604649,7.126666666666664,6.7019607843137265,7.105084745762712,6.875],"rt_score":[6.358333333333331,6.563218390804598,7.158695652173912,6.375000000000002,6.550000000000001,6.772477064220184,6.511627906976742,6.488333333333332,6.401960784313726,6.776271186440679,6.608928571428573]}},"id":"fd4e2a82-a5f5-4f57-a688-9ab260fb31d9","type":"ColumnDataSource"},{"attributes":{"line_alpha":{"value":0.5},"line_color":{"value":"red"},"line_width":{"value":5},"x":{"field":"x"},"y":{"field":"y"}},"id":"5695dfbe-686b-42cc-b760-1dbc9211170f","type":"Line"},{"attributes":{"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"line_width":{"value":5},"x":{"field":"x"},"y":{"field":"y"}},"id":"7f296e5b-446d-49fd-b438-08ac90341316","type":"Line"},{"attributes":{"plot":{"id":"4ea9b42d-c418-4e28-b348-e912ce4f2ab1","subtype":"Figure","type":"Plot"},"source":{"id":"fd4e2a82-a5f5-4f57-a688-9ab260fb31d9","type":"ColumnDataSource"},"text":{"field":"genre"},"text_align":"center","text_font_size":{"value":"7.5pt"},"x":{"field":"rt_score"},"y":{"field":"rt_audience_score"},"y_offset":{"value":5}},"id":"104a6486-b76c-47aa-8591-4fbe2f4e7fe0","type":"LabelSet"},{"attributes":{},"id":"def868c2-201a-441b-949e-18989bba6e51","type":"BasicTickFormatter"},{"attributes":{"fill_color":{"value":"#1f77b4"},"line_color":{"value":"#1f77b4"},"size":{"units":"screen","value":6},"x":{"field":"rt_score"},"y":{"field":"rt_audience_score"}},"id":"370e3653-d673-4bef-8e9c-26948d80301a","type":"Circle"},{"attributes":{"active_drag":"auto","active_scroll":"auto","active_tap":"auto","tools":[{"id":"3df64374-387c-4032-926f-f977439106b4","type":"HoverTool"}]},"id":"0905b46e-3281-47bf-9290-4b8b3d7cd5e9","type":"Toolbar"},{"attributes":{},"id":"3df93c1f-418d-4294-b7f8-7a48006b5432","type":"BasicTickFormatter"},{"attributes":{},"id":"67f2d63a-a699-435d-bcf8-bb8f54903b06","type":"BasicTicker"},{"attributes":{},"id":"21e2ece7-6261-4950-9fc5-34dbeb64c3ec","type":"BasicTicker"},{"attributes":{"dimension":1,"plot":{"id":"4ea9b42d-c418-4e28-b348-e912ce4f2ab1","subtype":"Figure","type":"Plot"},"ticker":{"id":"67f2d63a-a699-435d-bcf8-bb8f54903b06","type":"BasicTicker"}},"id":"509d363e-45a1-42b3-a384-01cfa213af6a","type":"Grid"},{"attributes":{"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"size":{"units":"screen","value":6},"x":{"field":"rt_score"},"y":{"field":"rt_audience_score"}},"id":"d254c830-e99c-47a3-9be9-53412a932249","type":"Circle"},{"attributes":{},"id":"d9ead7ec-a3f7-4c92-89ca-e396747c376b","type":"ToolEvents"},{"attributes":{"data_source":{"id":"2a4e488b-7398-4111-9771-b6c327249087","type":"ColumnDataSource"},"glyph":{"id":"5695dfbe-686b-42cc-b760-1dbc9211170f","type":"Line"},"hover_glyph":null,"nonselection_glyph":{"id":"7f296e5b-446d-49fd-b438-08ac90341316","type":"Line"},"selection_glyph":null},"id":"d85e3353-cc9e-4d53-b938-30054b1f4351","type":"GlyphRenderer"},{"attributes":{"callback":null,"end":7.354347826086956,"start":6.308333333333331},"id":"d38815ed-cd44-445f-94b8-613569bba9d7","type":"Range1d"}],"root_ids":["4ea9b42d-c418-4e28-b348-e912ce4f2ab1"]},"title":"Bokeh Application","version":"0.12.4"}};
var render_items = [{"docid":"265f5e25-7f90-4820-8cd0-fda0fed0758b","elementid":"afae11a4-abe3-433e-a9d0-456a025f1c30","modelid":"4ea9b42d-c418-4e28-b348-e912ce4f2ab1"}];
Bokeh.embed.embed_items(docs_json, render_items);
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
},
function(Bokeh) {
}
];
function run_inline_js() {
if ((window.Bokeh !== undefined) || (force === true)) {
for (var i = 0; i < inline_js.length; i++) {
inline_js[i](window.Bokeh);
}if (force === true) {
display_loaded();
}} else if (Date.now() < window._bokeh_timeout) {
setTimeout(run_inline_js, 100);
} else if (!window._bokeh_failed_load) {
console.log("Bokeh: BokehJS failed to load within specified timeout.");
window._bokeh_failed_load = true;
} else if (force !== true) {
var cell = $(document.getElementById("afae11a4-abe3-433e-a9d0-456a025f1c30")).parents('.cell').data().cell;
cell.output_area.append_execute_result(NB_LOAD_WARNING)
}
}
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: BokehJS loaded, going straight to plotting");
run_inline_js();
} else {
load_libs(js_urls, function() {
console.log("Bokeh: BokehJS plotting callback run at", now());
run_inline_js();
});
}
}(this));
</script>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>We can see that the trend of audiences liking movies more than critics is consistent across all genres. Interestingly, both audiences and critics seem to love animation films. It's easier to see where audiences and critics disagree most by looking at the difference in their ratings.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [7]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="n">genre_revs</span> <span class="o">=</span> <span class="n">genre_revs</span><span class="o">.</span><span class="n">sort_values</span><span class="p">(</span><span class="s1">'dif'</span><span class="p">,</span> <span class="n">ascending</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span>
<span class="n">p</span> <span class="o">=</span> <span class="n">Bar</span><span class="p">(</span><span class="n">genre_revs</span><span class="o">.</span><span class="n">reset_index</span><span class="p">(),</span>
<span class="n">values</span><span class="o">=</span><span class="s1">'dif'</span><span class="p">,</span>
<span class="n">label</span><span class="o">=</span><span class="n">CatAttr</span><span class="p">(</span><span class="n">columns</span><span class="o">=</span><span class="p">[</span><span class="s1">'genre'</span><span class="p">],</span> <span class="n">sort</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span>
<span class="n">legend</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">title</span><span class="o">=</span><span class="s1">'Difference between critics and audience ratings by genre'</span><span class="p">,</span>
<span class="n">ylabel</span><span class="o">=</span><span class="s1">'Audience ratings minus critic ratings'</span><span class="p">,</span>
<span class="n">tools</span><span class="o">=</span><span class="p">[])</span>
<span class="n">p</span><span class="o">.</span><span class="n">toolbar_location</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">styleBokeh</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="n">show</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt"></div>
<div class="output_html rendered_html output_subarea">
<div class="bk-root">
<div class="bk-plotdiv" id="beecd57c-a46f-452b-8091-0d15b2f9bff7"></div>
</div>
<script type="text/javascript">
(function(global) {
function now() {
return new Date();
}
var force = false;
if (typeof (window._bokeh_onload_callbacks) === "undefined" || force === true) {
window._bokeh_onload_callbacks = [];
window._bokeh_is_loading = undefined;
}
if (typeof (window._bokeh_timeout) === "undefined" || force === true) {
window._bokeh_timeout = Date.now() + 0;
window._bokeh_failed_load = false;
}
var NB_LOAD_WARNING = {'data': {'text/html':
"<div style='background-color: #fdd'>\n"+
"<p>\n"+
"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \n"+
"may be due to a slow or bad network connection. Possible fixes:\n"+
"</p>\n"+
"<ul>\n"+
"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\n"+
"<li>use INLINE resources instead, as so:</li>\n"+
"</ul>\n"+
"<code>\n"+
"from bokeh.resources import INLINE\n"+
"output_notebook(resources=INLINE)\n"+
"</code>\n"+
"</div>"}};
function display_loaded() {
if (window.Bokeh !== undefined) {
document.getElementById("beecd57c-a46f-452b-8091-0d15b2f9bff7").textContent = "BokehJS successfully loaded.";
} else if (Date.now() < window._bokeh_timeout) {
setTimeout(display_loaded, 100)
}
}
function run_callbacks() {
window._bokeh_onload_callbacks.forEach(function(callback) { callback() });
delete window._bokeh_onload_callbacks
console.info("Bokeh: all callbacks have finished");
}
function load_libs(js_urls, callback) {
window._bokeh_onload_callbacks.push(callback);
if (window._bokeh_is_loading > 0) {
console.log("Bokeh: BokehJS is being loaded, scheduling callback at", now());
return null;
}
if (js_urls == null || js_urls.length === 0) {
run_callbacks();
return null;
}
console.log("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
window._bokeh_is_loading = js_urls.length;
for (var i = 0; i < js_urls.length; i++) {
var url = js_urls[i];
var s = document.createElement('script');
s.src = url;
s.async = false;
s.onreadystatechange = s.onload = function() {
window._bokeh_is_loading--;
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: all BokehJS libraries loaded");
run_callbacks()
}
};
s.onerror = function() {
console.warn("failed to load library " + url);
};
console.log("Bokeh: injecting script tag for BokehJS library: ", url);
document.getElementsByTagName("head")[0].appendChild(s);
}
};var element = document.getElementById("beecd57c-a46f-452b-8091-0d15b2f9bff7");
if (element == null) {
console.log("Bokeh: ERROR: autoload.js configured with elementid 'beecd57c-a46f-452b-8091-0d15b2f9bff7' but no matching script tag was found. ")
return false;
}
var js_urls = [];
var inline_js = [
function(Bokeh) {
(function() {
var fn = function() {
var docs_json = {"4f4adaa4-b86c-49dd-9192-627149ea8a3f":{"roots":{"references":[{"attributes":{"callback":null,"factors":["Fantasy","Action","Adventure","Family","Comedy","Sci-Fi","Romance","Thriller","Crime","Drama","Animation"]},"id":"9b51b164-6ab7-4dd0-bab4-46ad99b82a90","type":"FactorRange"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"cd0e36c9-93a8-4820-943b-f8d073ae06e5","type":"Rect"},{"attributes":{"data_source":{"id":"14bc0c70-f3b8-4ec2-a30e-aa8c0a75fa58","type":"ColumnDataSource"},"glyph":{"id":"92c5aafa-b6fd-44f9-bef9-6e77f50529f3","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"6bc0e416-354e-4faa-ac3c-3e09b9b7eff9","type":"GlyphRenderer"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"6d49737f-822b-46fd-96a2-a4e11ff756e1","type":"Rect"},{"attributes":{"callback":null,"column_names":["line_alpha","color","fill_alpha","x","height","line_color","width","y","label"],"data":{"chart_index":[{"genre":"Comedy"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Comedy"],"height":[0.3398648648648648],"label":[{"genre":"Comedy"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Comedy"],"y":[0.1699324324324324]}},"id":"f6677b5a-0a64-45a0-b107-af62427e7277","type":"ColumnDataSource"},{"attributes":{"callback":null,"column_names":["line_alpha","color","fill_alpha","x","height","line_color","width","y","label"],"data":{"chart_index":[{"genre":"Drama"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Drama"],"height":[0.18899082568807327],"label":[{"genre":"Drama"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Drama"],"y":[0.09449541284403663]}},"id":"9a5686bf-29c2-49c8-99df-17faecc1cef6","type":"ColumnDataSource"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"92c5aafa-b6fd-44f9-bef9-6e77f50529f3","type":"Rect"},{"attributes":{"data_source":{"id":"3b2edc2a-dc82-4e95-8d45-56bc8cd4567e","type":"ColumnDataSource"},"glyph":{"id":"31b6482f-f6ac-4b7b-9d80-04f2dacd6bf0","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"10dff4b7-2add-470a-a8bd-4ad3c5895285","type":"GlyphRenderer"},{"attributes":{"axis_label":"Genre","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"26efcaa8-2cd8-4c73-946d-fbd3e8931453","type":"CategoricalTickFormatter"},"major_label_orientation":0.7853981633974483,"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"25dacd9a-caba-4611-8d1d-f709006b80ce","subtype":"Chart","type":"Plot"},"ticker":{"id":"5cb4d098-b689-43be-b74a-d3c3b1511e3f","type":"CategoricalTicker"}},"id":"aeae3273-b7d8-4900-a0db-171f2c1338c8","type":"CategoricalAxis"},{"attributes":{"callback":null,"column_names":["line_alpha","color","fill_alpha","x","height","line_color","width","y","label"],"data":{"chart_index":[{"genre":"Family"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Family"],"height":[0.386046511627907],"label":[{"genre":"Family"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Family"],"y":[0.1930232558139535]}},"id":"0232b01d-764a-4855-a492-a98602363f9e","type":"ColumnDataSource"},{"attributes":{"data_source":{"id":"eaacf6a9-d106-4121-a6c7-418997d5d8a7","type":"ColumnDataSource"},"glyph":{"id":"4e505203-133d-4fb6-8c02-5e7d5df2c2d4","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"fe34e997-29ce-4989-9cd0-c8f769db5ce9","type":"GlyphRenderer"},{"attributes":{"callback":null,"column_names":["line_alpha","color","fill_alpha","x","height","line_color","width","y","label"],"data":{"chart_index":[{"genre":"Action"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Action"],"height":[0.607051282051282],"label":[{"genre":"Action"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Action"],"y":[0.303525641025641]}},"id":"e29f9803-98f3-49d5-979d-cf7c3a41c544","type":"ColumnDataSource"},{"attributes":{"active_drag":"auto","active_scroll":"auto","active_tap":"auto"},"id":"62f46a24-6cd7-40b4-8dc8-587a8ea0ee72","type":"Toolbar"},{"attributes":{"axis_label":"Audience ratings minus critic ratings","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"39f9460d-6e7a-408b-99f3-5729bc0d3dee","type":"BasicTickFormatter"},"major_label_text_font_size":{"value":"10pt"},"plot":{"id":"25dacd9a-caba-4611-8d1d-f709006b80ce","subtype":"Chart","type":"Plot"},"ticker":{"id":"f2c43466-d816-44e9-b40a-d744a957b803","type":"BasicTicker"}},"id":"1a9984bd-c4b5-4a52-9192-0945da7bb2e8","type":"LinearAxis"},{"attributes":{"callback":null,"column_names":["line_alpha","color","fill_alpha","x","height","line_color","width","y","label"],"data":{"chart_index":[{"genre":"Adventure"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Adventure"],"height":[0.5310344827586205],"label":[{"genre":"Adventure"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Adventure"],"y":[0.26551724137931026]}},"id":"eaacf6a9-d106-4121-a6c7-418997d5d8a7","type":"ColumnDataSource"},{"attributes":{"below":[{"id":"aeae3273-b7d8-4900-a0db-171f2c1338c8","type":"CategoricalAxis"}],"css_classes":null,"left":[{"id":"1a9984bd-c4b5-4a52-9192-0945da7bb2e8","type":"LinearAxis"}],"renderers":[{"id":"10dff4b7-2add-470a-a8bd-4ad3c5895285","type":"GlyphRenderer"},{"id":"a1a21abc-a47a-402c-ad15-f4dd61464a81","type":"GlyphRenderer"},{"id":"fe34e997-29ce-4989-9cd0-c8f769db5ce9","type":"GlyphRenderer"},{"id":"62768591-ef6a-40a5-9462-1ac87923b471","type":"GlyphRenderer"},{"id":"2210fc4e-3fe9-434f-ab7f-681f4af21861","type":"GlyphRenderer"},{"id":"6bc0e416-354e-4faa-ac3c-3e09b9b7eff9","type":"GlyphRenderer"},{"id":"f39fbbda-cbff-40b9-b5db-1d629048f4fe","type":"GlyphRenderer"},{"id":"439201ed-fb60-4aaa-bf39-f2497ee54ed3","type":"GlyphRenderer"},{"id":"b3e9de6d-a93b-4336-9842-dc20e5ba2593","type":"GlyphRenderer"},{"id":"faa4df8e-0ce1-494f-be32-73e9029f2da9","type":"GlyphRenderer"},{"id":"ef2f1989-f4bd-4095-8031-2e13640fd914","type":"GlyphRenderer"},{"id":"aeae3273-b7d8-4900-a0db-171f2c1338c8","type":"CategoricalAxis"},{"id":"1a9984bd-c4b5-4a52-9192-0945da7bb2e8","type":"LinearAxis"},{"id":"ff37fc20-9170-49f0-96e6-e0ad89229b68","type":"Grid"}],"title":{"id":"95be5c83-78f1-4cb4-9116-3e364cf64d12","type":"Title"},"tool_events":{"id":"ac5d02a5-bbf0-4050-9b26-4a2e25a3cb14","type":"ToolEvents"},"toolbar":{"id":"62f46a24-6cd7-40b4-8dc8-587a8ea0ee72","type":"Toolbar"},"toolbar_location":null,"x_mapper_type":"auto","x_range":{"id":"9b51b164-6ab7-4dd0-bab4-46ad99b82a90","type":"FactorRange"},"y_mapper_type":"auto","y_range":{"id":"bdb34871-fb22-4b03-99fb-53528860c19c","type":"Range1d"}},"id":"25dacd9a-caba-4611-8d1d-f709006b80ce","subtype":"Chart","type":"Plot"},{"attributes":{"data_source":{"id":"9ceea05c-b1c6-4789-91b1-79b76f8df9eb","type":"ColumnDataSource"},"glyph":{"id":"f1e50db2-1a56-4651-8def-98a5873cde04","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"ef2f1989-f4bd-4095-8031-2e13640fd914","type":"GlyphRenderer"},{"attributes":{"data_source":{"id":"0232b01d-764a-4855-a492-a98602363f9e","type":"ColumnDataSource"},"glyph":{"id":"6c9c32ab-4637-49b1-b0ec-05b3fda6d4bc","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"62768591-ef6a-40a5-9462-1ac87923b471","type":"GlyphRenderer"},{"attributes":{"plot":null,"text":"Difference between critics and audience ratings by genre","text_font_size":{"value":"14pt"}},"id":"95be5c83-78f1-4cb4-9116-3e364cf64d12","type":"Title"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"c27cd0ec-7de5-47d4-8313-7903e8034336","type":"Rect"},{"attributes":{"dimension":1,"plot":{"id":"25dacd9a-caba-4611-8d1d-f709006b80ce","subtype":"Chart","type":"Plot"},"ticker":{"id":"f2c43466-d816-44e9-b40a-d744a957b803","type":"BasicTicker"}},"id":"ff37fc20-9170-49f0-96e6-e0ad89229b68","type":"Grid"},{"attributes":{"callback":null,"end":0.6702500000000001},"id":"bdb34871-fb22-4b03-99fb-53528860c19c","type":"Range1d"},{"attributes":{},"id":"ac5d02a5-bbf0-4050-9b26-4a2e25a3cb14","type":"ToolEvents"},{"attributes":{},"id":"f2c43466-d816-44e9-b40a-d744a957b803","type":"BasicTicker"},{"attributes":{"callback":null,"column_names":["line_alpha","color","fill_alpha","x","height","line_color","width","y","label"],"data":{"chart_index":[{"genre":"Romance"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Romance"],"height":[0.29999999999999977],"label":[{"genre":"Romance"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Romance"],"y":[0.14999999999999988]}},"id":"a6bfc00e-ed5f-4dde-bab2-88e92fddacd8","type":"ColumnDataSource"},{"attributes":{"data_source":{"id":"a5135e23-4392-48de-8a3b-1ad181580a4b","type":"ColumnDataSource"},"glyph":{"id":"b2c47d7d-7e3b-4072-8166-37fa5195597b","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"b3e9de6d-a93b-4336-9842-dc20e5ba2593","type":"GlyphRenderer"},{"attributes":{"data_source":{"id":"f6677b5a-0a64-45a0-b107-af62427e7277","type":"ColumnDataSource"},"glyph":{"id":"63e87dd2-1239-4722-964a-023e76a8b431","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"2210fc4e-3fe9-434f-ab7f-681f4af21861","type":"GlyphRenderer"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"b2c47d7d-7e3b-4072-8166-37fa5195597b","type":"Rect"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"f1e50db2-1a56-4651-8def-98a5873cde04","type":"Rect"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"63e87dd2-1239-4722-964a-023e76a8b431","type":"Rect"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"6c9c32ab-4637-49b1-b0ec-05b3fda6d4bc","type":"Rect"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"31b6482f-f6ac-4b7b-9d80-04f2dacd6bf0","type":"Rect"},{"attributes":{},"id":"5cb4d098-b689-43be-b74a-d3c3b1511e3f","type":"CategoricalTicker"},{"attributes":{"data_source":{"id":"9a5686bf-29c2-49c8-99df-17faecc1cef6","type":"ColumnDataSource"},"glyph":{"id":"6d49737f-822b-46fd-96a2-a4e11ff756e1","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"faa4df8e-0ce1-494f-be32-73e9029f2da9","type":"GlyphRenderer"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"e156c05f-5594-4c83-9517-09622f9bd1db","type":"Rect"},{"attributes":{"data_source":{"id":"719251ea-b50b-45d3-ab4f-bf36ba5ede5a","type":"ColumnDataSource"},"glyph":{"id":"cd0e36c9-93a8-4820-943b-f8d073ae06e5","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"439201ed-fb60-4aaa-bf39-f2497ee54ed3","type":"GlyphRenderer"},{"attributes":{"callback":null,"column_names":["line_alpha","color","fill_alpha","x","height","line_color","width","y","label"],"data":{"chart_index":[{"genre":"Sci-Fi"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Sci-Fi"],"height":[0.32881355932203393],"label":[{"genre":"Sci-Fi"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Sci-Fi"],"y":[0.16440677966101697]}},"id":"14bc0c70-f3b8-4ec2-a30e-aa8c0a75fa58","type":"ColumnDataSource"},{"attributes":{},"id":"26efcaa8-2cd8-4c73-946d-fbd3e8931453","type":"CategoricalTickFormatter"},{"attributes":{},"id":"39f9460d-6e7a-408b-99f3-5729bc0d3dee","type":"BasicTickFormatter"},{"attributes":{"callback":null,"column_names":["line_alpha","color","fill_alpha","x","height","line_color","width","y","label"],"data":{"chart_index":[{"genre":"Thriller"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Thriller"],"height":[0.26607142857142857],"label":[{"genre":"Thriller"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Thriller"],"y":[0.13303571428571428]}},"id":"719251ea-b50b-45d3-ab4f-bf36ba5ede5a","type":"ColumnDataSource"},{"attributes":{"data_source":{"id":"e29f9803-98f3-49d5-979d-cf7c3a41c544","type":"ColumnDataSource"},"glyph":{"id":"e156c05f-5594-4c83-9517-09622f9bd1db","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"a1a21abc-a47a-402c-ad15-f4dd61464a81","type":"GlyphRenderer"},{"attributes":{"callback":null,"column_names":["line_alpha","color","fill_alpha","x","height","line_color","width","y","label"],"data":{"chart_index":[{"genre":"Animation"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Animation"],"height":[0.14565217391304355],"label":[{"genre":"Animation"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Animation"],"y":[0.07282608695652178]}},"id":"9ceea05c-b1c6-4789-91b1-79b76f8df9eb","type":"ColumnDataSource"},{"attributes":{"data_source":{"id":"a6bfc00e-ed5f-4dde-bab2-88e92fddacd8","type":"ColumnDataSource"},"glyph":{"id":"c27cd0ec-7de5-47d4-8313-7903e8034336","type":"Rect"},"hover_glyph":null,"nonselection_glyph":null,"selection_glyph":null},"id":"f39fbbda-cbff-40b9-b5db-1d629048f4fe","type":"GlyphRenderer"},{"attributes":{"callback":null,"column_names":["line_alpha","color","fill_alpha","x","height","line_color","width","y","label"],"data":{"chart_index":[{"genre":"Fantasy"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Fantasy"],"height":[0.6383333333333334],"label":[{"genre":"Fantasy"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Fantasy"],"y":[0.3191666666666667]}},"id":"3b2edc2a-dc82-4e95-8d45-56bc8cd4567e","type":"ColumnDataSource"},{"attributes":{"callback":null,"column_names":["line_alpha","color","fill_alpha","x","height","line_color","width","y","label"],"data":{"chart_index":[{"genre":"Crime"}],"color":["#f22c40"],"fill_alpha":[0.8],"genre":["Crime"],"height":[0.2642857142857143],"label":[{"genre":"Crime"}],"line_alpha":[1.0],"line_color":["white"],"width":[0.8],"x":["Crime"],"y":[0.13214285714285715]}},"id":"a5135e23-4392-48de-8a3b-1ad181580a4b","type":"ColumnDataSource"},{"attributes":{"fill_alpha":{"field":"fill_alpha"},"fill_color":{"field":"color"},"height":{"field":"height","units":"data"},"line_color":{"field":"line_color"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"4e505203-133d-4fb6-8c02-5e7d5df2c2d4","type":"Rect"}],"root_ids":["25dacd9a-caba-4611-8d1d-f709006b80ce"]},"title":"Bokeh Application","version":"0.12.4"}};
var render_items = [{"docid":"4f4adaa4-b86c-49dd-9192-627149ea8a3f","elementid":"beecd57c-a46f-452b-8091-0d15b2f9bff7","modelid":"25dacd9a-caba-4611-8d1d-f709006b80ce"}];
Bokeh.embed.embed_items(docs_json, render_items);
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
},
function(Bokeh) {
}
];
function run_inline_js() {
if ((window.Bokeh !== undefined) || (force === true)) {
for (var i = 0; i < inline_js.length; i++) {
inline_js[i](window.Bokeh);
}if (force === true) {
display_loaded();
}} else if (Date.now() < window._bokeh_timeout) {
setTimeout(run_inline_js, 100);
} else if (!window._bokeh_failed_load) {
console.log("Bokeh: BokehJS failed to load within specified timeout.");
window._bokeh_failed_load = true;
} else if (force !== true) {
var cell = $(document.getElementById("beecd57c-a46f-452b-8091-0d15b2f9bff7")).parents('.cell').data().cell;
cell.output_area.append_execute_result(NB_LOAD_WARNING)
}
}
if (window._bokeh_is_loading === 0) {
console.log("Bokeh: BokehJS loaded, going straight to plotting");
run_inline_js();
} else {
load_libs(js_urls, function() {
console.log("Bokeh: BokehJS plotting callback run at", now());
run_inline_js();
});
}
}(this));
</script>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Now we can see my hypothesis was actually quite wrong. Sci-fi falls right in the middle of the pack in terms of how much the audience ratings differ from critics. Instead, fantasy leads the pack in genres that audiences love more than critics.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [8]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">#Make mov presentable for printing</span>
<span class="n">print_mov</span> <span class="o">=</span> <span class="n">mov</span><span class="o">.</span><span class="n">drop</span><span class="p">([</span><span class="s1">'Genre_1'</span><span class="p">,</span> <span class="s1">'Genre_2'</span><span class="p">,</span> <span class="s1">'Genre_3'</span><span class="p">,</span> <span class="s1">'colors'</span><span class="p">],</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="n">print_mov</span><span class="o">.</span><span class="n">columns</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'Title'</span><span class="p">,</span> <span class="s1">'Audience Score'</span><span class="p">,</span> <span class="s1">'Critic Score'</span><span class="p">,</span> <span class="s1">'Difference'</span><span class="p">,</span> <span class="s1">'Genres'</span><span class="p">]</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="-Top-10-Fantasy-Movies-Audiences-Love-More-Than-Critics-"><center> Top 10 Fantasy Movies Audiences Love More Than Critics </center><a class="anchor-link" href="#-Top-10-Fantasy-Movies-Audiences-Love-More-Than-Critics-">¶</a></h1><p>To get a sense of what kinds of movies are driving the disagreement over fantasy movies, we can look at the movies in this genre where the scores disagree most.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [9]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="c1">#Get the titles of the 10 fantasy movies with the greatest difference between audience and critics</span>
<span class="n">fantasy_movie_titles</span> <span class="o">=</span> <span class="p">(</span><span class="n">melted_mov</span><span class="p">[</span><span class="n">melted_mov</span><span class="p">[</span><span class="s1">'genre'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Fantasy'</span><span class="p">]</span><span class="o">.</span>
<span class="n">sort_values</span><span class="p">(</span><span class="n">by</span><span class="o">=</span><span class="s1">'dif'</span><span class="p">,</span> <span class="n">ascending</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">10</span><span class="p">]</span>
<span class="p">[</span><span class="s1">'title'</span><span class="p">])</span>
<span class="c1">#Make the table pretty and output it</span>
<span class="n">fantasy_table</span> <span class="o">=</span> <span class="p">(</span><span class="n">print_mov</span>
<span class="p">[</span><span class="n">print_mov</span><span class="p">[</span><span class="s1">'Title'</span><span class="p">]</span><span class="o">.</span><span class="n">isin</span><span class="p">(</span><span class="n">fantasy_movie_titles</span><span class="p">)]</span><span class="o">.</span>
<span class="n">sort_values</span><span class="p">(</span><span class="s1">'Difference'</span><span class="p">,</span> <span class="n">ascending</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="p">)</span>
<span class="n">fantasy_table</span><span class="o">.</span><span class="n">index</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">11</span><span class="p">)</span>
<span class="n">fantasy_table</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[9]:</div>
<div class="output_html rendered_html output_subarea output_execute_result">
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>Title</th>
<th>Audience Score</th>
<th>Critic Score</th>
<th>Difference</th>
<th>Genres</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<td>The Twilight Saga: New Moon</td>
<td>7.2</td>
<td>4.7</td>
<td>2.5</td>
<td>Fantasy Drama Adventure</td>
</tr>
<tr>
<th>2</th>
<td>The Twilight Saga: Breaking Dawn - Part 2</td>
<td>7.6</td>
<td>5.2</td>
<td>2.4</td>
<td>Fantasy Drama Adventure</td>
</tr>
<tr>
<th>3</th>
<td>300</td>
<td>8.2</td>
<td>6.1</td>
<td>2.1</td>
<td>War Fantasy Action</td>
</tr>
<tr>
<th>4</th>
<td>Pirates of the Caribbean: At World's End</td>
<td>7.6</td>
<td>5.5</td>
<td>2.1</td>
<td>Fantasy Adventure Action</td>
</tr>
<tr>
<th>5</th>
<td>Pirates of the Caribbean: On Stranger Tides</td>
<td>7.0</td>
<td>5.1</td>
<td>1.9</td>
<td>Fantasy Adventure Action</td>
</tr>
<tr>
<th>6</th>
<td>The Twilight Saga: Eclipse</td>
<td>7.2</td>
<td>5.4</td>
<td>1.8</td>
<td>Fantasy Drama Adventure</td>
</tr>
<tr>
<th>7</th>
<td>Hancock</td>
<td>7.2</td>
<td>5.4</td>
<td>1.8</td>
<td>Fantasy Action</td>
</tr>
<tr>
<th>8</th>
<td>Pirates of the Caribbean: Dead Man's Chest</td>
<td>7.8</td>
<td>6.0</td>
<td>1.8</td>
<td>Fantasy Adventure Action</td>
</tr>
<tr>
<th>9</th>
<td>Man of Steel</td>
<td>7.8</td>
<td>6.2</td>
<td>1.6</td>
<td>Fantasy Adventure Action</td>
</tr>
<tr>
<th>10</th>
<td>Thor: The Dark World</td>
<td>7.8</td>
<td>6.2</td>
<td>1.6</td>
<td>Fantasy Adventure Action</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Perhaps obvious in retrospect, <em>The Twilight Saga</em> and superhero movies are where critics and the audience disagree most.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="-Top-10-Movies-Audiences-Love-More-Than-Critics"><center> Top 10 Movies Audiences Love More Than Critics</center><a class="anchor-link" href="#-Top-10-Movies-Audiences-Love-More-Than-Critics">¶</a></h1><p>We can also look across all movies, what movies do the audiences love much more than critics.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [10]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="n">top10_table</span> <span class="o">=</span> <span class="n">print_mov</span><span class="o">.</span><span class="n">sort_values</span><span class="p">(</span><span class="s1">'Difference'</span><span class="p">,</span> <span class="n">ascending</span><span class="o">=</span><span class="kc">False</span><span class="p">)[</span><span class="mi">0</span><span class="p">:</span><span class="mi">10</span><span class="p">]</span>
<span class="n">top10_table</span><span class="o">.</span><span class="n">index</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">11</span><span class="p">)</span>
<span class="n">top10_table</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[10]:</div>
<div class="output_html rendered_html output_subarea output_execute_result">
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>Title</th>
<th>Audience Score</th>
<th>Critic Score</th>
<th>Difference</th>
<th>Genres</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<td>Bad Boys II</td>
<td>7.2</td>
<td>4.1</td>
<td>3.1</td>
<td>Crime Comedy Action</td>
</tr>
<tr>
<th>2</th>
<td>Transformers: Revenge of the Fallen</td>
<td>7.0</td>
<td>3.9</td>
<td>3.1</td>
<td>Sci-Fi Adventure Action</td>
</tr>
<tr>
<th>3</th>
<td>The Blue Lagoon</td>
<td>5.8</td>
<td>2.7</td>
<td>3.1</td>
<td>Romance Drama Adventure</td>
</tr>
<tr>
<th>4</th>
<td>Staying Alive</td>
<td>5.4</td>
<td>2.7</td>
<td>2.7</td>
<td>Romance Music Drama</td>
</tr>
<tr>
<th>5</th>
<td>Transformers: Age of Extinction</td>
<td>6.6</td>
<td>3.9</td>
<td>2.7</td>
<td>Sci-Fi Adventure Action</td>
</tr>
<tr>
<th>6</th>
<td>The Twilight Saga: New Moon</td>
<td>7.2</td>
<td>4.7</td>
<td>2.5</td>
<td>Fantasy Drama Adventure</td>
</tr>
<tr>
<th>7</th>
<td>National Treasure: Book of Secrets</td>
<td>7.2</td>
<td>4.8</td>
<td>2.4</td>
<td>Mystery Adventure Action</td>
</tr>
<tr>
<th>8</th>
<td>Home Alone 2: Lost in New York</td>
<td>6.0</td>
<td>3.6</td>
<td>2.4</td>
<td>Family Comedy Adventure</td>
</tr>
<tr>
<th>9</th>
<td>The Twilight Saga: Breaking Dawn - Part 2</td>
<td>7.6</td>
<td>5.2</td>
<td>2.4</td>
<td>Fantasy Drama Adventure</td>
</tr>
<tr>
<th>10</th>
<td>Transformers</td>
<td>8.2</td>
<td>5.8</td>
<td>2.4</td>
<td>Sci-Fi Adventure Action</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="-Movies-Critics-Love-More-Than-Audiences-"><center> Movies Critics Love More Than Audiences </center><a class="anchor-link" href="#-Movies-Critics-Love-More-Than-Audiences-">¶</a></h1><p>What about the reverse? What are the top 10 movies critics rate higher than audiences?</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [11]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="n">bot10_table</span> <span class="o">=</span> <span class="n">print_mov</span><span class="o">.</span><span class="n">sort_values</span><span class="p">(</span><span class="s1">'Difference'</span><span class="p">,</span> <span class="n">ascending</span><span class="o">=</span><span class="kc">True</span><span class="p">)[</span><span class="mi">0</span><span class="p">:</span><span class="mi">10</span><span class="p">]</span>
<span class="n">bot10_table</span><span class="o">.</span><span class="n">index</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">11</span><span class="p">)</span>
<span class="n">bot10_table</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[11]:</div>
<div class="output_html rendered_html output_subarea output_execute_result">
<div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>Title</th>
<th>Audience Score</th>
<th>Critic Score</th>
<th>Difference</th>
<th>Genres</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<td>King Kong</td>
<td>5.6</td>
<td>7.7</td>
<td>-2.1</td>
<td>Drama Adventure Action</td>
</tr>
<tr>
<th>2</th>
<td>E.T. the Extra-Terrestrial</td>
<td>7.0</td>
<td>9.1</td>
<td>-2.1</td>
<td>Sci-Fi Family Western</td>
</tr>
<tr>
<th>3</th>
<td>Rocky</td>
<td>6.4</td>
<td>8.3</td>
<td>-1.9</td>
<td>Sport Drama</td>
</tr>
<tr>
<th>4</th>
<td>Toy Story</td>
<td>7.4</td>
<td>9.0</td>
<td>-1.6</td>
<td>Comedy Animation Adventure</td>
</tr>
<tr>
<th>5</th>
<td>Toy Story 2</td>
<td>7.0</td>
<td>8.6</td>
<td>-1.6</td>
<td>Comedy Animation Adventure</td>
</tr>
<tr>
<th>6</th>
<td>Shakespeare in Love</td>
<td>6.8</td>
<td>8.3</td>
<td>-1.5</td>
<td>Romance Drama Comedy</td>
</tr>
<tr>
<th>7</th>
<td>The Incredibles</td>
<td>6.8</td>
<td>8.3</td>
<td>-1.5</td>
<td>Animation Adventure Action</td>
</tr>
<tr>
<th>8</th>
<td>The Terminator</td>
<td>7.2</td>
<td>8.7</td>
<td>-1.5</td>
<td>Sci-Fi Action</td>
</tr>
<tr>
<th>9</th>
<td>Titanic</td>
<td>6.6</td>
<td>8.0</td>
<td>-1.4</td>
<td>Romance Drama</td>
</tr>
<tr>
<th>10</th>
<td>Close Encounters of the Third Kind</td>
<td>7.4</td>
<td>8.8</td>
<td>-1.4</td>
<td>Sci-Fi Drama</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Again, I have to say, I think I like the critics' tastes better than the audience (though if this data set contained <em>La La Land</em>, that might be different).</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="Conclusion"><center>Conclusion</center><a class="anchor-link" href="#Conclusion">¶</a></h1><p>I had hoped that my science fiction films would be vindicated as being good movies as long as you were one of the people who 'got it', and in that sense this project backfired. Instead I've discovered that the same argument I was planning on using to defend my beloved genre actually works better as a defense of Twilight.</p>
<h2 id="Update:-I've-written-an-addendum-to-this,-looking-at-the-data-after-normalizing-it-(taking-into-account-the-bias-of-the-critics/audiences)"><a href="https://tommyblanchard.com/movie-genre-ratings-addendum">Update: I've written an addendum to this, looking at the data after normalizing it (taking into account the bias of the critics/audiences)</a><a class="anchor-link" href="#Update:-I've-written-an-addendum-to-this,-looking-at-the-data-after-normalizing-it-(taking-into-account-the-bias-of-the-critics/audiences)">¶</a></h2>
</div>
</div>
</div>
<script type="text/javascript">if (!document.getElementById('mathjaxscript_pelican_#%@#$@#')) {
var mathjaxscript = document.createElement('script');
mathjaxscript.id = 'mathjaxscript_pelican_#%@#$@#';
mathjaxscript.type = 'text/javascript';
mathjaxscript.src = '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
mathjaxscript[(window.opera ? "innerHTML" : "text")] =
"MathJax.Hub.Config({" +
" config: ['MMLorHTML.js']," +
" TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'AMS' } }," +
" jax: ['input/TeX','input/MathML','output/HTML-CSS']," +
" extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']," +
" displayAlign: 'center'," +
" displayIndent: '0em'," +
" showMathMenu: true," +
" tex2jax: { " +
" inlineMath: [ ['$','$'] ], " +
" displayMath: [ ['$$','$$'] ]," +
" processEscapes: true," +
" preview: 'TeX'," +
" }, " +
" 'HTML-CSS': { " +
" styles: { '.MathJax_Display, .MathJax .mo, .MathJax .mi, .MathJax .mn': {color: 'black ! important'} }" +
" } " +
"}); ";
(document.body || document.getElementsByTagName('head')[0]).appendChild(mathjaxscript);
}
</script>
Unique Tag Cloud for Each Category in Pelican2017-02-15T17:51:29-05:002017-02-15T17:51:29-05:00Tommy Blanchardtag:tommyblanchard.com,2017-02-15:/unique-tag-cloud-for-each-category-in-pelican<p><a href="http://docs.getpelican.com/en/stable/">Pelican</a> allows you to put articles into different 'categories'. On this site, I have the <a href="http://tommyblanchard.com/category/blog">Blog</a> and <a href="http://tommyblanchard.com/category/projects">Projects</a> categories. I wanted 'Projects' to be able to function as a portfolio. Ideally, it would have a tag cloud to allow someone to see all the different tools I've used for different …</p><p><a href="http://docs.getpelican.com/en/stable/">Pelican</a> allows you to put articles into different 'categories'. On this site, I have the <a href="http://tommyblanchard.com/category/blog">Blog</a> and <a href="http://tommyblanchard.com/category/projects">Projects</a> categories. I wanted 'Projects' to be able to function as a portfolio. Ideally, it would have a tag cloud to allow someone to see all the different tools I've used for different projects, and easily find projects that involved the tools they're interested in.</p>
<p>By default, Pelican does not have a tag cloud. In recent versions, <a href="http://docs.getpelican.com/en/stable/faq.html#my-tag-cloud-is-missing-broken-since-i-upgraded-pelican">they've taken the tag cloud functionality out of the main program</a> and put it into <a href="https://github.com/getpelican/pelican-plugins/tree/master/tag_cloud">a plugin</a>. However, the plugin counts all tags across all articles, meaning my 'Blog' tags would be mixed in with the 'Projects' tags. I ended up needing to modify the plugin to get the functionality I wanted. Instructions in case you want to do the same thing are below.</p>
<h1>Set up</h1>
<p>Since I modified the base tag_cloud plugin, the set up is very similar to that described on the official <a href="https://github.com/getpelican/pelican-plugins/tree/master/tag_cloud">tag cloud plugin page</a>. First, <strong>pelicanconf.py</strong> needs to be modified to look for the tag cloud plugin. If this is your first plugin, you should simply add these lines:</p>
<div class="highlight"><pre><span></span><span class="n">PLUGIN_PATHS</span> <span class="o">=</span> <span class="p">[</span><span class="ss">"plugins"</span><span class="p">]</span>
<span class="n">PLUGINS</span> <span class="o">=</span> <span class="p">[</span><span class="ss">"tag_cloud"</span><span class="p">]</span>
</pre></div>
<p>Otherwise, just add "tag_cloud" to your current PLUGINS list.</p>
<p>Next, you'll need the tag_cloud.py file, and need to place it in your plugins folder. You can download my version of tag_cloud.py from the <a href="https://github.com/TommyBlanchard/pelican-plugins/tree/master/tag_cloud">github repo</a>.</p>
<p>The basic change from the original script is that instead of having a tag_cloud structure with just a list of the tags, tag_cloud is a dictionary with each key being a category and each value being a tag list. The hard part is that Pelican doesn't allow you to use dictionaries in its templates - it converts everything to a list. For clarity, I change the dictionary to a list before passing it to the generator. In the templates I use Jinga2 to loop through all of the entries and find the matching category, like an inefficient dictionary, as explained below.</p>
<h1>Displaying the tag cloud</h1>
<p>To display the tag clouds is a little more complicated than with the basic plugin. You probably don't want to tag clouds showing up on every page - I only wanted them on the category pages themselves, article pages, and tags pages.</p>
<p>The different themes all have similar structures, but some might be a bit different. I use the <a href="https://github.com/blueicefield/pelican-blueidea">blueidea theme</a>.</p>
<p>To have the tag list for a category appear on article pages, the following code should be added <strong>article.html</strong>:</p>
<div class="highlight"><pre><span></span><span class="o"><</span><span class="nv">div</span> <span class="nv">id</span><span class="o">=</span><span class="s2">"</span><span class="s">tagcloud</span><span class="s2">"</span><span class="o">></span>
{<span class="o">%</span> <span class="k">for</span> <span class="nv">cat</span> <span class="nv">in</span> <span class="nv">tag_cloud</span> <span class="o">%</span>}
{<span class="o">%</span> <span class="k">if</span> <span class="nv">article</span>.<span class="nv">category</span> <span class="o">==</span> <span class="nv">cat</span>.<span class="mi">0</span> <span class="o">%</span>}
<span class="o"><</span><span class="nv">b</span><span class="o">><</span><span class="nv">center</span><span class="o">></span>{{ <span class="nv">cat</span>.<span class="mi">0</span> }} <span class="nv">Tags</span><span class="o"></</span><span class="nv">center</span><span class="o">></</span><span class="nv">b</span><span class="o">></span>
<span class="o"><</span><span class="nv">ul</span> <span class="nv">class</span><span class="o">=</span><span class="s2">"</span><span class="s">tagcloud</span><span class="s2">"</span><span class="o">></span>
{<span class="o">%</span> <span class="k">for</span> <span class="nv">tag</span> <span class="nv">in</span> <span class="nv">cat</span>.<span class="mi">1</span> <span class="o">%</span>}
<span class="o"><</span><span class="nv">li</span> <span class="nv">class</span><span class="o">=</span><span class="s2">"</span><span class="s">tag-{{ tag.1 }}</span><span class="s2">"</span><span class="o">></span>
<span class="o"><</span><span class="nv">a</span> <span class="nv">href</span><span class="o">=</span><span class="s2">"</span><span class="s">{{ SITEURL }}/{{ tag.0.url }}</span><span class="s2">"</span><span class="o">></span>
{{ <span class="nv">tag</span>.<span class="mi">0</span> }}
{<span class="o">%</span> <span class="k">if</span> <span class="nv">TAG_CLOUD_BADGE</span> <span class="o">%</span>}
<span class="o"><</span><span class="nv">span</span> <span class="nv">class</span><span class="o">=</span><span class="s2">"</span><span class="s">badge</span><span class="s2">"</span><span class="o">></span><span class="ss">(</span>{{ <span class="nv">tag</span>.<span class="mi">2</span> }}<span class="ss">)</span><span class="o"></</span><span class="nv">span</span><span class="o">></span>
{<span class="o">%</span> <span class="k">endif</span> <span class="o">%</span>}
<span class="o"></</span><span class="nv">a</span><span class="o">></span>
<span class="o"></</span><span class="nv">li</span><span class="o">></span>
{<span class="o">%</span> <span class="nv">endfor</span> <span class="o">%</span>}
<span class="o"></</span><span class="nv">ul</span><span class="o">></span>
{<span class="o">%</span> <span class="k">endif</span> <span class="o">%</span>}
{<span class="o">%</span> <span class="nv">endfor</span> <span class="o">%</span>}
<span class="o"></</span><span class="nv">div</span><span class="o">></span>
</pre></div>
<p>The placement of the code depends a bit on how you plan to style it and where you want it to show up. I have mine near the top, right below <strong>{% block content %}</strong></p>
<p>To add the tag cloud to the tags and categories pages, the same code needs to be added to index.html. Place it within the first item conditional, right after this:</p>
<div class="highlight"><pre><span></span>{# <span class="nv">First</span> <span class="nv">item</span> #}
{<span class="o">%</span> <span class="k">if</span> <span class="k">loop</span>.<span class="nv">first</span> <span class="nv">and</span> <span class="nv">not</span> <span class="nv">articles_page</span>.<span class="nv">has_previous</span><span class="ss">()</span> <span class="o">%</span>}
</pre></div>
<p>This will take the category of the first article appearing on the page and generate the appropriate category tag cloud.</p>
<h1>Settings and CSS Styling</h1>
<p>The tag cloud should now display, just not necessarily how you want or where you want.</p>
<p>The plugin allows you to have different sizes for tags based on how common they are. This can be altered by changing the TAG_CLOUD_STEPS value (default is 4, you can set TAG_CLOUD_STEPS=num in <strong>pelicanconf.py</strong>). So use the following, adding as many li.tag-# as you have TAG_CLOUD_STEPS. You can also style the tag cloud list any way you want:</p>
<div class="highlight"><pre><span></span><span class="nt">ul</span><span class="p">.</span><span class="nc">tagcloud</span> <span class="p">{</span>
<span class="k">list-style</span><span class="p">:</span> <span class="kc">none</span><span class="p">;</span>
<span class="k">padding</span><span class="p">:</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
<span class="nt">ul</span><span class="p">.</span><span class="nc">tagcloud</span> <span class="nt">li</span> <span class="p">{</span>
<span class="k">display</span><span class="p">:</span> <span class="kc">inline-block</span><span class="p">;</span>
<span class="p">}</span>
<span class="nt">li</span><span class="p">.</span><span class="nc">tag-1</span> <span class="p">{</span>
<span class="k">font-size</span><span class="p">:</span> <span class="mi">150</span><span class="kt">%</span><span class="p">;</span>
<span class="p">}</span>
<span class="nt">li</span><span class="p">.</span><span class="nc">tag-2</span> <span class="p">{</span>
<span class="k">font-size</span><span class="p">:</span> <span class="mi">120</span><span class="kt">%</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
<p>You can also use CSS to style the div the tag appears in. Here is mine:</p>
<div class="highlight"><pre><span></span><span class="nt">div</span><span class="p">#</span><span class="nn">tagcloud</span><span class="p">{</span>
<span class="k">right</span><span class="p">:</span> <span class="mi">-150</span><span class="kt">px</span><span class="p">;</span>
<span class="k">top</span><span class="p">:</span> <span class="mi">250</span><span class="kt">px</span><span class="p">;</span>
<span class="k">position</span><span class="p">:</span> <span class="kc">absolute</span><span class="p">;</span>
<span class="k">width</span><span class="p">:</span> <span class="mi">140</span><span class="kt">px</span><span class="p">;</span>
<span class="k">background</span><span class="p">:</span> <span class="kc">white</span><span class="p">;</span>
<span class="k">border-radius</span><span class="p">:</span> <span class="mi">10</span><span class="kt">px</span> <span class="mi">10</span><span class="kt">px</span> <span class="mi">10</span><span class="kt">px</span> <span class="mi">10</span><span class="kt">px</span><span class="p">;</span>
<span class="kp">-moz-</span><span class="k">border-radius</span><span class="p">:</span> <span class="mi">10</span><span class="kt">px</span> <span class="mi">10</span><span class="kt">px</span> <span class="mi">10</span><span class="kt">px</span> <span class="mi">10</span><span class="kt">px</span><span class="p">;</span>
<span class="kp">-webkit-</span><span class="k">border-radius</span><span class="p">:</span> <span class="mi">10</span><span class="kt">px</span> <span class="mi">10</span><span class="kt">px</span> <span class="mi">10</span><span class="kt">px</span> <span class="mi">10</span><span class="kt">px</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
<p>(I have a fixed-width wrapper around everything including my tagcloud, so this positioning puts my sidebar just outside of the main content area)</p>
<p>Full list of settings and defaults (you can add these lines to pelicanconf.py and change whatever values you want. If they don't exist in pelicanconf.py the defaults will be used):</p>
<div class="highlight"><pre><span></span><span class="nv">TAG_CLOUD_STEPS</span><span class="o">=</span><span class="mi">4</span> #<span class="nv">number</span> <span class="nv">of</span> <span class="nv">different</span> <span class="nv">sizes</span> <span class="nv">of</span> <span class="nv">fonts</span> <span class="nv">in</span> <span class="nv">the</span> <span class="nv">tag</span> <span class="nv">cloud</span>
<span class="nv">TAG_CLOUD_MAX_ITEMS</span><span class="o">=</span><span class="mi">100</span> #<span class="nv">number</span> <span class="nv">of</span> <span class="nv">different</span> <span class="nv">tags</span> <span class="nv">that</span> <span class="nv">can</span> <span class="nv">appear</span> <span class="nv">in</span> <span class="nv">tag</span> <span class="nv">cloud</span>
<span class="nv">TAG_CLOUD_SORTING</span><span class="o">=</span><span class="s1">'</span><span class="s">size</span><span class="s1">'</span> #<span class="nv">how</span> <span class="nv">tags</span> <span class="nv">will</span> <span class="nv">be</span> <span class="nv">ordered</span> <span class="nv">in</span> <span class="nv">the</span> <span class="nv">tag</span> <span class="nv">cloud</span>. <span class="nv">Valid</span> <span class="nv">values</span>: <span class="k">random</span>, <span class="nv">alphabetically</span>, <span class="nv">alphabetically</span><span class="o">-</span><span class="nv">rev</span>, <span class="nv">size</span> <span class="nv">and</span> <span class="nv">size</span><span class="o">-</span><span class="nv">rev</span>
<span class="nv">TAG_CLOUD_BADGE</span><span class="o">=</span><span class="nv">True</span> #<span class="k">If</span> <span class="nv">True</span>, <span class="nv">displays</span> <span class="nv">the</span> <span class="nv">number</span> <span class="nv">of</span> <span class="nv">articles</span> <span class="nv">in</span> <span class="nv">each</span> <span class="nv">tag</span>
</pre></div>
<h1>Known issues</h1>
<p>If you have overlap in the tags used between the two categories, the page for that tag will give the tag cloud for whatever the first article on the page is for that tag.</p>
<p>Since I used the same names as for the basic tag cloud plugin, this is not compatible with the base tag cloud.</p>
<p>If this somehow becomes popular, I might try to make this plugin a bit more official - giving it a unique name, adding some tests, and creating a tagcloud.html file that just gets included instead of copying and pasting the same code to two separate locations. So if you're using the plugin (or interested in it), let me know! Right now I only put in enough work to get it working for myself.</p>Reasons I left academia2017-02-12T00:00:00-05:002017-02-12T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2017-02-12:/reasons-i-left-academia<p>I recently made the transition from academia to industry. Some people were surprised I decided to leave - I had had a pretty successful academic career. So why did I want to leave? I've read a lot of articles and opinions on reasons people leave academia. The common reasons I often …</p><p>I recently made the transition from academia to industry. Some people were surprised I decided to leave - I had had a pretty successful academic career. So why did I want to leave? I've read a lot of articles and opinions on reasons people leave academia. The common reasons I often saw people cite for why they decided to leave didn't resonate with me. It's usually things like that the academic job market is too tough, or that industry pays better. The better pay is certainly nice, but that wasn't an impetus for my switch. I had never really worried about the job market. So why did I decide to leave?</p>
<h2>Becoming unhappy in academia</h2>
<p>I was pretty happy during my PhD. I learned a lot throughout it, got a lot of positive feedback, felt respected, and interacted with my peers a lot. Even so, by my last year, and especially after starting my postdoc, I was slowly becoming less satisfied. Eventually I was just not happy. I became stressed out, and research wasn't fun anymore.</p>
<p>One day I was describing my work environment to my roommate who works in industry. I told him I had maybe one to three meetings with people throughout the week. I explained that during my day, I mostly was by myself in an office. He said that sounded like it really sucked. That off-hand comment was actually really eye-opening to me. It had never occurred to me that working in such isolation probably wasn't good for me. It seemed just like the natural process of becoming more independent would of course mean more isolation.</p>
<p>As a postdoc or a grad student, it would often just be me and my advisor on a project. If my advisor was busy (frequently the case), it meant I was alone on the project. If others were involved in the project, in my experience their involvement was pretty superficial and communications usually occurred via email, or meetings once every month or two. It really didn't feel like I had anyone 'with me' on solving issues on a project, which was stressful. More importantly, I felt lonely.</p>
<p>Talking to other friends in industry reinforced the impression that it was much less isolating to work in industry than in research. They talked about frequent code-reviews and stand-up meetings. Since project turn-around was much quicker, project meetings were much more frequent. There was always a lot of interaction going on.</p>
<h2>Few reasons to stay</h2>
<p>After I had pinpointed why I was feeling so unhappy, I did a lot of soul-searching on why I was so set on an academic career in the first place.</p>
<p>Supposedly the big advantages of academia are the intellectual satisfaction of research and the freedom to research what you want. However, I didn't feel intellectually satisfied. Science works slowly, with incremental advances. Every paper I wrote was just one interpretation of one small data set about what one small brain area did in one contrived task. I was familiar with the big theories in my field, and there wasn't any new big ideas that were exciting me any more. Intellectually, focusing on such a narrow space of science was just becoming boring.</p>
<p>The intellectual freedom didn't sound that exciting to me anymore. Sure, I could set up a wide range of different experiments, except 1) they had to be in line with a fundable research plan, and 2) they had to lead to publications. It seemed more like pressure to come up with good ideas than freedom to do what I want.</p>
<p>I'm a bit ashamed to admit that for me, the factor that made the decision difficult was the level of fame and prestige that comes with being an academic researcher. It's nice to have your name on a bunch of publications, to get some media attention, and have international colleagues that respect you.</p>
<h2>Costs of staying</h2>
<p>My growing unhappiness forced me to really face the sacrifices I was making by staying in academia. The biggest issue for me was the cost to my personal relationships. Academia meant moving at the whims of the academic job market - due to how few jobs there are, there's little freedom in where you live geographically. Already the moves I had done for academia had cost me important relationships. There was also putting off thinking about starting a family because I didn't feel like my life was stable enough to start one.</p>
<h2>Deciding to leave</h2>
<p>I think there's a big disconnect in mentality between academia and industry because they offer very different types of rewards. In academia, all of the metrics you have for how well you're doing don't exist in industry: publications, citations, H-index, etc. Until I really started to feel the cost of academia in terms of my happiness, I never felt the allure of industry because it didn't offer me these rewards I had been trained to seek through my academic training. Similarly, it was easy to ignore the income one could make in industry because money isn't one of the big motivators in academia since (at least at the postdoc level) everyone is making about the same low amount.</p>
<p>Once I was forced to really open my eyes to the possibility of leaving, suddenly I had to consider what an industry job could offer me. It was painful going through the process of changing my mentality and accepting that I might never get another publication, but that was okay because publications only mean anything in academia.</p>
<p>Eventually I started learning more about data science. I learned how it would allow me to work with different data, do the parts of science I love (analysis), and give me freedom to find jobs I wanted. I thought it sounded like a much better place for me. Hopefully that judgment was right!</p>
<h3>Update</h3>
<p>I wrote a retrospective on my first few months in industry and how I feel now about the move from academia. See it <a href="http://tommyblanchard.com/retrospective-on-leaving-academia-for-industry-data-science">here</a>.</p>Simple Stock Ticker App2017-02-04T15:14:21-05:002017-02-04T15:14:21-05:00Tommy Blanchardtag:tommyblanchard.com,2017-02-04:/simple-stock-ticker-app<p>This was just a very simple learning project I did as part of <a href="https://www.thedataincubator.com/">The Data Incubator</a> program.</p>
<p>The project itself was just a simple stock ticker. It requires as input the ticker, and produces a graph of the stock prices over time. <a href="http://day8blanchard.herokuapp.com/index">Here is the finished product</a>. You can also …</p><p>This was just a very simple learning project I did as part of <a href="https://www.thedataincubator.com/">The Data Incubator</a> program.</p>
<p>The project itself was just a simple stock ticker. It requires as input the ticker, and produces a graph of the stock prices over time. <a href="http://day8blanchard.herokuapp.com/index">Here is the finished product</a>. You can also see the code for it <a href="https://github.com/TommyBlanchard/FlaskHerokuStockTicker">here</a>.</p>
<h3>Flask Framework</h3>
<p><a href="http://flask.pocoo.org/">Flask</a> is a lightweight Python framework. It's pretty simple to use. Set up some template html files, define some GET and POST methods, and you're good to go.</p>
<p>The Data Incubator provded <a href="https://github.com/thedataincubator/flask-demo">a pretty simple template</a> for getting started. It provided some sample files, but the app itself just returned whatever the index template was.</p>
<p>The modified the template to have two pages: the index page, which just has a GET command, and a graph page, which has POST.</p>
<p>On the index page, the user inputs the ticker they want. This is used in the POST command, which requests and then plots the data.</p>
<h3>Requesting Data</h3>
<p>The data I used for my stock ticker came from <a href="https://blog.quandl.com/api-for-stock-data">Quandl</a>. I used Python's <a href="http://docs.python-requests.org/en/master/">Requests</a> library to make API requests.</p>
<h3>Plotting Data</h3>
<p>After requesting the data and getting it into a usable format, I plotted it using <a href="http://bokeh.pydata.org/en/latest/">Bokeh</a>.</p>
<p>Overall I really like Bokeh - some things are easier to do in Bokeh than in either Seaborn or matplotlib. But it definitely isn't perfect, and some things that feel like they should be trivial end up being more work than you would expect.</p>
<p>But the real power of Bokeh is that the figures it produces can be output into javascript format so they can easily be placed into a website. So the code for the Bokeh figure is easily just placed into the graph.html template as javascript code, and it appears, all while staying in Python world.</p>This Website2017-01-18T10:04:08-05:002017-01-18T10:04:08-05:00Tommy Blanchardtag:tommyblanchard.com,2017-01-18:/this-website<p>I felt it was fitting to write the first "Project" article on this website, since it's the most recent little project I've been working on.</p>
<h3>Choosing a framework</h3>
<p>I was looking for a few things in a website: Something easily customizable, easily publishable, capable of blog feeds, and that could …</p><p>I felt it was fitting to write the first "Project" article on this website, since it's the most recent little project I've been working on.</p>
<h3>Choosing a framework</h3>
<p>I was looking for a few things in a website: Something easily customizable, easily publishable, capable of blog feeds, and that could easily incorporate Jupyter Notebooks directly into it.</p>
<p>Looking around, it seemed the best fit for the job were static site generators. Static site generators are just programs that take a bunch of content, your settings and templates/stylesheets, and create static HTML files. Static site generators are simple to use, easy to customize, don't require some awkward web UI, and publishing is extremely fast and doesn't even require me to visit a website. They also have the advantage of being fast compared to any dynamic websites since the server just has to serve a plain HTML page. There are a few other advantages to them - <a href="https://davidwalsh.name/introduction-static-site-generators">I found this a helpful read</a>.</p>
<p>With a static site generator, I can easily write an article in Markdown. Then with a couple simple terminal commands I can have it publish to the site.</p>
<h3>Choosing a static site generator</h3>
<p>It turns out <a href="https://jekyllrb.com/">Jekyll</a> is the most popular static site generator. That means it has the advantage of the biggest community of support. However, there were two major disadvantages for me. </p>
<p>First, Jekyll is written in Ruby. I'm not very familiar with Ruby, and don't currently have any reason to learn it (besides for Jekyll). This means if I wanted to dig into the code to customize things, it would be a big pain. </p>
<p>Second, Jekyll doesn't have easy support for Jupyter Notebooks. I want to be able to do some data exploration in a Jupyter Notebook, and then just upload the notebook as an article easily. While it is <a href="http://briancaffey.github.io/2016/03/14/ipynb-with-jekyll.html">possible to post Jupyter Notebooks with Jekyll</a>, it isn't supported natively and takes extra steps.</p>
<p>After doing some research, I ended up deciding on <a href="http://docs.getpelican.com/en/stable/">Pelican</a>. Pelican is written in Python, my preferred language. With <a href="https://github.com/danielfrg/pelican-ipynb">a simple plugin</a>, publishing Jupyter Notebooks becomes almost as easy as publishing Markdown - a separate file needs to be created for the metadata. Making changes to notebooks and then republishing becomes trivial, and life is easy.</p>
<h3>Website host</h3>
<p>After I had figured out how I was going to create my website, I had to choose a place to put it. This was a no-brainer. Because I'm using a static website, I don't need any fancy server support. <a href="https://pages.github.com/">Github Pages</a> is free and allows me to change my site just by pushing to a Github repo. It also allows custom URLs (though not with HTTPS currently). So the whole process for publishing an article is: write Markdown or Jupyter Notebook, run pelican to generate the site pages, commit and push to Github. Super easy and quick!</p>
<p>If you're looking for a tutorial on how to set up your own Github hosted Pelican website, <a href="https://www.dataquest.io/blog/how-to-setup-a-data-science-blog/">this tutorial</a> is super helpful.</p>Hello, world!2017-01-16T00:00:00-05:002017-01-16T00:00:00-05:00Tommy Blanchardtag:tommyblanchard.com,2017-01-16:/hello-world<p>My first post, introducing my new blog</p><p>As of this writing, I'm in the middle of the transition from academia to industry data science. This website is meant partially to replace my academic website. It's also a place for me to showcase some of my personal data science projects. I'll probably be starting with some of the small projects I've done while building up some of my data science skills, and hopefully eventually be releasing some more polished projects.</p>
<p>I also intend to write blog entries (like this one). While my projects will tend to be something that involved coding, learning a new skill, and/or exploring a data set, blog entries will just be free-form writing. I mostly intend to write about data science, statistics, science, and related things. Because I've so recently come from academia, I expect many will focus on the difference between academia and industry, and the transition. And sometimes maybe I'll write about things completely unrelated.</p>
<p>This site is still somewhat under construction, and the organization of it might change quite a bit as it grows/matures.</p>
<p>If you want to read about the technical aspect of the blog (what tools I'm using and why), see <a href="https://tommyblanchard.com/this-website">this post</a>.</p>