Principles of good communicaiton
Grid search activity
Go to this Google doc: https://tinyurl.com/5n8xf5yj
Explanation 1: https://tinyurl.com/msk2cfkb
![]()
Explanation 2: https://tinyurl.com/mt2z9ey5
![]()
Discussion questions
- What do you like about each explanation?
- What do you dislike about each explanation?
- What do you think is the intended audience for each explanation?
- Which explanation do you think is more effective overall for someone on Day 1 of CPSC 330?
- Each explanation has an image. Which one is more effective? What are the pros/cons?
- Each explanation has some sample code. Which one is more effective? What are the pros/cons?
Concepts then labels, not the other way around
Explanation 1: Machine learning algorithms, like an airplane’s cockpit, typically involve a bunch of knobs and switches that need to be set.
Explanation 2: Grid search is the process of performing hyper parameter tuning in order to determine the optimal values for a given model.
The effectiveness of these different statements depend on your audience.
Concepts then labels, not the other way around
Top down vs. bottom up
- Start with the big picture
- Then gradually reveal the structure and key components
![]()
- Start with the details
- Build to the big picture
![]()
In the previous explanations, which one represented a bottom-up explanation and which one a top-down explanation?
New ideas in small chunks
The hidden structure in the first explanation
- The concept of setting a bunch of values.
- Random forest example.
- The problem / pain point.
- The solution.
- How it works - high level.
- How it works - written example.
- How it works - code example.
- The name of what we were discussing all this time.
Reuse running examples
Effective explanations often use the same example throughout the text and code. This helps readers follow the line of reasoning.
Approach from all angles
- When we’re trying to draw mental boundaries around a concept, it’s helpful to see examples on all sides of those boundaries
- It would have been nice to include
- Performance with and without hyperparameter tuning.
- Other types of hyperparameter tuning (e.g.
RandomizedSearchCV).
When experimenting, show the results asap
The first explanation shows the output of the code, whereas the second does not. This is easy to do and makes a big difference.
It’s not about you
- Interesting to you != useful to the reader (aka it’s not about you)
- Examine the hidden intention of wanting to include something that’s not important
- Am I trying to sound smart or prove I know something?
- Am I afraid that leaving it out makes the work look too simple?
- Am I adding it because I spent time on it and want that effort to be visible?
- Am I overexplaining because I’m worried the audience will judge me?
If it doesn’t serve the audience, it’s noise.
Core questions you must be ready to answer
- What does this result mean (in plain language)?
- When does the model work? When does it fail? (failure modes)
- Why did it make this prediction? (explainability path)
- What are the risks & consequences of using it?
- How does it compare to doing nothing or current practice?
- What is the cost to maintain / retrain / monitor?
Poor vs. Effective communication
Which one is poor and which one is effective? Why?
Communication 1
“I built a model to predict next week’s avocado prices. The ridge model had an RMSE of 0.79, but the random forest performed better with tuned hyperparameters. The cross-validation score improved after adding lag features. We should use the random forest.”
Communication 2
“Our avocado price forecast reduces weekly price uncertainty by 15%. This lets the procurement team lock in contracts earlier and avoid overpaying during high-volatility weeks, saving an estimated $45k per month.
To deploy: we need 2 days to automate data updates and a weekly accuracy review.
Risk: model performance drops during holiday spikes. Here’s our mitigation plan.”
Poor vs. Effective communication
❌ Poor communication:
“I built a model to predict next week’s avocado prices. The ridge model had an RMSE of 0.79, but the random forest performed better with tuned hyperparameters. The cross-validation score improved after adding lag features. We should use the random forest.”
Result: The manager doesn’t know why this matters, how it affects decisions, or what to do next. No adoption.
✅ Effective reframe:
“Our avocado price forecast reduces weekly price uncertainty by 15%. This lets the procurement team lock in contracts earlier and avoid overpaying during high-volatility weeks, saving an estimated $45k per month.
To deploy: we need 2 days to automate data updates and a weekly accuracy review.
Risk: model performance drops during holiday spikes. Here’s our mitigation plan.”
Result: Clear value, operational impact, required effort, and risks. Enables decision-making.
Key difference: Shift from model-centric communication → decision-ready communication.
Confidence and predict_proba
- What does it mean to be “confident” in your results?
- When you perform analysis, you are responsible for many judgment calls.
- Your results will be different than others.
- As you make these judgments and start to form conclusions, how can you recognize your own uncertainties about the data so that you can communicate confidently?
Let’s imagine that the following claim is true:
Vancouver has the highest cost of living of all cities in Canada.
Now let’s consider a few beliefs we could hold:
- Vancouver has the highest cost of living of all cities in Canada. I am 95% sure of this.
- Vancouver has the highest cost of living of all cities in Canada. I am 55% sure of this.
The part is bold is called a credence. Which belief is better?
But what if it’s actually Toronto that has the highest cost of living in Canada?
- Vancouver has the highest cost of living of all cities in Canada. I am 95% sure of this.
- Vancouver has the highest cost of living of all cities in Canada. I am 55% sure of this.
Which belief is better now?
We don’t just want to be right. We want to be confident when we’re right and hesitant when we’re wrong.
In our final exam, imagine if, along with your answers, we ask you to also provide a confidence score for each. This would involve rating how sure you are about each answer, perhaps on a percentage scale from 0% (completely unsure) to 100% (completely sure). This method not only assesses your knowledge but also your awareness of your own understanding, potentially impacting the grading process and highlighting areas for improvement. Who supports this idea 😉?
Loss in machine learning
When you call fit for LogisticRegression it has similar preferences:
correct and confident
> correct and hesitant
> incorrect and hesitant
> incorrect and confident
- This is a “loss” or “error” function like mean squared error, so lower values are better.
- When you call
fit it tries to minimize this metric.
Logistic regression loss
- confident and correct \(\rightarrow\) smaller loss
- hesitant and correct \(\rightarrow\) a bit higher loss
- hesitant and incorrect \(\rightarrow\) even higher loss
- confident and incorrect \(\rightarrow\) high loss
Misleding visualizations
This chart is attempting to suggest a relationship between childhood MMR vaccination rates and the prevalence of autism spectrum disorders (AD/ASD) across several countries.
Do you see any problems with this visualization?
Visualizing your data and results could be very powerful but at the same time can be misleading if not done properly.
Things to watch out for
- Chopping off the x-axis
- the practice of starting the x-axis (or sometimes the y-axis) at a value other than zero to exaggerate the changes in the data
- Saturate the axes
- where the axes are set to ranges that are too narrow or too wide for the data being presented making it difficult to identify patterns
- Bar chart for a cherry-picked values
- Different y-axes
What did we learn today?
Principles of effective communication
- Concepts then labels, not the other way around
- Bottom-up explanations
- New ideas in small chunks
- Reuse your running examples
- Approaches from all angles
- When experimenting, show the results asap
- It’s not about you.
- Decision variables, objectives, and context.
- Expressing your confidence about the results
- Misleading visualizations.
❓❓ Questions for you
Imagine you’ve created a machine learning model and are eager to share it with others. Consider the following scenarios for sharing your model:
- To a non-technical Audience: How would you present your model to friends and family who may not have a technical background?
- To a technical audience: How would you share your model with peers or professionals in the field who have a technical understanding of machine learning?
- In an academic or research setting: How would you disseminate your model within academic or research communities?
What is deployment?
- After we train a model, we want to use it!
- The user likely does not want to install your Python stack, train your model.
- You don’t necessarily want to share their dataset.
- So we need to do two things:
- Save/store your model for later use.
- Make the saved model conveniently accessible.
Full examples of deploying an app
For this demo, each student should click this link to create a new repo in their accounts, then clone that repo locally to follow the steps to deloy an app.
Web App
See notes fom class as well as the lecture demo.
What did we cover
Part 1: Supervised learning on tabular data: ML fundamentals, preprocessing and data encoding, a bunch of models, evaluation metrics, feature importances and model transparency, feature selection, hyperparameter optimization
Part 2: Dealing with other non-tabular data types: Clustering, recommender systems, computer vision with pre-trained deep learning models (high level), language data, text preprocessing, embeddings, topic modeling, time series, right-censored data / survival analysis
Part 3: Communication, Ethics, and Deployment
What we didn’t cover
- How do these models work under the hood
What would I do differently?
Lots of room for improvement. Here are some things on my mind.
- Balance the pace of the course a bit more (too intense at the beginning, too relaxed at the end!)
- Flipped classroom in a more effective way in the first part of the course.
- Add more interactive components in the lectures
- More activities during lecture time
- Add a course project !?!
- Some material to cover: dealing with outliers, data collection, newer methods
What next?
If you want to further develop your machine learning skills: - Practice! - Work on your own projects - Work hard and be consistent.
- If you are interested in research in machine learning
- Take CPSC 340. If you do not have the required prereqs you can try to audit it.
- Get into the habit of reading papers and replicating results
❓❓ Questions for you
For each of the scenarios below
- Identify if ML is a good solution for a problem.
- If yes
- Frame the problem to a ML problem.
- Discuss what kind of features you would need to effectively solve the problem
- What would be a reasonable baseline?
- Which model would be a suitable model for the given scenario?
- What would be the appropriate success metrics.
❓❓ (Practice) Questions for you
| QueuePredictor app |
Inform callers how long they’ll wait on hold given the current call volume |
| To-doList App |
Keep track of the tasks that a user inputs and organize them by date |
| SegmentSphere App |
To segment customers to tailor marketing strategies based on purchasing behaviour |
| Video app |
Recommend useful videos |
| Dining app |
Identify cuisine by a restaurant’s menu |
| Weather app |
Calculate precipitation in six hour increments for a geographic region |
| EvoCarShare app |
Calculate number of car rentals in four increments at a particular Evo parking spot |
| Pharma app |
Understand the effect of a new drug on patient survival time |
Conclusion & farewell
That’s all, folks. We made it! Good luck on your final exam! When you get a chance, please let me know what worked for you and what didn’t work for you in this course.