Creating an Inclusive Django Community with Kenya Phelps
Published July 15, 2026
This video features Lorena Mesa at DjangoCon US 2017 in Spokane, Washington, USA.
DjangoCon US 2017 - Using Django, Docker, and Scikit-learn to Bootstrap Your Machine Learning Project by Lorena Mesa
Reproducible results can be the bane of a data engineer or data scientist’s existence. Perhaps a data scientist prototyped a model some months ago, tabled the project, only to return to it today. It’s now when they notice the inaccurate or lack of documentation in the feature engineering process. No one wins in that scenario.
In this talk we’ll walk through how you can use Django to spin up a Docker container to handle the feature engineering required for a machine learning project and spit out a pickled model. From the version controlled Docker container we can version our models, store them as needed and use scikit-learn to generate predictions moving forward. Django will allow us to easily bootstrap a machine learning project removing the downtown required to setup a project and permit us to move quickly to having a model ready for exploration and ultimately production.
Machine learning done a bit easier? Yes please!
This talk was presented at: https://2017.djangocon.us/talks/using-django-docker-and-scikit-learn-to-bootstrap-your-machine-learning-project/
LINKS:
Follow Lorena Mesa 👇
On Twitter: https://twitter.com/loooorenanicole
Official homepage: http://lorenamesa.com
Github: https://github.com/lorenanicole/
Follow DjangCon US 👇
https://twitter.com/djangocon
Follow DEFNA 👇
https://twitter.com/defnado
https://www.defna.org/
Lorena Mesa explains how a growing data science team can make machine-learning work reproducible and easier to hand off to production. She introduces supervised learning through a pizza-request classification example, describes the different roles of data scientists, data engineers, and application developers, and outlines the pipeline from feature engineering and Scikit-learn training to pickling a model. She argues that Docker can package the code, dependencies, training data, notebooks, and model together, while a Django API can provide a controlled way for data scientists to build and register model images; the remaining challenge is tracking how models perform over time.
Summarised automatically from the transcript.
Automatically transcribed, so expect mistakes in names and technical terms.
Brilliant. Okay, so thank you so much for joining me, especially after lunch. So I hope you're all really excited to basically look at every single technology that I try not to make my title too long, but we will at least touch on some of these, which is fantastic. So just to recap, um just to recap the title of this talk, it's titled Using Django, Docker, and Scikit Learn to Bootstrap Your Machine Learning project. Something I do want to point out is that all these slides are actually available with a bit. ly link on the bottom left-hand corner. I also will be sharing on Twitter and I will also be sharing the code which I will not be doing any live code today, but I do have a repository up and would love people to use things, break things, tell me that I need to add things. So that'd be really fantastic.
But yeah, so I would like to start off a little bit with a story about something that happened to me recently. So I'm guessing many of us use some kind of communication tool like Slack at work. Yes? Okay, great. So on August 1st, I got this fantastic ping from a coworker of mine, Matthew, who uh basically was like, hey, like I've got questions, the interface on this model change Like what happened, what's going on, blah blah blah, and I'm like, wait, hold up. There's a few models and there's a lot Like what changed, what explicitly is like the model version you're talking about. I don't understand. And I think this right now speaks to kind of like the problem space I'm currently in, which is tooling around data science teams
So yeah, this just happened to me on August 1st and it's only August 15th, so the struggle is real. I'm still in this in I'm still in this problem space trying to think through this quite a lot and would love to hear any feedback you have. So August 1st, Matthew pings me. I'm like, okay, well maybe I can go and piece together what this model is. I go jump on GitHub and look at where the data scientists are chucking code in. I go into one of the data scientists projects repository and there's just like 10 Jupyter notebooks in there with like a lot of code, a lot of things I don't understand. hand in them and I'm just like, okay, I have no idea which of these Jupyter notebooks dumped the model that is on this, um, that is on this Kubernetes service that Matthew you were using. So uh hold on, let me go look
So I go look and see if I can piece together the story from the pickled version of the model. And uh we we story those on S3 and looking in S3, you'll notice June 12th, July 2015. Hmm. Okay, there's something called latest, which is maybe correct, I hope, but you'll notice the size of the model is exactly the same. And there's been like six five to six weeks between Between these two models being dumped in there, and I'm not exactly sure which one it is. So that is pretty much my struggle every day. I'm kind of somewhere in this place where I'm lost. I'm not exactly sure which model someone's using. you know, yes, this is the correct version, yes, this is the interface. Where are we with our data science team and what are our best practices?
So I'm going to talk a little bit about a few things today, but before I get started, I did want to do a quick introduction to who I am Uh hi, my name is Lorena Messa, and as our session runner indicated, I am totally a big Star Trek nerd. I paid way too much money to meet Captain Jean-Luc Picard, which was fantastic. But something a little bit about me is I've actually come out of the world of being a political scientist. So a few years ago, I I was like, I can do SQL and Python and I like this code thing. So I went through an immersion program at Dev Boot Camp in Chicago and I've been with the Sprout social engineering team ever since May 5th, 2014. It's been really exciting. In my time there, I've been on the platform team
working on two different parts of the platform. And the last year and some change, I've been on our brand new data science team. team. I will talk a little bit about the anatomy of our data science team, but what I do want to point out is our data science team is newer and we are growing quickly, which is kind of where this talk comes from. Some other things I do, I help run Pie Lady Chicago and I do sit on the Python Software Foundation board of directors. I think there's a few of us here at DjangoConz. Have any questions or want to know more about the PSF? This is just my call to you. Come speak with us. We're super happy to get to know who you are and learn more about your needs. So, in regards to today's talk, we're going to be kind of going through these five items. We're going to chat a little bit to get some common language around what machine learning is.
We're going to talk about the anatomy of a data science. Because I know with Django and with Python, we can get people from a broad variety of disciplines. So I do want to make sure we talk a little bit about data science and how my team kind of functions. Then we will high-level talk about the engineering of machine learning problem. We'll then move into thinking about machine learning engineering using some of the latest and greatest buzzwords like Docker, Django, because we're at Django Cod, uh Scikit Learn, and some other goodies. And then we'll kind of leave with some open questions about what could be next for the project I'm working on. Maybe what are some ideas for you all if you work on data science teams, what we could use in the ecosystem for data science infrastructure, and then also tools for
more learning. So great. What is machine learning? I always get a little bit of a kick out of when people think about what machine learning is, like input. Hi, I'm Johnny Five. If you don't know what Johnny Five is, it's a really ridiculous movie, a kids' movie from when I was little, where you have like a super fancy, like intelligent uh robot who can do all the things. And I think sometimes that's what people may think when they think of machine learning, especially if they don't work at an organization. that has some kind of data science practice already. But for lack of a better word, I do like to always try to find some common jargon just to kind of orient myself and think through, well, when we talk about mean machine learning, what is it that we're actually getting into into. So rather than read this wall of text, I just want to kind of highlight some of the big things here.
So machine learning, it's a field, a subfield in computer science. Does pattern recognition, computational learning, artificial intelligence, blah blah. I'm sure we've heard a lot of that. So I don't really care so much about that. What I do really want to focus on is Machine learning explores the construction and study of algorithms that can learn from and make predictions on data. So the big thing here, algorithms. We all know what that is. Data, we work with it all the time and making predictions on data. Cool, we now have some ground and language to think about machine learning. But let's not stop there. Let's think about it maybe in a little bit more of a traditional way that some of us who maybe have computer science degrees may have been exposed to machine learning.
in a language like this. So I found this language to be very useful. It comes from Tom Mitchell, computer science professor at Carnegie Mellon, where he frames machine learning with With these three pieces. The emphasis here is that a computer program is said to learn from experience each. with respect to some task T and some performance measure P, if its performance on T as measured by P improves with it, experience So when we are talking about our algorithms, our algorithms are going to be doing some task. They're going to be using data, and from that is from that data, we're going to be trying to derive some insights so that we can go ahead and make predictions. on what new things may be happening out there. Depending on the features you're building, there's going to be some task, some kind of thing we want to accomplish.
And how do we know if we're doing things correct? Well, we have some idea of a performance metric. Okay, so just because I like to kill everything with details. I think it's always good to have a little bit of a toy problem to think about when we think about you know what might be some ways in which we do machine learning in our day-to-day and what are some toy projects we work on. So Sprout Social where I work is a is a largely business-to-business social media management and analytics tool. So something we work a lot with, social media data. So text data, that's a really big thing. for me. So text data, that's something that I think we might have all heard about. We've all had things like the spam filter in our inbox. It marks something if it's spam or not. Well let's let's maybe take that example a little bit further and think about a different example.
So the idea here of something else we could think about as a machine learning problem could be predicting altruism with a naive Bayes classifier. So I'm guessing some of us, I hope many of us like pizza. Yes. Especially if it has like the words free associated with it. That makes me really excited. So what would you all do to get free pizza? Do not scream it out loud. I'm just gonna brainstorm up here. Um, let's see, would you maybe run a marathon? Perhaps, because maybe those carbs are so much better after you're on a marathon. Um would you I don't know, would you do interpretive dance in front of DjangoCon for 45 minutes? Maybe. I don't know what your requirements are for getting free pizza.
But this is actually a really fun little toy example that someone actually put into the world and actually cleaned data for us so that we can actually start working on thinking about measuring and predicting altruism. With this idea that if you get pizza, someone gifts you pizza, that's an altruistic act. So where does this example come from? On Reddit, there's a subreddit called Random Acts of Pizza. And essentially what this subreddit is, is it's basically invites people to get to come on and say, hey, you can make a request. As you'll notice here, there are some there is some structure for how our request happens, which is pretty nice because in the era of unsurprising. Structured data, having some structure to your data is great, especially when you're doing machine learning.
So in the in line item two, we have write your request, post, and submit it. Remember to start the title with request. So yeah, there's some ideas here, but essentially this is a subreddit on Reddit where people can go and basically make requests for free pizza and then the community will upvote or downvote and based on the rules of how this works eventually when you have so many votes yep you're gonna get a free Pizza or someone might just buy it for you. So if you're hungry tonight, maybe you can do this tonight. Some examples of text of free pizza. Oh goodness, I really got a kick out of these. Uh the first one, I actually have money for the pizza, but all I have is a fifty dollar bill. And the delivery boys don't accept anything larger than a twenty
dollar bill. So that was actually the text of someone's request. Another request that someone made was I've got a guitar in one hand and on the other a pizza pie. So I guess they were just like trying to get someone excited they're like I'm already almost there you just have to buy me the pizza but as you can see that it these these kind of requests they can be all over the place they can be kind of silly and some of them are actually a little heartbreaking to read So in this toy example, the data science competition website, Kegel, actually already had cleaned this data set and made it easily downloadable. So it's probably very hard to see, but on the right hand side is a snippet of some of the JSON blobs that represent the training data for this problem.
You've got a lot of features in there including the request text, which is Some examples of things I gave you. You've got the number of votes, you have the user information of who requested it, the date it was requested, things like that. So that's kind of example of your training data. And then essentially what this problem does is it says, hey, I want you given these 5,600 requests of which 994 of them are labeled as true and the rest are labeled as false, I want you to write a model, a machine learning model, that can actually predict and tell Tell me if when I get a new request coming in, if that request is going to be successful or not. So for a machine learning problem, this might be example of a classifier. I don't know, maybe you're you've got a new wonky
app idea where you want to, I don't know, hack your way to all the free food in the world. Maybe this is your way of like bringing machine learning to your application. So you have some idea of text data and you've got some historically labeled examples of things that were successful or not, and then you can use that when you're constructing your model to help you make future predictions. So to reframe this in the language that we saw earlier from Tom Mitchell, we have the task, which is classifying a piece of data. Essentially the question is, is a pizza request successful? Or if we ask it differently, is that is this an act of altruism or not? Our experience here is going to be the label training data which essentially is like a CSV where you have a request ID and you just got a Boolean representing true or false if that request was successful or not.
And our performance measurement. Is the label correct? That's pretty much your performance measurement because when you're working with label data and you're actually going to go ahead and predict On some of that training data, if you have the label already, you can go just and check and see, hey, did I actually successfully predict this thing or not? So in the in the example of kind of machine learning, maybe you have some kind of classifier problem like this. You have your task. You have your experience, and now you've got your you've got some notion of a performance measurement. What next? Okay, so we've talked a little bit about what machine learning may look like for you as As an engineer, what kind of decisions you have to think about, what kind of data you may be working with. So it could be text data, it could be other things about the pizza request, maybe you're looking for if something is
incorrectly capitalized in the in the request. Maybe there's other characteristics of the data that you want to look at beyond just like the words that are in it. Well, with uh with a data science team, something to think about is that you've got kind of a few folks who are working on these problems. It's not just going to be your developer , not just your developers So kind of borrowing this from IBM's UX personas as applied to engineering, they they kind of think they highlight the idea and the differences between the app developer, the data scientist, and the data engineer. So the data scientist is actually going to be someone who's going to be going in there do doing a lot of the future engineering. They're the ones who are going to be trained on the different statistical methods and algorithms. And your data engineer is going to be the one probably building the
pipeline, the infrastructure around this, making this thing happen. happen. And then your app developers perhaps are the ones actually bringing the model and putting it into the application and making it so a user can can actually use this feature. or not. So in in that world, let's talk a little bit about my data science team. So you may have seen this gr this then gr then diagram of madness as I like to call it before, where you know with The idea that someone has all of these skill sets to me is just a total fallacy. The idea that you're gonna have math stats, subject area expertise. And computer science, and that's the unicorn, which allegedly is a data scientist. No, I can tell you that's definitely not the case. Um in in the kind of the context of my team
We've got a team that's been growing pretty quickly, like I said, about a year and some change. So we've got four data scientists. We've got someone who comes from natural language processing, a PhD. Who has spent a lot of time in computer science and working with NLP? We have folks who've come from predictive analytics, economics. Now we also have a person who came out of their postdoc doing chemistry. Then there is me, the lone soul software engineer and the team. And like I said, I can't I came from the platform engineering side of things. And I've done a little data analytics in my time as an as a Person in the professional world. We do also have some designated infrastructure support, but largely that is still kind of in our wheelhouse.
So why is that a problem? Great, we've got PhDs who are wearing the title of data scientist. There's me and we have some infrastructure. Report. Why do I care about that? Well, I think this can give you an idea. Um, so from the keynote that uh Jake Von der Plos did this year in Portland. He talks a lot about the variety of tools that are in Python's scientific stack. You've got ScikitLearn, you've got a lot of different IDEs you can use use like data grip, you have tools like pandas, you have a lot of visualization tools and plotting tools, and also just like the actual work of developing the model and executing, you've got things like Jupyter Notebooks. This is a big world that you're that people can pick up and select tools from.
So that's cool. Why is Python the place that people are going to if they're doing a lot of modeling work? The good thing I like to think about and why I get excited about data science in Python is namely that it really is a place where we can kind of mash a lot of things together. In the scientific community, there's a lot of work, for example, in the astronomy field, using Python to do a lot of analytics and visualization. Kind of again reframing what uh Jake Bonnenploss highlights, Python acts as a glue. It plays well with other languages. We've got our batteries included kind of idea here. We don't have to go and write a lot of proprietary code just to go in and start Working with data right from the get-go. Python's simple and dynamic, and it has an open ethos well suited to science.
So that's all fine and dandy, but again, on my side, I'm the one software engineer on my team. with people who come from a variety of different academic disciplines and the kind of tools that they can use can broadly vary depending on the types of machine learning problems we're working on. So to kind of think about what is the model for my team, or maybe what's the model for me as a person supporting a data science team. I'm gonna modify uh uh Professor Ralph Johnson's quote here in instead of saying before software can be re can be usable, it must be reusable. I'm gonna say explicitly before machine learning can be usable, it must be reusable. reusable. We have a lot of different expertise, we have a lot of open source tools, we have a lot of different kinds of problems people can use, and I think it's leading to
it can be a little overwhelming, is kind of the thing I want to highlight. So back to this idea of machine learning. One thing that we've had to think a bit about is what kind of problems are we going to answer, and what does that look like when we're answering answering those problems. So back to that example of the uh the uh uh predicting if you're gonna get a free pizza or not So we might have text data there, but that could, depending on the machine learning problem you're working on, you might have a variety of other data sources that you're integrating. And this kind of component of like shaping the data in the format that you need, selecting the and then maybe munching the data into the format that you need as well, can be quite expensive. So we call this feature engineering. This representation kind of on the left-hand
side gives kind of a broadly simplistic idea of what may be a pipeline for a supervised learning approach to machine learning. learning. So you can see like maybe we've got data in our in our uh in our data in our production databases, maybe we have logs, maybe we have um so examples of some logs, maybe we have some metrics in which we're kind of capturing how people are using the app application, maybe we've also got some proprietary data sets that we've paid for. There can be a quite a few series of things that we're taking together and we're integrating and we're we're globing together into new format. So this idea here of getting the data, merging it together, and then that feature extraction and pre-processing, that is going to be a lot of the work of our data science team. Then we have the idea
once we have data in the format and we've selected the features that we want, we can then go ahead and apply our learning algorithm. Great. From there we're able to get a model and then using that model we can go and make predictions in the example of our of our classifier. We can go and make a we can go and make predictions on future pieces of data and say, hey, that thing is successful or hey no it isn't. But the broad idea here is we're munging a lot of things together. There's going to be different areas of expertise and depending on who is doing what work, we need to to think a little bit more critically about that. And so this gets me to one really big question. The way that application developers use use the data that we're collecting and our proprietary data versus how I might be using the data versus maybe how data science
uh d data scientists perhaps themselves are even using the data, can be quite different. And we've actually got an entirely different kind of infrastructure that we need to start developing and building. And with that, the question then ultimately becomes, you know, where is the handoff between data science and production? What does that look like? What should our social contract be? Because the way that I'm I'm collecting and shaping data and the kind of data pipelines that we're laying down aren't going to be of aren't going to be of importance to the application developers who are responding to user-facing features. So let's break this down a little bit. Okay, so in the kind of flows that we that I'm um going to be talking about, we've we've talked a little bit about the git and shape
the data. That's the first thing. The second example, the second step of that is training the model and the data. Third, we want to pickle the model. We could save it with something like in Python job lib. And then fourth, we can go ahead and use it and make predictions on the data. So in this in this kind of example here, using Python's ecosystem, you might have some kind of script, and this is quite quite simplified, but you might have a script like what we see in the left hand side. So in the Python scientific in the Python scientific stack we have SK Learn. Why SK Learn? Why not TensorFlow? SK Learn is tried true in blue, and that's actually what my team uses. So you might have something like this where you're saying, okay, we've got the example of the
Pizza, we want we have data that we've been collecting, and now we want to be able to apply a model and make predictions on it. So with using Scikit Learn, we actually have all those algorithms built in. So naive Bayes, one variant of that is the multinomial naive base. And the flow is going to kind of look like this in the Python code you may repeat. receive. Something to the extent of, hey, let's split that data into the training and the test , the training set and then the test set. And we're going to go ahead and fit that multinomial model or whatever model you're using. You're going to fit it on that training data. And essentially what that does on the training data is it starts to represent whatever features you selected. So if you're doing something like
working with words Perhaps you're turning that into a numerical vector saying, hey, words that appear most often in requests that are successful for winning a pizza, um here's their here's their kind of histogram count. And the the ones that aren't successful in in getting pizza, here's a vectorized format of those word counts. That could be one example of feature there might be other features you're including and you can represent that um in a numeric format but essentially when we're fitting against historical data there's a process like that happening underneath Once you've fitted on that historical data, you can go ahead and say, hey, I've now got a model that's ready to go ahead and be used. And that's where we're going to go ahead and dump out the
model in a pickled format. So again, that that kind of shaping of the data, like what kind of prep work am I going to be doing? I'm not doing a talk that's very deep on Cikit pipelines. If you are curious about that, there's a fantastic talk I recommend from Pi Data Chicago in August 2016. about 40 minutes that goes in and talks about different transformations you can use and things like that. I have it linked in my slides. But that all being said, when you have your data, you're gonna have to do do some kind of munging of it of it together, getting it to work, and you can use transformers from ScikitLearn to actually get it in the way you want. So to think back to the idea of what might be an example of a transformation Perhaps you have a bag of words with a lot of a, the, but.
We call these stop words. These are words that don't provide a lot of context. Perhaps maybe the frequency of these words can throw off or introduce bias into your model that says, hey, uh I'm gonna over-bias and over uh overestimate that this is likely going to be a successful request. or not. So a transformer might be uh breaking your bag into a bag of words, removing stop words. You might also be doing something like stemming, which is treating words like shop and shopping as the same word. You're going to remove that ing But transformers like that, you can write your own custom ones. You can't do that with the scikit-learn pipeline operators. So when we're back into this flow, we've got training, we've got training examples. We've got the forming of the of the data in the in the format it needs, and then we're gonna go ahead and apply that that learning algorithm.
What's pretty nifty too about Scikit Learn is you've got a variety of things in there. So if you are kind of new to machine learning, learning, there's a lot of ease of use for you to go ahead and start getting to work pretty quickly. So I would encourage you to go ahead and explore a lot of that. And then you do have some metrics that are also built into Scikit Learn. We'll see that a little bit at the end. But for the context of the machine learning that I'm talking about and that I work with, this is historically our flow. We've got supervised learning. We have some previous data that's been formatted in some way. We'll use scikit-learn, apply transformations, get it into the format that we need. then we can go ahead and fit the model on it. We'll take that model from Scikit Learn and then we can dump that model using JobLib in a pickled format and then that thing is ready to go.
Cool. Okay, so I was talking a little bit about earlier about reusability. So we've got a flow. We've talked a little bit about what the code may look like for uh if you're using Python to do machine learning. explicitly following with the example of a supervised naive bayes example. So reproducibility does matter. So how do we engineer for that? Okay, I really think social media data is just so fantastic. Imagine you have to develop a machine learning model that says, hey, the sentiment of this tweet is positive. Or it's like a warm, good feeling. You know, however you want to slice and dice it, you have to like separate negative from positive. Well, here's the thing. Emoji are a part of text data.
The idea of having t uh I think it's called tears of joy. People use that so differently. You have some folks who think that that's actually like someone who's like Sneezing and crying. You have people who use that and they may think that it's like a very positive, exciting thing. So the example here from the tweet It says, I'm laughing so hard. Tears of joy, tears of joy, tears of joy, lots more tears of joys. Hashtag mentally dating Justin Bieber. And the shirt says single taken X. Mentally dating Justin Bieber. So if I were to ask you, is this a positive or negative thing? I'm very curious what you would say, because I would say Not so positive. I'm not a huge Justin Bieber fan. Like, I would think that that tears of joy is tears of just like utter destruction.
I don't care. This is not a positive tweet. Another really fun one that I I've come across before is the purple heart emoji. So, you know, uh super sad that Prince is no longer with us, but Prince Purple is the color of Prince. And if you're looking at tweets that use the purple heart, especially around the anniversary of Prince's passing, which I believe was April of this year, um, was the one year anniversary, you start getting a lot of purple heart. And so let's look at this tweet. The Prince Estate has announced at Pantone's new purple hue, named in honor of Prince's famous love symbol. So to me, I'd be like, oh, that's so cool. Remember. Prince and we're empowering prints to other people, they might still just be, you know, watching uh purple rain and just
utterly destroyed by things. So, you know, we have all these examples of kind of of inconsistencies, right? So reproducibility does matter. If I have a machine learning model that's predicting the sentiment of something, ideally we would want it to be consistent. Right? Yeah, I would hope so. But there's a lot of there's a lot of context there. And so this is where things can get a little tricky. And I'm not even gonna start on the hashtag lolsob because that is just that's a silly one. So the idea here about data and kind of data governance, who owns the data, who's doing what, how are we gonna get consistent results? So in the pipeline operators of things, I want to be able to look at my system and think of black boxes. I know that I've got the black box that shapes data and does thing, I've got the black box that spits out a model, and then I've got the black box that can go ahead and be called and make a frame.
Prediction, right? So I'm gonna say as an engineer, what I care about is developing tools that will help me get this reproducibility. So That's where I'm gonna start saying Docker is fantastic. And also I just really like Docker's imagery. It makes me very excited So containers, there is a very awesome talk later today on Kubernetes. And there's also a talk saying like I think the talk is end-to-end Django on Kubernetes, which is fantastic. But yeah, so containers. Let's get into containers and talk a little bit about it. So Docker, I'm guessing probably most of you have used it, but it's always good to get a refresher if you have not. So you can think of Docker as basically a big executable tarball that has an explicit format.
So for me as an engineer, I might be like, oh, the code that that actually does the thing. any kind of libraries I need to help me write the code to do the thing, and maybe any system tools I need. Cool. Well, here's a fun gotcha. In data science, that might also include this data, because we don't want this weird inconsistent consistency around the purple heart the purple heart, the LOL sob, whatever is the latest and greatest thing that someone's introducing into the world. So yeah, data is also probably going to be a big thing if you're talking about supervised learning problems. So Docker can also include you know when we think of Docker, maybe that tarball can also learn how to get that training data down so that when we introduce new versions of models, it can retrain on the same thing. Because
Consistency is good. And again, you know, why use Docker? I just have to steal from Kelsey Hightower who eloquently said the first rule of Python is that you don't use the system. system installed version of Python. I mean I I I'm sure many of us have struggled. I know having run Django Girls quite a few times telling everyone do not use the the Python that's installed on your machine. I will lol sob all day. So obviously, as we know, as we know, setting projects up can be difficult, but then introduce other complications with machine learning. learning like the data that we're using, the correct order of transformations that we have to do. There's other things that start to become more complicated when we talk about machine learning problems.
So for the Docker end of this, I'm gonna say what's really cool is Docker allows us to make a container which basically takes a snapshot of how that code works at that given moment, and then we can just put it somewhere. And then we could check it out later if we want. So we do this with a Docker file. And essentially what the Docker file does is you'll have steps in your code. And what's really nifty is if you have the same procedure in your in your Docker file uh time after time, you won't need to re-download everything. It's essentially caching layers. So only when you make changes in your Docker file will it have to go and re-download things, which is great. We're now making our lives a little bit easier with setup. So when we write the Docker file, we're gonna then the second step is you build the Docker image, which would look something like build uh Docker built with the tag.
This is the name of the model, predicting altruism, give it a tag of latest. And then if I wanted to run that Docker container, it might look like from the command line, Docker run, detached, mirroring uh associating port 8888 to 8888. and use a mountable data directory volume. So what as an example of a Docker file, Essentially what this is doing top to bottom, this is an example of maybe what I would give a data scientist for them to go ahead and start working on their stuff so that I can say, okay, now save things. so that I can check things out when you give me the thumbs up that you've got a model that you want me to download and work with. Essentially from the top to the bottom, what this is doing, it says use a Py Python 3 image, go ahead, add some users.
I'm going to go ahead and mount a data directory volume onto my Docker image. And then I'm gonna go ahead and install the requirements, and then I have this entry point which basically says spin up a Jupyter notebook. That's my Docker file. Pretty straightforward. So with Docker files, we can easily start controlling when changes happen because you can build a snapshot of what the code, what the data, what all that looked like at a point in time. So I'm a big fan of using the mountable data directories. Essentially, what that allows us to do is it takes data on a directory on your local system, and then it's going to go ahead and mount that into the image. So, like I said, we want reproducible results. So, if I have one of my data scientists who found a really cool data set and maybe
they want to work on that, but they want to use the same model, well they can go ahead and build a new image and maybe rename it with this is the name of the of the training data that I had. So in thinking about how I can get my data scientists to work, essentially what I would argue for for them to do is go ahead We're I want you to use this Docker file. We're gonna have a mountable data directory which includes your Jupyter notebook, which is gonna have your exploratory code to again batch that process of scikit learn pick pick the naive base or whatever classifier you're using, then go ahead and transform the model, transform the data using those transformers as the data scientist selects, and then pickle the model and build it and dump it into this Docker
image. They can dump it into the Docker image. That's fine. Where that where that where that model will ultimately wind up, then at least I know I can go check out that Docker image. And then I've got the training code that goes with it. I have the Jupyter notebook that is Ideally with some naming conventions. It explicitly tells me when it was last touched, who owned it, things like that. But now I'm I'm basically creating kind of abstractions for them to work in where they control the modeling side, I can check out the thing that they're working on and continue on my merry way. So if I'm using a Docker container, what I could do is use uh in Python we've got a Docker module which allows us to create an image. So if I were to stand up a Docker endpoint
in a Django API, maybe the URL looks something like this. Create image, name of model, go ahead, create image. In that, that will kind of go ahead and goes through the procedure of saying, hey, I'm going to read the Docker file. I'm going to go ahead and build this image and I'm gonna go ahead and stuff it somewhere and what I want to return back is basically like a URL of where uh of where that Docker image lives. For context, there is demo also here on my repository. So when I do share those slides, you can check that out. But essentially that's where Django kind of comes in. We can now basically stand up an endpoint. use Docker, abstract away what they need to do, and then allow the allow the data scientists to say, okay, I'm gonna hit this endpoint, it's called predicting
altruism, and I'm gonna go ahead and ask them to To go ahead and build a new snapshot of the work that I'm working on. So in the Jupyter Notebook, it might have something like this, the an example here of the clean type tokenizer, it's kind of what I was talking about before of breaking up words into a bag of words and then maybe doing whatever other transformers you need. But in the Jupyter Notebook that they're working in, Essentially when we build that Docker image, we're then able to, in that Docker image, dump the pickled model and have it live somewhere So essentially what we can do with with the with the Docker API is basically build in this Docker workflow where a data scientist, as they're working on their on their uh on their Jupyter notebook when they're ready to to go ahead and save, it basically posts to a Django endpoint, and that Django
endpoint's gonna create an image. And that image is going to be tagged with a mutually agreeable model name and convention that we agree on, such that when Matthew asks me Hey, I need to know about this model. I can say, okay, well, the last one that was updated onto Docker is here, and here's the URL you can use to go ahead and check it out. We've now kind of abstracted away those processes from people So the big thing that I did not talk about to keep in mind is it's not just that we want to automate kind of the building of these things, but we want to understand how models will do over time, right? That's the big thing here that I think is kind of the elephant in the room is we want to be able to store analytics as well. So currently, what my team's working on is we're using uh the Django admin
to start bringing in some of the The analytics that we get with Scikit Learn. So on the right hand side, you'll see there's a chart of false positive versus false negative to see if we can start lifting some of those metrics out so that when we train against that historical Training set, we now have consistency. It's like okay, model variant one, here's the results of false positive, false negative. Model variant number two two, here's the results, such that when we start looking at maybe what's the best model, we can start surfacing those in the Django admin view. Some other things to kind of think about too is the some other things to think about too is uh we haven't gone the path of talking about Kubernetes in this talk, but Kubernetes is a great way to stand up an image and stand up behind an M So again, taking that container's technology to the next step and allowing people then who are on
who are the application developers to go ahead and start hitting an endpoint, Kubernetes can also allow us to get get to work and start doing that. So if you are curious about Kubernetes, I'm going to make a plug for that talk at 4. 10. And then also, Django is a great framework in which to use Kubernetes So you can build upon some of the great robust libraries that are out there, like the Django Admin and using some of the other visualization tools. But there's also other web frameworks. Maybe you might want to think about. So I know that at five today there's a Django vs. Flask talk. I've I have also used Falcon as well. I think it really depends on what your team needs, but I think Django is a really good place to start because it's got really robust support and integration with a lot of these tools we've talked about. So if you're curious about kind of like what next There's a lot of places we can go next.
Um I really enjoy Rob 's stories talk, bridging Python to JVM, uh, because that's the other thing. Maybe we prototype or model in Python, but we want to make use of the JVM. Is there something we can do there? Well yeah we can definitely do this with our flow. We just might need to transform that pickled model into a different into into a different format, how can we do that? So there's there's some discussion there. Um if you want to learn more about the psych uh the psychic learn pipelines that's a link to that. But also last but not least I do have two repositories. One that allows you to work with the mountable data volumes with already a full-fledged pizza altruism model that you can use and do what you want uh to your heart's content to start playing with and then also I do have it stood up in a Django route Which is pretty great. So that all being said, uh what do you see on the image?
Cartoon Clip Art Network? I don't know. I'll say I hope we see lots of free pizza. So thank you so much. My name's Lorena. I'm excited y'all have been here today. And if you have any questions, I'll be around. Thanks.
Machine learning is the study of algorithms that learn from data and use what they learn to make predictions. A useful way to frame it is a program improving at a task according to a performance measure as it gains experience.
Discussed at 6:25Define the task the algorithm must perform, the experience or labeled data it learns from, and the performance measure used to judge whether it is improving. In the talk’s example, the task is predicting whether a pizza request will succeed, using historical labeled requests and checking whether the labels are predicted correctly.
Discussed at 7:12Data scientists explore and engineer features and select statistical methods or algorithms; data engineers build the surrounding data pipelines and infrastructure; and application developers integrate the resulting model into a user-facing application.
Discussed at 14:18Prepare and transform the data, split it into training and test sets, fit a Scikit-learn model on the training data, and serialize the trained model—often with Joblib in a pickle format—so it can make predictions on new data.
Discussed at 22:10Docker captures the code, libraries, system tools, and potentially the training data in a versioned container image. Rebuilding from the same image and data helps preserve the environment and transformation process, so models can be retrained consistently.
Discussed at 30:02A Django API can expose an endpoint that builds and tags a Docker image containing the model, training code, and notebook. Data scientists can post to that endpoint when a model is ready, giving the team a named, inspectable snapshot and a clear place to find the latest version.
Discussed at 36:12Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.
Published July 15, 2026
Published July 15, 2026
Published July 15, 2026
Published July 15, 2026
Published July 15, 2026
Published July 14, 2026