If you think La La Land's ending is despairing, you are not alone. I watched the first half of the movie thinking that it is another too-good-to-be-true kind of movie, until the movie finale slapped me back to reality. It turned out that other people are also having a debate over this issue. Some think that it was realistic and inspiring, but others were upset that Mia and Sebastian chose to chase their dreams over romance.

Regardless of whatever emotional state you were by the end the movie, you must agree that La La Land has done a good job playing with the audiences' emotion. Furthermore, the ups and downs of Mia and Sebastian's relationship is nicely accompanied by the use of music throughout the movie. It was, afterall, nominated and won the Best Original Score in both the Golden Globe and the Academy Awards.

Since the nominees in the Best Original Score category are typically selected by how well the film scores assisting the story of a movie, I now wonder if we can use La La Land's scores to measure the happiness level of its ending. Well, we might be able to, but now we have another question: how can we measure the happiness level of a song?

Luckily, Spotify provides a web API that allows you to pull audio features for a track, such as danceability, tempo, or energy. I have interest in one particular feature called valence, which I think might provide an answer to the question. Spotify defines this feature as

"A measure from 0.0 to 1.0 describing the musical positiveness conveyed by a track. Tracks with high valence sound more positive (e.g. happy, cheerful, euphoric), while tracks with low valence sound more negative (e.g. sad, depressed, angry)".

While Spotify does not explicitly describe how they come up with such value, they mention that it involves a manual classification by a music expert, followed by extending the classification rule to other songs using machine learning.

Following this, I collect the valence rating for songs used in La La Land, then plot each tracks' valence rating in a chronological order, the result of which you can see below. As you scroll down the page, you will observe changes in the emotional valence throughout the movie from the beginning to the end. I am neither an expert in music nor machine learning, but I think the plotted graph quite representing the fluctuation of my emotional state when watching the movie. How about you? Keep scrolling down to experience it yourself.

(WARNING: CONTAIN MAJOR SPOILER)