• Shounak Mondal

Sentiment Analysis

Updated: Dec 31, 2020

In this article, I will perform sentiment analysis of movie reviews from the IMDB Database on Kaggle.


Step 1: Load the data

Step 2 : Perform train test split

Step 3 : Create a pipeline with CountVectoriser and LogisticRegression

Step 4 : Hyperparameter optimisation with RandomSearchCV

Step 5 : Fit the best estimator

Step 6 : Extract words that are most indicative of a positive and negative review

Step 7 : Extract the review with highest predicted probability of being negative and positive


Model can be used to predict sentiment of any movie review based on the learning from IMDB Movies Dataset


With associated probability score of:  0.9999989498597482 
the review with highest predicted probability of being negative is: 

 Plankton, or Creatures from the Abyss as I'm positive it's more commonly known as & filmed under as the title Creatures from the Abyss appears over a moving image & in the same font type as the rest of the credits, starts with five 20 something kids, Mike (Clay Rogers) his girlfriend Margaret (Sharon Twomey), sisters Julie (Ann Wolf) & Dorothy (Loren DePalm) & an annoying idiot named Bobby (Michael Bon) whom decide to all fit into a small rubber boat & head out to sea, don't ask why as I don't know. Oh & the complete idiot Bobby left the petrol behind & never thought to tell anyone so it comes as no great surprise that they end up stranded out at sea without any petrol for the motor & to make matters worse they become trapped in a thunder storm & discover a dead body floating in the water. Shortly after their luck seems to change when they come across a yacht & potential safety, in a flash everyone boards the yacht & begin to explore. First of all they find a scientific lab with various fish specimens & computer equipment, then down below they find fully furnished & luxurious cabins. They find a chemist (Deran Sarafian) who appears mad & can't talk. They eat fish from the fridge which makes Dorothy puke up green vomit, beetles & slugs. They learn that these fish are living fossil's 1000's of years old & have been contaminated by toxic waste dumped in the sea & that they fly, mutate, bite & are generally unpleasant to be around. I really can't be bothered to go on with this plot outline so I won't, here's what I think...<br /><br />This Italian production was produced & directed by Massimiliano Cerchi under the pseudonym Al Passeri (I'd hide under a different name if I made a film this bad too) & I think Plankton is quite simply one of the worst films ever, there are so many things wrong with this film it's difficult to know where to start. First the script by Richard Baumann is total crap, it makes no sense whatsoever & is so slow & dull it was torture for me to sit through. Why would five people just simply set sail for the middle of the ocean on a rubber dinghy barely big enough to fit them all in? What were they planning on doing exactly? Why do we often get point-of-view shots from these fish creatures but they seem to be totally invisible to the characters as they are never shown on screen even though they are right next to a character, & how do these fish get around the boat as there is no water for them to swim in? People's actions & reactions to things are all wrong, they constantly split up, they make bizarre decisions that simply don't make any sense in the situation they find themselves in & some of the dialogue is as awful as anything I've heard. I could go on all day about all the plot holes & ridiculous goings on but I'll run out of space if I do. The fish creatures themselves look awful, a mixture of rubbish rubber puppets & some really bad stop motion animation at the end, the scenes where they interact with the human cast also look terrible with some bad super imposition. I have heard a lot of comments saying that Plankton is gory, don't make me laugh! Forget it there is virtually no blood or gore in Plankton whatsoever, there are a couple of slimy scenes when Bobby transforms into a fish monster while having sex with Julie but it's pretty brief & he doesn't kill her, he just sort of drips slime on her, grows a couple of tentacles & a fish head comes out of his mouth. Later on Julie's vagina starts to drip some dark slime but that's it, we never get to actually see what happens to her or what the slime is. Dorothy has a fish creature come out of her back, off screen, & control her but again we never get to see what happens to her while Margaret commits suicide, a very brief shot of a plastic harpoon stuck to her forehead. Easily the grossest scene is when Dorothy pukes up that green stuff with what looks like beetles & slugs in it. That's it, only one person actually dies on screen & for the most part Plankton is quite tame & as exciting as watching paint dry & I nearly fell asleep it's so boring. I can't see how anybody can like this total crap, I just can't. The acting is awful, the dubbing is awful, the characters are awful & I hated all of them. Tecnically Plankton is predictably crap as well, with an estimated budget of only $250,000 all I can say is where did the money go? The sets are monotonous & dull with one lab & a few cabins, the special effect's are bottom of the barrel stuff including the most fake looking exploding boat ever, the cinematography is bland, the music sucks there is zero atmosphere or tension & as a whole Plankton, like it's name sake, is as low in the food chain as it could possibly be. I hate Plankton, it's awful in every single aspect of it's overlong 86 minute duration. Do yourself a favour & avoid this one at all costs unless your either a masochist or insomniac.

With associated probability score of:  0.9999879729486912 
the review with highest predicted probability of being positive is: 

 I am beginning to see a very consistent pattern form in the identity of 2007's films. If 2004 was the year of the biographies and 2005 was the year of the political films, 2007 can be identified as a year featuring a wide plethora of morality tales, films that portray, test, challenge and question human morality and the motives that drive us to do certain things. Although this identification is rather broad, I think that there are a handful of films released this year, such as 3:10 To Yuma, Eastern Promises, American Gangster, No Country for Old Men and others that specifically question and study human morals and the motives that drive us to acts such as violence or treachery. Before the Devil Knows You're Dead is a deviously stylish morality tale, and quite a dark, bleak and depressing one at that. And even better is the fact that it comes from one of the greatest classic directorial forces of our time, the legendary Sidney Lumet, who many have said has passed his prime but returns in full force with this viciously rich crime thriller.<br /><br />It's one of those films whose plots are so thick, that one is very reluctant to go into details. It is a movie that is best enjoyed if entered without any prior knowledge to the events about to unfold, as there are twists and turns. But the thick and richly wrought plot is not at all at the center of this film; the true focus is, as I mentioned, the morality tale; the motives that drive these two men to the actions they do in the film. In a plot structured like a combination between the filmographies of both The Coen Brothers (namely Blood Simple and Fargo) and Quentin Tarantino, we see two men driven under various shady circumstances to pull off a fairly simple crime that goes incredibly, ridiculously wrong, and reciprocates with full force and inevitable tragedy. And to make it all the more interesting, the film is told in a fragmented chronology that keeps back tracking and showing a series of events following a different character every time and always ending up where it left off the last time. Sizzling, sharp, thick and precariously depressing, Kelly Masterson's screenplay is surprisingly poignant and well rounded, in particular because it is a debut screenplay.<br /><br />But the film has much more going for it than just it's delectably sinister and quite depressing plot. First and foremost, the picture looks and feels outstandingly well. Sidney Lumet has, throughout his career, consistently employed an interesting style of cinematography and lighting: naturalistic and yet stylish at the same time. The film carries with it a distinctive air of style and class, with wonderful natural lighting that just looks really great. Editing is top-notch; combining the sizzling drama-thriller aspect with great long takes that really take their time to portray the action accordingly. And vivid, dynamic camera angles and movements further add to the style. The film is also backed by a fantastically succulent musical score by Carter Burwell.<br /><br />The screenplay does its part, and of course Lumet does his part, but at the film's dramatic center are three masterful actors who deliver incredibly good performances. First and foremost, there are the two leads. Leading the pack is Philip Seymour Hoffman, who has always been an excellent actor but has stumbled upon newfound leading-man status after his unnaturally fantastic Oscar-winning performance in Capote. His turn in this film is fascinating: severely flawed, broken, manic. Hoffman has some truly intense scenes in the film that really allow his full dramatic fury to come out, and not just his subtlety and wit. At his side is Ethan Hawke, who has delivered some fantastic performances in many films that are almost always overshadowed by greater, grander actors. Here, he bounces off Hoffman and complements him so incredibly well; in all, the dynamic acting between the two of them is just so utterly fantastic and convincing, the audience very quickly loses itself in the characters and forgets that it's watching actors. And then there's Albert Finney. Such a supple, opulent supporting role like the one he has requires a veteran professional and here Finney delivers his finest performance in many years as the tragically obsessed father to the two brothers who get caught up in the crime. I love how the dynamics between the three of them play out. I love how Hoffman is clearly the dominant brother and shamelessly picks on his younger brother even now that they're middle-aged men; and yet despite this, it is clear how Finney's father favours Hawke's younger, weaker brother. Also on the topic of the cast, the two supporting female characters Â? wives of the brothers Â? also feature fantastic performances from Amy Ryan and Marisa Tomei, whose looks just get better and better as the years go by.<br /><br />This film isn't revolutionary. These themes and this style have already been explored by the likes of The Coen Brothers, and it's very easy to imagine them directing this film. But for a film that treads familiar ground, it simply excels. Lumet employs his own immense directorial talent and employs his unique and very subtle sense of irony and style to Masterson's brilliantly vivid, intense, and morbidly depressing first-time screenplay. The lead performances are incredibly intense and the film features absolutely fantastic turns from Hoffman, Hawke and Finney; but the truly greatest wonder of the film is that three years after he won a Lifetime Achievement Oscar, much revered as the ultimate sign of retirement in the film business, Sidney Lumet proves that he still has the immense talent to deliver a truly wonderful, resonant, intense piece of cinema reminiscent of his golden years.

iPython Notebook in Github Repo

12 views0 comments

Recent Posts

See All