What you'll learn
- Compare machine learning and AI engineering workflows, including model building versus deploying and steering a foundation model
- Identify the stages of a machine learning pipeline, from raw data collection and cleaning through modeling, training, and evaluation
- Explain how AI engineers use system prompts, RAG, citations, and guardrails to reduce hallucinations and confident misinformation
- Identify data cleaning issues such as imbalanced classes, inconsistent labels, duplicates, and data leakage between training and testing data
- Write pseudocode that maps out model logic in plain English before writing framework-specific code
- Contrast software 1.0, 2.0, and 3.0 approaches to a spam classifier, from deterministic rules to training and prompting
Free 64-minute video lesson with a full transcript and knowledge checks. No account needed to watch.
Introduction
In this skill, we examine the distinction between Machine Learning and AI Engineering as two related but separate ways of working within Artificial Intelligence (AI). We analyze how model training and data-driven prediction differ from building applications on top of existing foundation models, including the role of prompts and external data. We also clarify how data science, data analysis, and data cleaning fit into this space and establish a consistent way to recognize which approach is being used in a given workflow.
Knowledge Check
Which scenario best represents AI Engineering rather than Machine Learning?
Machine Learning Pipeline Overview
In this video, we examine the Machine Learning Pipeline as a high-level view of how ML systems are structured. We understand how workflow steps like data ingestion, preparation, modeling, training, evaluation, and deployment each connect. We then analyze how each stage influences the others and why it's important to handle each with precision.
Knowledge Check
What is a key reason "Evaluation" is required in a Machine Learning Pipeline?
Machine Learning vs AI Engineering Workflows
In this video, we examine how Machine Learning and AI Engineering approach problems. We clarify the distinction between training models to learn from data and building systems that guide the behavior of existing foundation models. We analyze how these different approaches require different workflows, from model training and evaluation to application design and system behavior.
Knowledge Check
What is a key difference between Machine learning and AI engineering?
Machine Learning and AI Engineering in Practice
In this video, we further define machine learning and take a closer look at why and how it is different from AI Engineering. Using various examples, we dive deeper into how ML learns patterns from data and how AI Engineering builds systems around model behavior. We analyze the way each of these approaches can be used to solve different problems.
Knowledge Check
Which task is most closely associated with AI Engineering rather than Machine Learning?
Data Analysis, Data Science, and Data Cleaning
In this video, we examine how data analysis and data science fit into the broader Machine Learning and AI landscape. We clarify the distinction between exploring and understanding data, designing experiments, and building models, and when each approach can be used correctly. We analyze why well-defined data is critical and how issues in the data always affect everything that follows.
Knowledge Check
What is a critical first step in ensuring the success of Machine Learning Models?
Pseudocode Crash Course
In this video, we examine "Pseudocode" as a way to express system logic in plain language before writing traditional code. We clarify how pseudocode applies across rule-based systems, machine learning workflows, and AI engineering systems. We analyze how breaking a system into inputs, decisions, and outputs is best practice for structured thinking before implementation of code generally.
Knowledge Check
Pseudocode removes the need to understand how a system works because the code handles the logic automatically.
Challenge 🎉
Congrats on making it to the challenge. In this challenge, we apply pseudocode to a single problem by solving it using three different approaches: rule-based logic, ML, and GenAI. The task focuses on classifying emails as spam or not spam while comparing how the logic and workflow change across each approach. Complete the pseudocode for each system and answer the question below before moving onto the next skill.
Colab Notebook:
Knowledge Check
Machine Learning is always the best solution when working with all data-driven problems.
View Transcript
Introduction
0:00Hello and welcome to the next skill in the introduction to machine learning and AI engineering course. And in this skill, we're going to compare machine learning and AI engineering because well, this is a course titled on both of those domains. And before we go deeper into models, tools, frameworks, code, we really need to separate these two core domains because right now a lot of people still use the word AI to mean almost anything like machine learning, deep learning, chatbots, prompting, automation, even analytics.
0:34Oh yeah. And agents, all of it. And that's going to make things a little confusing, especially in the AI engineering part. We did a pretty good job of defining AI, machine learning, deep learning, and generative AI, but AI engineering, not so much. For example, if we're training a binary classifier and we did that already, and that is hot dog and hamburger, and we use teachable machine to do that with no code, we are essentially training that classifier on labeled data.
1:05And by labeled data, I mean hot dog, hamburger. We even had another class, but let's just think of it as just two for right now. We added nothing in the previous skill because it's a lot neater if you don't have an object and it says nothing. Right. I did that just to make it very clear, but in this case, it's binary. It's only going to predict hot dog or hamburger if it meets a certain threshold. That way we don't have to have that third nothing class. So this is not the same thing as number two, which would be building a document assistant that's built on top of a foundation model and foundation model.
1:44That's going to be things like Grok, Claude, ChatGPT. These are models that are also called large language models, trained on large amounts of public data like the internet so that it has a foundational knowledge as a general model. And you can build a document assistant using something called RAG, which we're going to talk about later. But in essence, retrieval augmented generation means that you're going to give it information or a document so that this foundation model can help you with that document.
2:14You don't need that document if you don't need any outside information. For example, if it's contained inside of this foundation model, you're good to go. If you need some proprietary data, you can use RAG. So number one, you're training a model on label data. Number two, you're using this existing LLM or foundational model to build some kind of an application to help you with documents or to upload and then help you with that specific document. These are two different workflows.
2:46So a person can absolutely work with AI and barely train any models. And that is a very common confusion. Also, a person can absolutely build models and barely touch prompt engineering. So you could do one or two and never touch the other. So one is a machine learning engineer. That is number one. And number two is an AI engineer. And the takeaway is that these are different modes of work. So we're going to clearly define machine learning and AI engineering in this context in this skill.
3:18But we're also going to talk about data science, data analytics, because they do overlap, especially data cleaning and where that fits into the picture. Both data scientists and data analysts have to clean data if they're going to do work. Also, data science includes machine learning engineers. If you're a data scientist and you can train these models, well, you have overlapping domains. So we're going to clear that up as well. And best of all, we're going to make all of this familiar using spam classification.
3:49So no more hot dog hamburger. Now we're going to think about emails, right, which is a very common task. And we're going to look at it in three ways using software 1.0, handwritten rules, software 2.0, a learned model, and software 3.0, which is prompt based interaction, which veers into AI engineering. So the goal here is to help you build that mental model because the course gets much easier to follow and understand when you have a clear mental model.
4:20All right. So what are we going to cover in this skill first? And also, there's a very specific order here. We're going to define machine learning in a deeper, more practical way. Second, we're going to go right into AI engineering. This is the first time we're focusing on AI engineering and not generative AI. And we're going to do this in the same way we do machine learning. We'll keep it broad enough, though, to be accurate, but very granular and clear enough that you can immediately tell how they differ from machine learning and critical areas that are going to apply to the rest of the course.
4:54And third, we're going to get into data science, data analysis, and data cleaning. Data cleaning, because we're in the age of AI hype, people love to talk about models or prompts, but they somehow ignore the condition of the data. And that is a catastrophic mistake. I can't tell you how many times I've seen this and heard about this because these chat bots can spit out code, advice, and two key things happen that are really dangerous.
5:25One, your knowledge is as far as you can go with the chat bot. It meets you where you are. And if you don't have a data science background, you're really not going to worry about data cleaning. So nobody really does. And if you have bad data, it doesn't matter how well you train a model or how well you engineer a product, garbage in, garbage out. So cleaning data, getting the right kinds of data, and putting them into the model or to the AI engineered application is just as important.
5:55And that's why we're going to talk about this, because it's probably the most important and overlooked part of machine learning and AI engineering. And once we finish with that important topic of data science, data analysis, and more importantly, data cleaning, we're going to do a quick callback on software 1.0, 2.0, and 3.0, and we're going to start using it because that ties directly into that mental model. You know the differences. One is deterministic. The other two are not deterministic, especially number three.
6:28And this really helps you think about how am I going to solve a problem with these different types of software or different subsets of AI. Then we're going to talk about pseudocode. And if you have a programming background, you know what pseudocode is. Let's say that I write a simple program with Python, hello world, that is probably the easiest one. And you could write the steps in English and then write the code. And the reason that that is popular in programming is it gets you to think about the logic before you write any code.
7:01It's easier to do that because you have an understanding of what it is that you want to do. And when you go to execute that and you have missing knowledge, well, you can focus on syntax and not logic and syntax at the same time. This is even more important for machine learning and AI engineering because if you don't know what the steps are in plain English, then forget about writing code. Even if you use an AI chat bot to spit out some code, again, if you don't have the domain knowledge, it's going to steer you into weird ways and dead ends and maybe even dangerous security vulnerabilities that you are going to be unaware of.
7:40So depending on your background, we're going to make sure that this is super clear. And then finally, we'll have a challenge, which is going to be really exciting. We're going to create three spam classifiers. All right. On that note, I will see you in this very first video on machine learning, and we're going to focus on the machine learning pipeline at a high level. All right.
Machine Learning Pipeline Overview
0:00Welcome back. In this video, it's all about machine learning pipelines, really thinking about them at a high level because we don't want to get into machine learning and compare it to AI engineering without that mental model for machine learning. And the best way to do this is the pipeline. And the first one is data ingestion. This is where you take raw data that you're going to use for your machine learning project. And in any real project, these stages work back to back. So the next step is data prep.
0:30So data prep is really focusing on access. Can I ingest this data? Do I have access to this data? So you have the raw data. Now you need access to that data. And also quality is important. So this is very common in data science. In fact, a lot of data scientists will say that most of the time was spent on data cleaning. So imagine the time savings and the efficiency boost that they're going to get using AI as a force multiplier, especially for data cleaning, and also efficiency.
1:00Now notice that data ingestion and data preparation, this is where you collect the raw data and start cleaning it and preparing it for modeling. What do you think goes next? I said it already, modeling. All right, so modeling is where you actually build a model. And we'll use either PyTorch or TensorFlow later in the course. And what happens after modeling? Again, this is software 2.0, which can be deep learning, machine learning, or deep learning. And if you said training, that is correct because we already experienced the hamburger and hot dog binary classifier.
1:37And what did we do? We collected that data. Here they are. I have our friends, hot dog and hamburger. So it was really easy to collect that raw data because we created it. And then we didn't really clean it because there was no pictures of bananas or French fries or something like that. But we did make sure that it was 100 samples of each. And that has to do with quality and efficiency. So it was a very simplified version of what you would experience. But then we got into modeling, right? The modeling was done by a teachable machine.
2:08We really didn't have to code anything. It's a no-code example. But what we did do is train the model. So it went through, I believe, 50 epochs. That's 50 times. And each time it got better and better and better, which simulates the learning part. And here we measure, diagnose, and adjust. In our case, it was pretty easy. We just clicked on training. We didn't tell it how many times to train. We didn't work with all the other hyperparameters. So all you have to remember is that we have to get the raw data and prepare it for our model.
2:41We pick the model that we're gonna use and the frameworks and all of that. And we kind of build it out. And then you connect the data and start training on that data. And next is very important. This is evaluation. And here we would have a test dataset and sometimes a validation dataset. And this is how you measure the performance. So here we have a train dataset. So this is how the model learns. And then you have a test dataset with unseen values or data.
3:12That way you can compare how far off are we between these two. And that is really evaluation. And then deployment. We deploy our model. And this is where you serve that model to your users. But you also wanna monitor because you don't wanna just deploy and forget. There's all kinds of things that can happen. And without monitoring, wow, that would be a lot of risk. Now let's consider this whole pipeline because these stages don't live in isolation, right? They influence each other.
3:43For example, if the data ingestion is messy at this stage, well, it's gonna affect modeling and it's going to really impact it negatively. Also for data preparation, if we don't do a good job here, even the best models are going to perform poorly. And I've seen this way too many times. And once you don't evaluate it correctly, then you're gonna think that, hey, I have a really awesome model. I'm getting 100% on everything. But if you test it with a test dataset or validation dataset, you can see that, well, I'm actually not doing so good.
4:20You'll see a percent, maybe 100% on the training data and then 50% on the test data. And this is called overfitting. It's a common problem. If you don't validate your model, you're gonna think that it's awesome and it's completely wrong. So evaluation is critical. And finally, if we don't do a good job deploying the model, then even the best model may never be useful in the real world. But more importantly, if you're not monitoring, let's say that you had a model that was 85%. Well, if you don't monitor, you might miss the fact that it's going to 80% and then 50%.
4:55The performance is drifting. And how would you know if you're not monitoring? So these all work together. A good performant model that stays performant ensures that each one of these steps are done properly. Let's say you build an awesome model. You have great training data and evaluation and deployment, but you didn't clean the data. So your model is overfitting and then the evaluation is really where you see, wow, this model is not performing very well. And it has to do with the first step. Those two purple steps are very important.
5:28When we were working with Teachable Machine, we took pictures with a very simple user interface by holding up an object and then boom, it's working. Well, that was a very good example to understand how the process works, but that is not how we do it when we're building our models. And that's why we looked at this pipeline so you could see the importance of each stage. Most of our early focus in this course will be on data preparation. Also building models or modeling, and then training so that our models can learn from the data and then making sure that there is no problem.
6:02So evaluation, and you might be asking yourself, well, why are we skipping the other stuff? Here's why. We really need to build that foundational intuition about how the models work. So let me write ML here, and then here it's going to be AI engineering, and we're going to focus more on deployment, monitoring, and system behavior. Partly because AI engineers are not preparing the data, modeling the data, training it, and evaluating it. That's already been done with deep learning to create that foundation model so that the AI engineers can then focus on deploying a model, normally a foundation model, with monitoring and system behavior using system prompts and RAG and all kinds of techniques that we'll get into later in this course.
6:49So don't feel as if you have to master this whole pipeline right now. Instead, we're going to zoom in on different parts at the appropriate times in the course before we get into frameworks like PyTorch and TensorFlow. All right, so that's it for this video. And in the next video, we're going to look at machine learning engineers and ask a question, how do we make an AI system useful, reliable, and usable in the real world? All right, I'll see you in that next video.
Machine Learning vs AI Engineering Workflows
0:00Machine learning and AI engineering overlapped, but a machine learning engineer might ask, how do we get a model to learn patterns from data? I would say an aspiring machine learning engineer and an aspiring AI engineer might ask, how do we make an AI system that's actually useful, reliable, and usable in a real world product? Because that's what everybody's really focusing in on right now, much more than machine learning. And if you're asking yourself, well, which is the best of both worlds, right? Ideally, if you have a data scientist that also performs AI engineering, that is the best of both worlds because a data scientist really focuses on cleaning data, preparing data, modeling that data in different ways, which includes machine learning, but there are many other techniques. So this is really the sweet spot, but it might be overkill.
0:52For some applications, all you need is AI engineering. And for some applications, it's really focused on model building. And these differences might sound small at first, but it really does affect almost everything. So I said they overlap. So let's go ahead and draw that here. So here we have machine learning and here we have AI engineering. So let's take a look at some examples. So let's say I gathered a bunch of labeled emails, and then I want to train a model. This is almost like pseudocode. And the goal here is to classify.
1:23We want to classify them as, let's say, binary classifier, spam, not spam, because this makes sense. If it's spam, it goes into the spam folder. If it's not spam, well, you can read it. Nothing happens to that email. It doesn't get rerouted. And I would say that this is a classic machine learning problem. And you might ask yourself, well, what is a machine learning problem and what is not a machine learning problem? This is a good machine learning problem because we can learn from the data and then start to make predictions on new and unseen emails, right? Data. However, music is not a problem that needs to be solved. And there are a lot of AI engineers and machine learning engineers that are trying to solve music, but it's not a problem. You can do creative things with it. For example, musicians don't like to play music, right? Like boring elevator music.
2:16Well, that's a great job for a machine learning engineer to create a generative AI, again, AI engineering with fine tuning on lots of audio data to create corporate music or elevator music. But the act of creativity is a human activity. So when you start replacing human activities that bring joy and value to society with a robot, a machine, that's not a good problem. Right now it's happening a lot. However, spam and not spam, that is a great job for a machine learning model and not a human being to look at that. So some problems are problems that need to be solved and some are not.
2:56But I did want to mention generative AI is very powerful, but we really need to think about the problems that we're solving. And now let's think about the pipeline here. Going back to this classic machine learning problem, it's already been solved, but we're using this as an example. When we're considering the pipeline, you want to care about the quality of the dataset, the features or the representations, the model that you're going to use, and the training process. And finally, the most important is the evaluation metrics, because you don't want to say, oh, my model is 100% accurate. That is very rare. When you do the evaluation, you might notice that it's something like 70%. And for spam, it goes down a little bit low. We want to get that higher, right?
3:37But in some cases, 70% will be acceptable. In some cases, you would need it to be 99.9% for surgery, right? So it really depends how performant your model needs to be. But now let's think about AI engineering. Here, let's build a workspace assistant, and this could be Google Gemini or Microsoft Copilot inside of the Microsoft suite of applications. Those already exist, but let's say that we're building a local environment assistant for our workspace. This could be useful for a startup, and you can have the workspace assistant read policy documents, answer employee questions.
4:15Let me put this here, internal. Also, citations, so we know that the model is actually referencing either policy or existing documentations, and we need guardrails. Those guardrails ensure that when the model doesn't act as you would expect, we can gracefully manage those. And that way, we can avoid confident misinformation, which is everywhere right now. But you definitely want to create guardrails and avoid that in an internal workspace assistant. So this is going to be much closer to AI engineering than machine learning. And now I care about the foundation model, not the model that I'm going to build. So here, with machine learning, it's model building. And here, it's really about the foundation model. Let's say you're interested in programming or you're interested in text.
5:07Depending on the model, you're going to get different behaviors, so you can test them out. You might choose Cloud Anthropic. You might choose Grok for programming. Those are foundation models. And then you want to think about prompt structure because you're not programming with code. You do that with machine learning, but with AI engineering, it's prompt engineering. You're programming in English or whatever plain language you speak. And we're also going to talk about retrieval augmented generation, and that's where you provide policy or internal documents that can be used for that model, this foundation model, to provide outputs that include proprietary information.
5:48Because models, foundation models, aren't trained on your company data, especially if it's a startup, right? That data doesn't really even exist. So how do you get that into the model? If you're a machine learning engineer, you could fine tune it with that, meaning take your internal documents and train it. But that is very expensive compared to AI engineering, and it's more of a permanent solution. Whereas AI engineering is great for internal docs because they change all the time. So all you have to do is upload whatever documents that you have, and that way, RAG is better than fine tuning. So we'll cover fine tuning and RAG later. We also care about fallback behavior. If something goes wrong, the output format is critical, right?
6:31You want the output to look good and to be useful, and you don't want it to take forever. You want to make sure that it's fast and you want to build trust. You want to make sure that you're handling things like PII or protected health information. All of that needs to be protected from these models because it is a liability to put information into a foundation model. For example, if you're using something like chat GPT, that model indefinitely stores a lot of data and it can leak that data and be used for training. The same thing goes for Grok, right? That's another model, but Grok is great for X and real-time information. Gemini from Google and Copilot with Microsoft, those are better for compliance because those models are built inside of the identity boundary for your organization. So there's a safe connection between those documents, not so much for Grok or for chat GPT. They're outside of your organization. So definitely consider the right foundation model in this scenario. And what else do we care about?
7:36System reliability. That would be monitoring. So what changed between these two? In the first case, machine learning, this is really about learning, right? So the model learns from the data. And in the second case for engineering, this is mostly about system behavior. You're guiding this foundation model to behave in the way that you want. But here's another way to think about it. Machine learning is a workflow that often ends with here's my trained model and here are the evaluation results, right? Let's say that it's 70% and that's good enough because you're just dealing with mechanical machines that do some sort of simple agriculture and it doesn't have to have a very high accuracy percentage. And in here, this is maybe you care about having it be very accurate.
8:27And that's more about machine learning, really looking at those evaluation metrics. Now, when we go to AI engineering, the workflow often ends with here's the working application. Here's how the model behaves inside of it. And here's how we tested reliability. And more importantly, here is how users are experiencing this moments where you can do thumbs up and thumbs down. That is called reinforcement learning with human feedback, RLHF. And you have to create system prompts to steer that behavior. But you also have to monitor the exchanges, the conversations to make sure that there is not inappropriate information, failures of security. You start very conservative.
9:10And as the performance improves in these AI engineered models, then you can rely on it more and more and increase the users because you've tested it. It's a very different approach. So not every AI system needs you to train the model from scratch and not every predictive problem needs a giant language model. And not every useful data product is AI engineered. Also, not every AI engineered workflow is machine learning heavy. There is a little bit of an overlap where you might fine tune a model and create an AI engineered product, or you create your own foundation model and you create your own AI engineered product, which is very expensive and is done by large companies with large budgets. All right, so now let's look at machine learning at a high level in the next video.
Machine Learning and AI Engineering in Practice
0:00In the last video, we looked at AI engineering and machine learning and how they overlap. And in this video, we're going to cover machine learning at a high level and AI engineering at a high level. So one way to define machine learning is to say that it's a way of building systems that learn patterns from examples instead of depending on handwritten rules. So it is not software 1.0, which is traditional programming. The models learn from the data, meaning that it's software 2.0. And again, that could be machine learning or deep learning. And this is an umbrella term machine learning because deep learning is a subset of machine learning. It's the newer version of machine learning.
0:42And it uses those neural networks and machine learning up here uses algorithms, but they both learn from the data. That's the core idea. So in traditional programming here, we're telling the computer exactly what to do. We write the instructions, we define the conditions and we control the branching of logic and machine learning or software 2.0. We still write the code, but the code is no longer the whole intelligent system. Instead, we use code to define the training process. So we're really just feeding the system some data and let it adjust the internal parameters in those hidden layers that we discussed. And then we can evaluate whether it learned enough to be useful, to generalize on new and unseen samples.
1:25So that's inference. So the heart of machine learning is not just predictions. It's learning from the data in a way that can extend beyond the exact examples seen during training. So you have training data and then you get a 75% accuracy rate. And then you measure that data, right? To see if it can make predictions. And that means that you're going to show it data that is not seen before. And then you're going to get an evaluation metric there. And let's say it's 72%. Very close to this. That's pretty good. So you have a performant model for whatever the metric threshold is. And that is 75% in this case. Now let's talk more about machine learning prediction. And again, we're doing this in English because we're going to do some pseudocode very soon. Let's say you want to predict a number. So in that case, we could use machine learning for house price prediction. Also sales forecasting, temperature estimation, and maybe demand. So you want to predict and demand prediction. This is often called regression. But if I want to predict a category, let me go ahead and put an arrow here for number. And for category, we might use machine learning for spam, not spam. It can also be for fraud versus not fraud. And we can continue with
2:47this churn, not churn, positive or negative sentiment. I'm going to write this one because it's also called sentiment analysis. If you ever hear that you're just predicting, in this case, binary, positive or negative sentiment, or maybe cat versus dog pictures, or hot dog versus hamburger, or handwritten digits. This is often called classification. And you already know that machine learning is not one single algorithm. It's a family of approaches for learning useful patterns from data. And those patterns live inside of models. So let's say the model is simple, and you need to perform regression like we have here. It might be linear regression or logistic regression. But if you're dealing with more complex data, you might use neural networks.
3:35All right. So this is a pretty good definition of machine learning and the different kinds of predictions we can make with numbers and categories. Now, in your mental model, try to remember the pipeline. So the workflow usually involves the same ingredients, data, labels, or targets, a model, training, evaluation, and then prediction, right? Once you have that, you can start making predictions. That's also called inference. And at this point, you might be saying, okay, I get it conceptually, right? Classification and regression, numbers and categories. All right. House prices or sentiment analysis. But let's put this into concrete terms.
4:14And let me show you the numbers that we're going to predict for regression. Let's say that we're working with student data, and we're going to have only two inputs in this case. And that could be hours studied in the attendance. Let's call this rate like a percentage. So these are the two inputs. And now we want a target. And so that target is going to be if a student passes or fails. Very simple. And now thinking about the machine learning workflow, we might do something like this. So it's very common to use X as the variable for your inputs. I'm not going to get it too detailed into the code, but let's create a representation of some code here. And in the first one, you might have two and then 0.60. Okay. And then you might have another one and that says like five, 0.80. And you're going to have n number of samples. So right now we have two, but that's very little. You need a lot more than two. So this represents the hour study two and the attendance rate in this case is 60%. Now the target here is represented with lowercase y. So we'll talk about the reasons why we use uppercase X and lowercase X later, but for right now, X and Y input and output.
5:32So the output is also called the target. So let's say we have an output for these two. So the first one is going to be fail. And the second one is going to be pass. So let's define these one and zero. All right. So we have the input examples here with X and then the labels, the output or the target is why, but where's the intelligence? How is it learning? We haven't done that yet. So this is the setup for learning, right? And later we choose the model, then we train it. And then we see if it can predict the correct labels for these cases. So when I say machine learning, I want you to think data in pattern, learn prediction out, and that's it. That's a good mental model for now. Now switching gears to AI engineering at a high level, we can compare them. If machine learning is about getting a model to learn patterns from data, then AI engineering is really about useful systems built around AI behavior. So that's the AI engineering part. And that means it's less about inventing a new model from scratch and more about making an intelligent behavior that actually works inside a real application or a workflow or a product. So the kinds of questions that an AI engineer cares about are which foundation model is best. Let's say you want to use real-time data
6:54that comes from all over the world. Well, Grok is a good idea because it's connected to X that has a lot of real-time data. The problem there is that there's a lot of noise. So you have to find a way to amplify the signal. But let's say you want to use a model, foundation model, as a writing assistant. A lot of people say that Claude from Anthropic is a good way to go, is good at writing. So you pick that foundation model. And then you say, do we need a classifier or a language model or a modal model? Remember that one? You can give it multiple types of inputs like audio, image, and then get some kind of video that goes out. Another question might be, how do we structure the prompts? So that is prompt engineering, which includes something called system prompts, which is also part of prompt engineering. This is how we steer the model. If you're using a product like Whoop, I use this and I can show it to you right now. So right here, you can see this band, right? It's just a band. There's nothing to read. It's just tracking my health data. And on this side, I have a watch. I really turn off most of the features on the watch. And I just use it to say, I'm going to start this kind of workout. And then this one over here will record that data.
8:11In that case, the prompt engineering and system prompts, you might say something like you are an expert trainer for athletes. And you might use a system prompt that says you are a health application trainer and you provide concise, helpful information based on user exercise data. And then that way you get an LLM or an assistant that is highly effective. And Whoop is one of the best AI models that I've used because it makes sense. It cleans the data and provides really actionable, concise information that I can use on a daily basis. Everybody can be a data scientist with this application. For me, I can talk to the model and we can actually perform experiments conversationally. I can do an A-B test. These are things that we do as data analysts and data scientists, a little bit outside of machine learning and AI engineering. But again, this is what I was saying. These models meet you where you're at. So I'm able to use it as a data scientist, but a casual user can say, help me use data science techniques to improve my fitness.
9:15And that's sort of what it's doing in the system prompt behind the scenes. And it's very effective. And that is also all about context, which Whoop is recording on my wrist. How do we give the model the right context for Whoop's case? Well, they give me a band and that's how it's done. And an AI engineer also might care about and ask, how do we make the output predictable enough for real users? And how do we reduce hallucinations or low quality responses? Misinformation, prompt engineering is a big part of that. You might ask how to evaluate whether the system is actually useful. In that case, there are frameworks like Lang chain that allow you to monitor the interactions and make any adjustments as you go. Because these models are not measuring the performance from training data to evaluation data, you're training the data or you're improving the AI engineered model by looking at the chat conversation. And finally, how do we integrate this model into an app, meaning the foundation model? Maybe it's going to be on a website or it's an assistant or an internal tool. All right. So we know that machine learning, the focus is on training data labels, maybe the model improvements, the evaluation metrics and inference or predictions.
10:34However, in AI engineering, the focus is more on foundation models or model orchestration, meaning you can use more than one foundation model. Also, user interaction. We want to make sure that the model isn't saying inappropriate things and hallucinating and giving the user wrong information. And that ties into reliability. Cost is a very big one. These tokens can get very expensive. So you really need to monitor the cost as well. And speed is latency. This is a very important consideration, which ultimately leads to system behavior, which we can steer with prompt engineering. And in the previous machine learning workflow, we built a spam binary classifier. So spam, not spam. Right. So that was logistic regression in this case. But if I build an AI internal assistant that can search internal documents, answer questions, cite the resources, follow tone instructions. Again, that is prompt engineering and return a nice output for a positive user experience. This is really AI engineering. Right. Also, we can create a chat bot that greets users and pulls account details from a tool and answers simple questions and then escalates harder
11:53cases safely. That's also AI engineering. So very similar to the Whoop app. Right. I've actually said, hey, send us honest feedback. And it says, I'll send that for you and make sure that we use this information to improve. There's many ways of doing this. You can also build a writing assistant that rewrites rough internal notes into polished emails and follows the not only the company tone, but compliance. Right. That is also a good example of AI engineering. So AI engineering is not just using AI. It's designing systems that make AI useful. A big difference. And it's way more than chatbots. People think that, you know, these chatbots are AI and that's what's going to turn into AGI. You may have heard of AGI. That is artificial general intelligence. It's the next level. But chatbots are just one sliver of generative AI and there's machine learning and deep learning and so on. All right. So that's it for this video. And in the next video, we're going to talk about data science, data analytics, and also data cleaning, which is super important.
12:58See you there.
Data Analysis, Data Science, and Data Cleaning
0:00Welcome back. Now it's time to widen the fields a little bit, because if we only talk about machine learning and AI engineering, we can accidentally make it sound like it's a whole field that starts with models and it doesn't. A lot of the real value happens earlier. And this is when people are still trying to understand the data, define the problem and figure out whether a model is even necessary. And this is precisely where data analysis and data science comes in. So let's check them out one by one. Data analysis is more about exploring data, finding patterns manually or with tools, answering questions and ultimately helping people understand what is actually happening. So they might summarize trends, compare groups. Again, this is very common in business intelligence or BI. They might check distributions. For example, you might get a normal distribution with most of the values here in the middle where everybody is getting a passing score of, let's say, 60 and very few are getting 100 and very few are getting zero.
1:05Again, these are ways of finding patterns. They might also investigate anomalies and even building dashboards. That's a very common part of data analysis. So what patterns are they discovering? So it could be churn is rising in one customer segment or that support response times are getting worse on Mondays. Makes sense. And that sales performance is going to vary by region or the key metric is being calculated incorrectly. That is incredibly valuable work. And not every one of those insights needs a machine learning model. In fact, you could do this without it because historically data analysts have not been using machine learning models until recently.
1:46We can say conversely, data science. This is a much broader field. So we can say data science is like this and you might have data analytics over here. You might have machine learning over here and you might have AI engineering over here. So data science touches a lot of these domains. So depending on the team that might include all of data analysis plus experiments, let's perform an A-B test to see if one website page works better than another or maybe a button to increase sales.
2:21Also, it is statistics heavy and that is for statistical reasoning. Another way to describe machine learning is statistical learning because here this is done historically without machine learning models, but now you can use machine learning for statistical learning where they learn the patterns on their own. Also feature design, maybe combining different columns to create new features, but there's also modeling. Not all data scientists intersect with machine learning to do modeling, but I do. And I started my journey as a full stack developer working through data analysis and then working through data science and then machine learning and then deep learning and then AI engineering. So you can think of that as another full stack. So there's full stack engineering and now there's full stack AI, which I believe includes full stack, data science, machine learning, and AI engineering. That's because I have ambitious goals and I'm an educator, so I've gone sequentially through that path, but that is not the most common path.
3:26Different jobs require you to do different things and different backgrounds will lend themselves to different paths. So maybe data analysis is all you needed for your role or maybe machine learning engineering is all you needed because there was a data science team and they would give you these clean data sets and then you would build models on them. You didn't really have to do data analysis or feature decisions and things like that. Think of it like this, data work or data practitioners use layers. Sometimes the right move is analysis. Sometimes it's modeling. Sometimes it's an experiment or maybe improving labels or a machine learning model. And sometimes it becomes AI engineering. So let's take an example. Let's say a company says, we need AI to reduce customer churn. All right. So when I see that, I would ask, why do you need AI to reduce churn? I would prefer a question. We need to reduce customer churn and not add AI, but let's say they did.
4:25And there's a reason for it. And I signed off on it. So what are the questions that we might ask? So a data analyst or data scientist might ask, what exactly counts as churn? So the data definition is the target label consistent. So we're thinking about the labels, right? Because we're going to train a model and are we measuring the right time window? So the data window, because maybe we're using historical data and there's a lot of data, but we just want to focus on this window because what happened there? So is the churn problem actually concentrated in a few specific customer types or do we need a model or maybe first we need a better dashboard and a cleaner definition. This can bring incredible value to your team because it reduces a lot of the problems that happens before it gets to a machine learning engineer. And before it gets to an AI engineer, garbage in garbage out, this first step is critical. And maybe you're responsible for all of this on your team. It really depends. Maybe you're only building models or maybe you're only doing AI engineering. Just wanted to put that out there to really clarify this context.
5:34So whether or not you have a data science team, we have to think about data and analytics and data science and make sure we're covering all the bases and short data analysis and data science provide foundations that makes the models or the products smarter and more efficient and performant. And now we're going to segue to data cleaning because it's one of the least glamorous, but most important parts of the whole stack data cleaning. I have to say, it seems like, wow, it's such an unglamorous thing, like being a data janitor. I can't tell you how many times I've heard that from data scientists. And it's true. It feels like we're cleaning the different sort of environments for the data in the data itself. But if you don't have that background cleaning data, let's talk about that real quick. And what we see out there, especially with vibe coding, is that people want to build models. They want to use different frameworks and they want to add some prompts and they want a really cool app or a demo. But if the data is dirty, the whole thing crumbles. And that's not only for vibe coding, but for companies and organizations and even enterprise. You'd be surprised how really big companies are skipping on these elementary steps, creating security vulnerabilities and poor implementation of AI. Here's why the
6:54model learns from data that you give it, not the data that you wish you had. So what does this mean? Data cleaning. When you get raw data, I can say with a high degree of certainty that it's almost never going to be ready for modeling. So what does that mean? The kinds of problems that we're talking about here are things like missing values, duplicates, often rows, inconsistent values, inconsistent labels, mixed data types. A very common problem here are mixed date formats. You're sending it as a string meaning text, but it needs to be an actual date time object. When you don't do that, it's going to break stuff. Also, you can have broken text encoding, noisy text, mislabeled examples. Remember hot dog and hamburger? How about if we said hot dog and beef stroganoff?
7:44Well, one of those examples called beef stroganoff is going to mess with the performance, right? And unlabeled classes. We had 100 images of hamburger and 100 of hot dog. But if you had 1000 of hot dog, guess who's going to win all the time? Almost everything is going to be a hot dog to this model, right? So you want to make sure that you have balanced classes. And there's also data leakage between training and testing data, a lot to take into consideration. For example, the inconsistent labels, let's say you have spam, all lowercase, or spam, all uppercase or spam, title case, and then another one just says junk altogether. Well, all of these need to be standardized, somebody needs to merge the data sets. And now those categories mean slightly different things. So we need to fix these very small details, including duplicates, maybe the same email appears many times because there was some sort of export problem, or the training data set accidentally included a version of data that leaks the answer. These are all very important considerations. Alright, so that's it for this video, I just wanted to make sure we covered this because it's happening right now. It's a real serious problem. But if you address it and you have these skills, you're going to bring a lot of value to your organization.
9:01I'll see you in the next video on the pseudocode crash course.
Pseudocode Crash Course
0:00Welcome to this video. Before you move into the final challenge, I want to give you a quick but very important tool, and that is pseudocode. Pseudocode means writing the logic of a system in plain English before you write the real code. You can do this with software 1.0, rules by hand, software 2.0, which is the learning of data from either a machine learning model or a deep learning model, and even software 3.0 when you're doing AI engineering or working with generative AI.
0:31If you're a vibe coder, all of this can be very helpful. And this is where I differ from a lot of the online courses on machine learning. They really focus on getting you to write code immediately using frameworks even and working with the hand digit classifier or different popular data sets for machine learning. You can either have the code written for you or you can write out the code yourself and then you execute their code and they explain it as they go, right? And then you get some sort of a model and some kind of an accuracy. It's like, oh, wow, 85% accuracy, but so much has been abstracted. So my approach is to leverage pseudocode and talk about it so that you're understanding the logic of what's happening before you get into the syntax, because that syntax will also change from framework to framework. And it's easier to think about one thing instead of two things. That's just how the human brain is wired. So if you have a good understanding of the pseudocode or the logic, then you can just extend that to the different frameworks and you can be syntax agnostic at that point. That is going to be very, very helpful when the performance is not 85% because someone wrote it for you, even a model or an online platform. It's up to you to understand why it's 85%. And usually it's
1:50not going to be 85%. It might be 50%, just as good as guessing. And you want to understand the logic so that you can increase the performance because you understand what is happening in those hidden layers where you have activation functions and all kinds of hyper parameters, like the learning rate, which are very key to the performance of these models. So I like to do this in plain language. First, the goal here is to give you a deep system understanding so that you can express yourself in Python or any other language and definitely treat this as real technical thinking.
2:24This is not a fake version of coding, right? This is as good as it gets. So here's why it's helpful. When you start building a model, you might ask, what is the input, right? So you slow down and think about the system for a minute. And that's exactly what you want to do. That's a great way to start. Also, what happens to the input, what decisions are being made and what should the output look like, right? And how do you know if the model or system works? So let's think about the pass fail system for student scores that we talked about earlier. In that example, you can write, read the student score. And I'm going to assume that you've cleaned the data. All right.
3:03And now you're ready to ask these questions. And if the score is greater dot, dot, dot, and this could be any logic, it could be is greater than or equal to 70 return pass. I'm just going to leave these dots for some kind of logic and then otherwise equals fail. Very simple. So this is not executable in Python, but it's absolutely clear syntax logic. If you put this into a chat bot, you would probably get code that works. It's not terribly difficult, especially if you provide the student scores. And if you're thinking about general machine learning, you might say gathered label examples, then split the data into training and test sets, choose a model, train the model on the training data, evaluate the model on unseen test data, improve the data or the model if the results are weak. So ideally you would not have to go back and clean the data because your model is not performing well, that should be done. However, if the data is clean and you have solid data and the model is not performing well, then you know where to look.
4:06And for general AI engineering systems, pseudocode might sound like receive the user's request, which would be a prompt, gather relevant context. This might be retrieval, augmented generation, send the request in context to a model, return the output in a useful format, and then log the result for review or evaluation. So very similar, but it's completely different in terms of what the tasks are. So the questions mirrors the workflow, and that's the takeaway.
4:37Pseudocode lets you think at the right level before implementation starts because it can easily distract you. So in the challenge, we're going to try this out and I'm going to give you a colab notebook that has completed code and you have to write the pseudocode above, and it can be as simple or as complex as you like. Just make sure that it represents what's happening in the code below. So it's kind of like reverse, right? You write the pseudocode, that's your challenge, and the code already exists, but it has to sync up with your logic.
5:10And I think that's going to be a great way to make some connections and it should be a lot of fun. So I'll see you in that next video, which is the challenge.
Challenge 🎉
0:00Congrats and welcome to the final video and the challenge. Your task is to solve the same problem three different ways so that you can see very clearly how the paradigm changes the logic, the workflow and the strength of this solution. So here is the shared problem. Classify an email as spam or not spam. All right. And that's it. This is a great challenge because it's familiar, it's realistic, and it's simple enough to compare across different software styles without turning it into a giant project.
0:34So we're going to take that one task and use software 1.0, 2.0 and 3.0. In the previous skill, the challenge was really focused on this. So we know that software 1.0 is where you write the rules yourself. That is traditional programming. Software 2.0 is where the system or the model learns from labeled examples, which includes machine learning or deep learning. And 3.0, you steer a pre-trained foundation model or model with plain language.
1:08This could be generative AI or all the way to AI engineering. Generative AI, just to clarify, is when you talk to a chat bot or some generative AI application and you use a prompt and then you get an output, right? Give me a picture of a rocket that is not made out of metal, but instead it's a banana flying through the sky. You can have fun with that. And that's basically gen AI. And as you know, now, AI engineering is a lot more. This is where you steer the model using many, many techniques, including programming, but also guardrails and many other things.
1:45Just wanted to make that general distinction that this very simple part really is using gen AI. But here, gen AI also includes AI engineering. And what's great about this is that the problem here stays the same, but the mechanics change. So let me walk you through exactly how to complete this challenge using pseudocode. So this notebook is going to be made available to you. All you have to do is click on that link. And when this opens up, you want to go to file and save a copy and drive. You might be prompted.
2:16Let me show you what I mean. Here, I opened this same notebook in a private tab because now you see changes will not be saved. I'm not signed in. And it says copy to drive. So you don't have to go here, but you could do that to go save copy and drive. But you can just as easy just click on copy to drive. When you do this, you have to sign in, but then you can actually choose where you want it to go. OK, so I'm going to close this and then we get back to our main notebook where I am logged in. And so let's go through this.
2:47This first one right here is rule based spam classifier. And here is a section for pseudocode. The solution code, meaning one through five written solutions are provided here for your benefit. And you can check those after you complete the first five. So this is a self graded collab notebook challenge. And here is the text out with the solution. So go ahead and click on this carrot to expand it. Once you've filled that one through five. So what do I mean by one through five? So here in this first one, this is really what the system is going to receive.
3:21And this next one is what the system does. And then this could focus on the output. And here you can say, well, here's the strength of the system. And here is a weakness. This is my approach, but you can do this however you like. You can add more numbers or you can reduce the number of numbers if you don't need that many pseudocode steps. That structure is important because it forces you to think like a systems designer. For example, in software 1.0, your pseudocode is going to include something about email text, right, all the way to the output of spam or not spam.
3:57So that's pretty straightforward. Now, let me take you through each code example. So here's software 1.0 rule based spam classifier. And here we have a simple function. And what is important to understand here is that we're giving the system in this case, very simple phrases. This is a focused educational toy data set, right? We just have five very simple things. But imagine spam phrases could be very large. So it's good for deep learning, in my opinion, or machine learning, depending on how many emails you have and what the objectives are.
4:30So here we're going to make sure that the email is lowercase. And we're going to look at the suspicious phrases. And if that phrase is found as lowercase right here and email lower, then return spam, because if this is in any of your emails, pretty sure that it's spam. Otherwise, it's not spam. So here are the emails that it's going to check. So it's checking to see if any of these have these suspicious phrases. And then this is the output. I'm not going to do the output. I'll let you do that. And for software 2.0, I'm not going to go through the pseudocode.
5:00I'll leave it up to you. This time I added six steps because that's what we're using in the output. And I want you to see that this is learned behavior. Instead of writing the rule manually, the model learns from examples from data. Here, we're going to use scikit-learn. All right. So we're not using a framework just yet. And we're not going to get into scikit-learn because this is an introduction to machine learning. However, if you want to get into machine learning and you want a proper machine learning course, please let us know in the comments. This is going to help us to understand what you are looking for as far as the courses in the context of machine learning.
5:35And if you want a course all on AI engineering, again, let us know and we'd be happy to take a look at that. And if there's enough interest, we will make that course for you. All right. So we have a similar system here. We have emails. So this is our small labeled data set. And here are the labels spam, spam, not spam, not spam, spam, not spam. And here we're going to build a simple text classifier. Here's where we train the model. So model that fit and we're using the emails and the labels. Right. So the input and the output here, we're going to classify these new emails.
6:06So new emails, action required. Confirm your direct deposit information. And here is another email. And then the predictions. And here is a pseudocode solution. And finally, for software 3.0, you're going to do the same thing with the pseudocode and then AI engineering. So what we're doing here with 3.0 is steering the model behavior. We're not retraining the model. We're just prompting. Right. That's how we steer with plain language. And down here we have the solution for the pseudocode. Be sure to look at that after you fill these five out.
6:37Again, you can make these as short or as long as you need to. And then finally, we have the bonus. So API style example. The reason I'm adding this here is it's very common to see something like this in AI engineering. Right. Here is a structured prompt. So this is a system prompt. You are classifying workplace emails. Now it knows how to behave and you're going to return. This is like focusing on the output label spam or not. Spam reason one short sentence. And this is where the generative AI, the foundation model can actually do that because it's being instructed very clearly.
7:11And then finally, you get the email and the email text, and then you would do some sort of response talking to that API, just including this here for your reference. OK, the exact SDK will vary by provider, but the pattern is pretty much the same. We close this and that's it for this skill. So until next time, I hope this has been informative. And I'd like to thank you for viewing.
Frequently asked questions
What is the difference between machine learning and AI engineering?
Machine learning focuses on building a model: training data and labels, model improvements, evaluation metrics, and inference or predictions. AI engineering focuses on deploying and steering a foundation model that has already been built, with attention to monitoring, system behavior, predictable output, and integration into a website, assistant, or internal tool. This lesson walks a team member through both workflows side by side so the team shares one mental model of where each discipline starts.
What are the stages of a machine learning pipeline taught in this lesson?
The lesson traces the pipeline from raw data collection and cleaning through modeling, training, and evaluation, using the earlier hamburger and hot dog binary classifier as a simplified example. It explains that early focus in the course stays on data preparation, modeling, training, and evaluation to build foundational intuition before frameworks like PyTorch and TensorFlow, while AI engineering work centers on deployment, monitoring, and system behavior.
How do AI engineers reduce hallucinations in an internal workplace assistant?
The lesson explains how system prompts, RAG, citations, and guardrails work together: citations show the model is referencing actual policy or documentation, and guardrails let the system gracefully manage cases where the model does not behave as expected. For an IT Director planning internal AI tools, this gives the team a shared approach to avoiding confident misinformation.
What data cleaning problems should a team watch for before training a model?
The lesson covers imbalanced classes, inconsistent labels such as spam written in different cases or labeled as junk, duplicate records from export problems, and data leakage between training and testing data. The trainer uses examples like 1,000 hot dog images versus 100 hamburger images to show how an imbalanced dataset skews predictions.
Why does this lesson use pseudocode and a spam classifier before framework code?
Writing model logic in plain English first lets a learner separate logic from syntax, which changes from framework to framework, so they can troubleshoot when performance is closer to 50 percent than 85 percent. The spam classifier challenge contrasts software 1.0 deterministic rules, software 2.0 training on labeled emails, and software 3.0 steering a model through prompting, including a bonus system prompt example.
How long is this lesson and who on an IT team is it designed for?
This lesson runs 1 hour 4 minutes and is part of the 26.9-hour beginner course Introduction to Machine Learning and AI Engineering. The course is built for programmers, developers, data analysts, IT practitioners, and DevOps engineers with basic coding experience, and Training Managers can assign it as a foundation before approving production AI work.
Team training path
Turn this skill into assignable team training
This free skill is a preview of the courses your team can assign, track, and report on with CBT Nuggets.
Free training library
More free lessons in AI for IT Professionals
AI for IT Professionals
Explore the AI Behind Vibe Coding Tools
Free lesson from AI Vibe Coding & Security: ChatGPT, Cursor & TDD · 1h
AI for IT Professionals
Explore How AI Writes, Stores, & Leaks Information
Free lesson from AI Compliance, Privacy & Copyright: Developers · 54m
AI for IT Professionals
Explain How Data Leaks Through AI Apps
Free lesson from Data Leakage Prevention with LLMs · 47m
AI for IT Professionals
Prepare for Secure AI Development
Free lesson from Secure AI Adoption and Deployment · 47m
$59
seat / mo, billed annually
