Canadian Federal Elections 2021: Top issues being discussed

The 44th Canadian Federal Elections are upon us and we thought it might be nice to take a look at the issues and topics which people most care about in hopes to better inform voters and the general public through additional insights.

It should be noted that 100% accuracy is not to be expected with this analysis as it requires the use of pre-trained machine learning models which may be trained on out-of-context data. However, it serves as a useful exercise in understanding the general topics of concern.

Collecting the election-related Tweets

The Think Luna Election Sentiment Tracker collects Tweets associated with specific keywords originating or being Retweeted in Canada. Here are the keywords used to filter Tweets pertaining the Canadian Federal Elections of 2021:

"Trudeau","Justin Trudeau", "Singh", "Jagmeet Singh", "O'Toole","Erin O'Toole", "Toole", "Election", "Federal","Liberal", "Liberal Party" ,"NDP","New Democrat","Conservative", "Green Party", "Bloc Québécois", "Yves-François Blanchet",  "Blanchet","Annamie Paul", "Annamie", "Elxn", "#Elxn44", "Bloc"

Got suggestions for additional keywords we should use? Let us know at!

We summarized our dataset of over 150,000 Tweets collected pertaining to the Canadian Elections (or keywords associated with them) to date to take a look at the 100 most popular Tweets between August 18th, 2021, and August 22, 2021. Note: This is considered a subset/sample of all the Tweets posted to Twitter.

Predicting the topics of Tweets using NLP techniques

To understand what people are talking about, we can either manually assign each Tweet to relevant categories, or use the power of Natural Language Processing to automate this for us. For our analysis, we used a classification method known as 'Zero-Shot Classification'.

Zero-Shot classification (aka Zero-shot learning) is a problem setup in machine learning, where at execution/testing time, a learner observes samples from categories that were not observed during the model training and needs to predict the category they belong to. Zero-shot methods generally work by associating observed and non-observed classes through some form of auxiliary information, which encodes observable distinguishing properties of objects. (source)

The pre-defined categories we used are as follows:

Housing, Healthcare, Environment, Climate, Economy, Taxes, Jobs, Expenses, Crime, Immigration, Government Spending, Foreign Policy, Education, Child Care, Women's Rights, Social Security, Drugs, Military

The following categories were also tested but later removed due to inaccurate predictions: 'Pipeline', 'Wages', 'Indigenous'. We will continue to update our labels to fine-tune our model. If you have any suggestions on categories to use, send us an email at!

With the categories defined, the model is now ready to be used.

NLP model details to perform Zero-shot classification

We used the "bart-large-mnli" model to determine all possible categories associated with each Tweet. This model was published by Facebook and is publically available to use (open source) on the Hugging Face platform. Link here.

The model generates the most likely predictions associated with each Tweet, along with a confidence score.

So, what are people talking about during the Canadian Elections?

Let's take a look at some Example Tweets and their outputs before we look at the summary of the most popular Tweets.

Example Tweet 1

Predictions for this Tweet are as follows

['healthcare',   'housing', 'expenses', 'economy', 'immigration', 'environment', 'government   spending', 'foreign policy', 'drugs', 'crime', 'jobs', 'military', 'climate',   'education', 'social security', 'child care', "women's rights",   'taxes']

[0.6212319731712341,   0.08278515934944153, 0.03590639680624008, 0.0276862233877182,   0.027670571580529213, 0.024388862773776054, 0.023929350078105927,   0.021886957809329033, 0.021016839891672134, 0.01736193709075451,   0.017208434641361237, 0.016788030043244362, 0.01524271909147501,   0.013216889463365078, 0.010471699759364128, 0.00952714029699564,   0.00715832132846117, 0.006522434763610363]

Example Tweet 2:

Predictions for this Tweet are as follows

["women's   rights", 'economy', 'healthcare', 'government spending', 'expenses',   'jobs', 'crime', 'military', 'drugs', 'environment', 'taxes', 'housing',   'social security', 'climate', 'foreign policy', 'immigration', 'child care',   'education']

[0.2356053739786148,   0.15956154465675354, 0.10540822893381119, 0.07487493753433228,   0.04646635055541992, 0.044557563960552216, 0.03779490292072296,   0.036101266741752625, 0.03250680863857269, 0.0315018855035305,   0.031124059110879898, 0.02911815047264099, 0.02910557948052883,   0.025844942778348923, 0.022986652329564095, 0.02063903957605362,   0.019742881879210472, 0.01705983839929104]

Example Tweet 3

Predictions for this Tweet are as follows

['economy',   'military', 'crime', 'expenses', 'climate', 'government spending', 'jobs',   'housing', 'drugs', 'environment', 'taxes', 'healthcare', 'social security',   'education', 'immigration', "women's rights", 'child care',   'foreign policy']

[0.5276657342910767,   0.0830773264169693, 0.07882670313119888, 0.0708206444978714,   0.03651272878050804, 0.030923033133149147, 0.026770800352096558,   0.0174118485301733, 0.01716202311217785, 0.017047962173819542,   0.01457216590642929, 0.013873796910047531, 0.012531268410384655,   0.012463963590562344, 0.011843481101095676, 0.011448369361460209,   0.010113479569554329, 0.006934696808457375]

As evident from these examples, after the first few predicted labels, the confidence of the predictions starts to decrease. Hence, we decided to take only the top 3 predictions (top 3 highest confidence scores) and assign them to the Tweets. The 4th predicted category and beyond are not allocated to the Tweets. Similarly, the remainder of the most popular Tweets were assigned similar predicted topics (up to 3 per Tweet).

The result of this exercise applied to the 100 most popular Tweets collected is shown below.

Here's what the most popular Tweets are about during the Canadian Elections

Topics discussed in Canadian election-related Tweets

It seems that the Economy, Crime, and Healthcare seem to be top of mind of Canadians during these elections. Do you agree with our findings and the approach we took? Are there other insights you'd like to see? Leave us a comment below or reach out to us on Twitter @ThinkLunaCA.

Like our analysis? Share it with your friends, family, and colleagues! Subscribe to our newsletter and follow our social accounts to stay up to date with new analyses like these!

92 views0 comments