Latest / CyberSecurity Summary / Ultimate Machine Learning with ML.NET: Build, Optimize, and Deploy Powerful Machine Learning Models for Data-Driven Insights with ML.NET
Transcript
- 0:00Speaker 1: Hey, everyone, welcome to the deep dive. So data driven
- 0:04Speaker 1: decisions are pretty much everywhere.
- 0:05Speaker 2: Now, right, absolutely, and machine learning is you know, a
- 0:08Speaker 2: massive part of that picture.
- 0:10Speaker 1: It really is. But let's be honored. Jumping into machine
- 0:13Speaker 1: learning it can still feel like, well, like a whole
- 0:16Speaker 1: new world to navigate for a lot of folks. Definitely,
- 0:19Speaker 1: what if there was something powerful, really versatile and genuinely accessible,
- 0:25Speaker 1: especially if you're already working.
- 0:26Speaker 2: In the dot net world, And that's exactly what we're
- 0:29Speaker 2: digging into today. We're doing a deep dive into mL
- 0:32Speaker 2: dot net. That's Microsoft's machine learning framework, right.
- 0:35Speaker 1: Our mission here is basically to pull out the most
- 0:37Speaker 1: important stuff from the well the comprehensive guide on it.
- 0:41Speaker 1: We want to give you a real shortcut.
- 0:43Speaker 2: Yeah, it gets you well informed on building, optimizing, and
- 0:47Speaker 2: deploying machine learning models using mL dot net exactly.
- 0:50Speaker 1: You'll get the basics, see how it's actually used, understand
- 0:53Speaker 1: the steps even if you're not you know, a machine
- 0:55Speaker 1: learning guru.
- 0:56Speaker 2: Right now, So where did it even come from? Let's
- 0:59Speaker 2: start there, MLT and that it actually started life as
- 1:01Speaker 2: an internal thing at Microsoft.
- 1:03Speaker 1: Oh interesting, like an in house tool exactly.
- 1:05Speaker 2: Which kind of shows you how central machine learning was
- 1:09Speaker 2: becoming to them even back then.
- 1:10Speaker 1: And what's really compelling is that then in twenty eighteen
- 1:14Speaker 1: they did something pretty big. They released it as open source,
- 1:18Speaker 1: which wasn't just like dropping code. It was really an invitation,
- 1:21Speaker 1: wasn't it.
- 1:21Speaker 2: It really was. It means mL dot net has grown massively,
- 1:26Speaker 2: not just from Microsoft engineers, but the whole developer community
- 1:30Speaker 2: chipping in.
- 1:30Speaker 1: That open source approach that brings transparency, collective brain power. Yeah,
- 1:34Speaker 1: makes it really solid totally.
- 1:36Speaker 2: And the real power I think comes down to how
- 1:39Speaker 2: accessible and versatile it is. It's not just built for
- 1:42Speaker 2: one specific kind of problem. It handles a whole bunch
- 1:45Speaker 2: of mL tasks, you know, classification, regression, clustering, even those
- 1:50Speaker 2: complex recommendation systems. It's like a full AI toolkit.
- 1:54Speaker 1: And its platform independent, runs on Windows.
- 1:56Speaker 2: LFS, YEP, works wherever you work.
- 1:58Speaker 1: But the real kicker, I think, especially for listeners who
- 2:00Speaker 1: are dot net devs, is that deep integration.
- 2:03Speaker 2: Oh absolutely.
- 2:04Speaker 1: If you're already working in C shark, F sharp, maybe
- 2:06Speaker 1: VB dot net, you use the tools, you know, the libraries,
- 2:10Speaker 1: you know, that barrier to entry just drops way down.
- 2:13Speaker 2: It does, and that adaptability it means you can stick
- 2:16Speaker 2: machine learning smarts right into your desktop apps, web apps, mobile.
- 2:19Speaker 1: Apps, So it's not just for dedicated mL engineers anymore, exactly.
- 2:23Speaker 2: It kind of democratizes it within the dot net space.
- 2:25Speaker 2: Any dot net dev can start using AI.
- 2:28Speaker 1: Okay, So inevitably people will ask, how does it compare,
- 2:32Speaker 1: you know, to other frameworks out there, Like psyche learn
- 2:35Speaker 1: is huge in the Python world, right it is.
- 2:37Speaker 2: And it's fantastic. Psychic learn offers a really comprehensive set
- 2:41Speaker 2: of tools for Python developers.
- 2:43Speaker 1: No doubt.
- 2:44Speaker 2: But mL net well, mlnet really shines in its niche,
- 2:47Speaker 2: which is accessibility and just ease of use, especially if
- 2:51Speaker 2: you're already comfortable in dot net. The big advantage is
- 2:53Speaker 2: working where you already live, basically, which leads to the question, right,
- 2:57Speaker 2: why go learn a whole new language and tool chain.
- 3:00Speaker 1: If you can bring mL right into your existing c
- 3:02Speaker 1: sharp projects, say.
- 3:03Speaker 2: Exactly, leverage the skills you've already got.
- 3:05Speaker 1: That makes a ton of sense. Using what you know
- 3:07Speaker 1: is always faster. Okay, But maybe stepping back for a
- 3:12Speaker 1: second for someone who's heard machine learning but isn't totally clear, Yeah,
- 3:17Speaker 1: can we break down the basics what is it? And
- 3:20Speaker 1: then how does mL dot net help.
- 3:22Speaker 2: Yeah, good idea. So, at its heart, machine learning is
- 3:26Speaker 2: about letting computer systems learn from data without you having
- 3:30Speaker 2: to explicitly program every single rule.
- 3:33Speaker 1: Okay, So they learn how like recognizing patterns?
- 3:37Speaker 2: Yeah, making predictions, precisely recognizing patterns, making predictions, even getting
- 3:41Speaker 2: better over time based on the data they.
- 3:42Speaker 1: See, which naturally brings up What are they learning from?
- 3:46Speaker 1: That probably needs a few key terms.
- 3:47Speaker 2: Right, it does. So first you've got data that's just
- 3:50Speaker 2: the raw stuff, text, images, numbers, whatever.
- 3:52Speaker 1: You're working like, Okay, data, got it.
- 3:55Speaker 2: Then within that data you have features. These are the
- 3:57Speaker 2: specific measurable characteristics or tributes the model looks at.
- 4:01Speaker 1: Like if you're predicting house prices, the features might be
- 4:04Speaker 1: square footage, number of.
- 4:05Speaker 2: Deadrooms exactly, location, age of the house, those kinds of things,
- 4:08Speaker 2: things that influence the outcome.
- 4:09Speaker 1: Okay. And then labels.
- 4:11Speaker 2: Labels are the answer. You're trying to predict the target variable.
- 4:15Speaker 2: So in spam detection, the label is spam or not.
- 4:18Speaker 1: Spam, simple enough, And the models.
- 4:20Speaker 2: Are the models are the algorithms themselves. They're trained on
- 4:24Speaker 2: the data to learn the relationship between the features and
- 4:27Speaker 2: the labels. They're kind of the brain that makes the prediction.
- 4:30Speaker 1: Gotcha. So data features, labels, models the building.
- 4:35Speaker 2: Blocks, right, and these models learn in different ways. The
- 4:38Speaker 2: main paradigm is probably supervised learning.
- 4:41Speaker 1: Supervised meaning it has the answers already.
- 4:44Speaker 2: Kind of it learns from labeled data data where you
- 4:47Speaker 2: already know the correct output the label. This is super
- 4:50Speaker 2: common for tasks like.
- 4:52Speaker 1: Classification assigning categories.
- 4:54Speaker 2: Right, or regression where you're predicting a continuous number like
- 4:57Speaker 2: a price.
- 4:58Speaker 1: Okay, what else?
- 4:59Speaker 2: Then you have unsupervised learning. This deals with unlabeled data.
- 5:03Speaker 2: The goal isn't to predict a known label, but to
- 5:06Speaker 2: find hidden structures or patterns within the data itself.
- 5:09Speaker 1: Ah, so like grouping similar customers together exactly.
- 5:12Speaker 2: Clustering is a classic example, or simplifying data, which is
- 5:15Speaker 2: dimensionality reduction. And just briefly, there's also reinforcement learning training
- 5:20Speaker 2: agents through rewards and penalties, and semi supervised which mixes
- 5:25Speaker 2: labeled and unlabeled data.
- 5:27Speaker 1: That's quite a spectrum, and mL net has tools for these.
- 5:30Speaker 2: It does for a really wide array. Take classification that's
- 5:33Speaker 2: putting data into pre defined buckets. It could be binary classification.
- 5:37Speaker 1: Just two options like spam not spam, fraud not fraud.
- 5:40Speaker 2: Sentiment analysis positive and negative review all those yes, no
- 5:43Speaker 2: type questions.
- 5:44Speaker 1: Or it could be multi class classification more than two
- 5:47Speaker 1: options yep.
- 5:49Speaker 2: Think recognizing handwritten numbers zero through nine, or sorting news
- 5:53Speaker 2: articles into topics like sports, politics, tech.
- 5:56Speaker 1: Okay, what about predicting numbers.
- 5:59Speaker 2: That's regression, predicting house prices, stock prices, sales figures, any
- 6:03Speaker 2: numerical value. Mlnet is great at that too.
- 6:05Speaker 1: And you mentioned clustering earlier, finding.
- 6:08Speaker 2: Groups right Grouping similar data points without knowing the groups beforehand,
- 6:12Speaker 2: really useful for customer segmentation, finding different user types, or
- 6:15Speaker 2: even anomaly detection in some cases.
- 6:18Speaker 1: Speaking of anomaly detection, finding the odd ones.
- 6:22Speaker 2: Out exactly, spotting unusual patterns that don't fit the norm.
- 6:25Speaker 2: Think network intrusion detection or monitoring machine health for predictive maintenance.
- 6:31Speaker 1: It sounds incredibly useful, and.
- 6:32Speaker 2: It goes further ranking search results, building recommendation engines, forecasting
- 6:37Speaker 2: future trends, image classification, object detection in images. It comes
- 6:43Speaker 2: a lot of ground.
- 6:43Speaker 1: That's a seriously broad toolkit, and what gets really interesting
- 6:47Speaker 1: is seeing how this translates into actual business value. Can
- 6:51Speaker 1: we talk about some real world examples.
- 6:53Speaker 2: Sure, look at e commerce recommendation systems are huge, suggesting
- 6:57Speaker 2: products you might like based on what you've looked at
- 6:59Speaker 2: or bought.
- 7:00Speaker 1: Amazon saying customers who bought this also bought precisely.
- 7:03Speaker 2: That's mL It also drives dynamic pricing, adjusting prices based
- 7:07Speaker 2: on demand, and analyzing customer reviews automatically for sentiment.
- 7:11Speaker 1: And in healthcare, I know there's a lot happening there, huge.
- 7:14Speaker 2: Potential things like medical diagnoses support predicting disease risk. You
- 7:19Speaker 2: mentioned the Cleveland Clinic heart disease data earlier. Mlnet can
- 7:23Speaker 2: analyze data like that to help identify patterns linked to
- 7:26Speaker 2: heart disease, potentially leading to earlier diagnoses.
- 7:29Speaker 1: Wow, that's impactful definitely.
- 7:32Speaker 2: Then in manufacturing, think predictive maintenance. Using sensor data to
- 7:36Speaker 2: predict when a machining might fail before it happens. Saves
- 7:40Speaker 2: a lot of downtime and money.
- 7:41Speaker 1: Makes sense.
- 7:42Speaker 2: Finance, big use cases in fraud detections, spotting suspicious transactions
- 7:46Speaker 2: in real time, and complex risk assessment for loans or investments.
- 7:50Speaker 1: And even just everyday customer service.
- 7:52Speaker 2: Yeah, powering smarter chatbots that can actually understand and resolve issues,
- 7:56Speaker 2: or automatically analyzing customer feedback, emails or calls for sentiment
- 8:00Speaker 2: to see if people are generally happy or frustrated. It's
- 8:03Speaker 2: really weaving into.
- 8:03Speaker 1: Everything, it really is. Okay, So, if someone's convinced they
- 8:06Speaker 1: want to try this, what's the actual process? The workflow
- 8:10Speaker 1: for building a model with mL dot net right.
- 8:13Speaker 2: mL dot net guides you through a pretty clear logical workflow.
- 8:18Speaker 2: It breaks down into data preparation, then model training, followed
- 8:22Speaker 2: by model evaluation and tuning, and finally model deployment and integration.
- 8:26Speaker 1: A structured approach keeps things manageable exactly. Okay, let's start
- 8:30Speaker 1: the beginning data preparation you said earlier, garbage in, garbage out.
- 8:35Speaker 1: This sounds critical.
- 8:36Speaker 2: It absolutely is. The quality and honestly the quantity of
- 8:39Speaker 2: your data directly shaped how good your model can be.
- 8:43Speaker 2: So getting the data right is job one.
- 8:45Speaker 1: So how do you ensure good data? Step one is
- 8:48Speaker 1: just getting it right?
- 8:49Speaker 2: Data collection yep, gathering it from wherever it lives, text files, csvs, databases, APIs.
- 8:55Speaker 2: mL dot net helps here with tools like textloader for
- 8:57Speaker 2: files and databaseloader for databases, simplifying that import process.
- 9:01Speaker 1: Okay, So You've got the raw data, but it's probably messy.
- 9:04Speaker 2: Almost always, which brings us to data cleaning. This is
- 9:07Speaker 2: about finding and fixing problems, errors, inconsistencies, missing values big
- 9:11Speaker 2: part of the job.
- 9:12Speaker 1: How do you fix like missing values?
- 9:14Speaker 2: A couple of ways. You could just remove rows or
- 9:16Speaker 2: columns that have missing data using something like drop missing values,
- 9:20Speaker 2: but you have to be careful there. You don't want
- 9:22Speaker 2: to throw away too much valuable info. Often a better
- 9:25Speaker 2: approach is imputation. That's where you replace the missing value
- 9:29Speaker 2: with best guess, maybe the average mean or the middle
- 9:32Speaker 2: value median for that feature. mL net has tools like
- 9:36Speaker 2: replace missing values for that.
- 9:38Speaker 1: Okay, clean data, What next? I remember you mentioned things
- 9:41Speaker 1: like text labels need.
- 9:42Speaker 2: Handling, right, that's data encoding. Most algorithms need numbers, not text,
- 9:47Speaker 2: like red or blue, so you have to convert categorical data.
- 9:50Speaker 2: Common ways are one hot encoding, where each category red, green,
- 9:54Speaker 2: blue gets its own column with a one or zero.
- 9:57Speaker 1: Ah. Okay, so like arid is green is blue exactly?
- 10:00Speaker 2: Or label encoding, where you just assign a unique number
- 10:03Speaker 2: to each category like red one, green, two, blue three.
- 10:06Speaker 2: The choice depends on the algorithm and the data.
- 10:08Speaker 1: Got it anything else in data prep, Yes.
- 10:11Speaker 2: Super important. Normalization and scaling. Think about your features. Age
- 10:15Speaker 2: might be twenty to eighty, well, income might be thirty
- 10:18Speaker 2: thousand to five hundred thousand. Huge difference in scale.
- 10:20Speaker 1: And that difference can mess up the model.
- 10:22Speaker 2: It can. Some algorithms give more weight to features with
- 10:26Speaker 2: larger values just because they're bigger numbers, not because they're
- 10:28Speaker 2: more important. So scaling puts everything on a level playing field.
- 10:32Speaker 1: How do you do that?
- 10:33Speaker 2: Techniques like standardization, which transforms data to have a mean
- 10:37Speaker 2: of zero and a standard deviation of one or minmac scaling,
- 10:41Speaker 2: which squishes everything into a specific range usually zero to one.
- 10:45Speaker 1: Okay, that makes sense. Prevent one feature from dominating exactly.
- 10:49Speaker 2: And the last piece, which can be really powerful is
- 10:52Speaker 2: feature engineering.
- 10:53Speaker 1: Engineering features like creating new ones precisely.
- 10:57Speaker 2: It's about using your domain knowledge or sometimes just creativity
- 11:01Speaker 2: to transform the raw data into features that are more
- 11:05Speaker 2: meaningful for the model.
- 11:06Speaker 1: Like the VMI example you gave earlier, calculating it from
- 11:09Speaker 1: heightened weight.
- 11:10Speaker 2: Perfect example, instead of giving the model raw height and weight,
- 11:13Speaker 2: you give it BMI, which might be a much better
- 11:15Speaker 2: predictor for certain health outcomes. Good feature engineering can seriously
- 11:20Speaker 2: boost your model's accuracy, make it easier to understand, and
- 11:24Speaker 2: even help prevent overfitting. It's where art meets science.
- 11:27Speaker 1: A bit fascinating. So data prep is done. Now we
- 11:31Speaker 1: get to the core right model training, evaluation, and tuning.
- 11:36Speaker 2: Yep, the brains of the operation, and mlnet gives you
- 11:39Speaker 2: a couple of great ways to approach this. The mL
- 11:42Speaker 2: dot net Model Builder and the mL dot net Cli.
- 11:45Speaker 1: Okay, tell me about the model builder. Sounds friendly, It
- 11:48Speaker 1: really is.
- 11:48Speaker 2: It's a graphical tool right inside visual studio. Makes things
- 11:51Speaker 2: much simpler, especially if you're starting out. It helps with
- 11:54Speaker 2: pre processing, picking models. It even does some automated feature
- 11:57Speaker 2: engineering and hyper parameter tuning for you.
- 12:00Speaker 1: So it hides some of the complexity it does.
- 12:02Speaker 2: You can visually pick your scenario like sentiment analysis using
- 12:05Speaker 2: Yelp reviews, point it at your data, choose where to
- 12:08Speaker 2: run it like your local machine, and it guides you through.
- 12:10Speaker 2: It even suggests algorithms.
- 12:12Speaker 1: Nice. What about the cli command line interface.
- 12:15Speaker 2: That's for folks who like the command line or need automation.
- 12:18Speaker 2: It's very powerful for scripting for integrating mL model training
- 12:22Speaker 2: into say a CICD pipeline or other automated workflows.
- 12:26Speaker 1: How do you get these tools?
- 12:27Speaker 2: Pretty standard dot net ways. Now get package manager for
- 12:31Speaker 2: the libraries and for the cli. It's a dot net tool.
- 12:34Speaker 2: So dot net tool installed, gml net straightforward.
- 12:38Speaker 1: Okay, tools installed. How does the actual training and evaluation work?
- 12:43Speaker 2: Well, First you pick a learning algorithm. mL net calls
- 12:45Speaker 2: these trainers and they cleverly package an algorithm with a
- 12:49Speaker 2: specific task type. Then, crucially, you split your prepared.
- 12:52Speaker 1: Data into training and testing sets exactly.
- 12:55Speaker 2: You train the model on the training set, let it
- 12:57Speaker 2: learn the patterns. Then you use the testing set that
- 13:00Speaker 2: data the model hasn't seen before to evaluate how well
- 13:02Speaker 2: it performs.
- 13:03Speaker 1: And how do you measure performance.
- 13:04Speaker 2: Depends on the task. For classification, you might look at accuracy,
- 13:07Speaker 2: how many did it get right? Maybe log loss. For regression,
- 13:11Speaker 2: common metrics are mean absolute error MAE or root means
- 13:16Speaker 2: squared error RMS, measuring how fall off the predictions were
- 13:20Speaker 2: on average.
- 13:21Speaker 1: Okay, and choosing the algorithm the trainer you said, it's
- 13:24Speaker 1: part art, part science.
- 13:25Speaker 2: It is factors like your data size and type, how
- 13:28Speaker 2: fast you need training to be, how complex or interpretable
- 13:31Speaker 2: you need the model to be. They all play a role.
- 13:34Speaker 1: mL net has trainers for all the tasks.
- 13:36Speaker 2: You mentioned pretty much. Yeah, like says care aggression trainer
- 13:39Speaker 2: for regression, like to be a binary trainer for binary classification,
- 13:43Speaker 2: K means trainer for clustering, and many others.
- 13:46Speaker 1: And I remember you mentioned o NNX. Some trainers can
- 13:48Speaker 1: export to that.
- 13:49Speaker 2: That's right. O NNX is the Open Neural Network Exchange format.
- 13:53Speaker 2: Being able to export means you can train in mL
- 13:56Speaker 2: dot net, but maybe deploy or use the model in
- 13:58Speaker 2: other environments or frameworks like TensorFlow or PyTorch huge for interoperability.
- 14:04Speaker 1: What kinds of algorithms are we talking about? Broadly?
- 14:06Speaker 2: A good mix. You've got linear models like average perceptron
- 14:09Speaker 2: often good for text, powerful decision tree methods like light GBM,
- 14:13Speaker 2: fast tree, fast force, great vertabular data gams which are
- 14:17Speaker 2: good for explainability, SVMs K means for clustering, naive bays,
- 14:22Speaker 2: even matrix factorization for building recommendation systems. Lots of choice.
- 14:27Speaker 1: Okay, so you train a model, evaluate it, but maybe
- 14:31Speaker 1: it's not good enough yet. What's hyper parameter tuning?
- 14:33Speaker 2: Ah? Good question. Hyper Parameters are like the settings or
- 14:37Speaker 2: knobs on your learning algorithm before you start training. They
- 14:41Speaker 2: aren't learned from the data itself. You the developer, set them.
- 14:45Speaker 1: What do they control?
- 14:46Speaker 2: Things like how fast the model learns, learning rate, how
- 14:49Speaker 2: complex it's allowed to get, how much it tries to
- 14:52Speaker 2: avoid overfitting regularization, Maybe things like maximum number of iterations,
- 14:57Speaker 2: how long it trains for.
- 14:58Speaker 1: You need to find the best setting for these knobs exactly.
- 15:02Speaker 2: That's tuning. Mlnet offers ways to help automate this, like
- 15:05Speaker 2: grid search trying all combinations in a grid, or you
- 15:08Speaker 2: can implement things like random search or Bayesian optimization to
- 15:12Speaker 2: explore the possibilities more intelligently.
- 15:14Speaker 1: Seems important for squeezing out performance. What about cross validation?
- 15:18Speaker 2: Heard that term a lot crucial technique. It helps you
- 15:21Speaker 2: get a more reliable estimate of how well your model
- 15:24Speaker 2: will actually perform on unseen data, and it's a key
- 15:27Speaker 2: way to fight overfitting.
- 15:28Speaker 1: Does it work?
- 15:29Speaker 2: The most common type is kfold cross validation. You split
- 15:32Speaker 2: your data into say k five chunks or folds. You
- 15:36Speaker 2: train the model five times. Each time, you train on
- 15:40Speaker 2: four folds and test on the one left overfold, rotating
- 15:43Speaker 2: which fold is the test set.
- 15:45Speaker 1: Ah, So you test on all the data eventually, but
- 15:48Speaker 1: never on data was trained on in that specific run.
- 15:50Speaker 2: Exactly, then you average the performance across the five runs.
- 15:53Speaker 2: Gives you a much more robust evaluation than a single
- 15:56Speaker 2: train to split.
- 15:57Speaker 1: Are there variations?
- 15:58Speaker 2: Yep, Leave one out is where k equals your number
- 16:01Speaker 2: of data points. Very thorough but slow for large data
- 16:05Speaker 2: sets and stratified kfold is important for imbalanced data ensuring
- 16:09Speaker 2: each fold has roughly the same proportion of different classes
- 16:11Speaker 2: as the original data set.
- 16:13Speaker 1: Okay, that whole training and tuning process makes sense. So
- 16:16Speaker 1: you've got a model you're happy with. What's next? Model
- 16:18Speaker 1: deployment and integration, getting.
- 16:21Speaker 2: It out there right, bringing it to life. And a
- 16:23Speaker 2: key part of this is being able to save and
- 16:25Speaker 2: load your trained model. You want to preserve this hard
- 16:28Speaker 2: earned knowledge.
- 16:28Speaker 1: Right, Definitely don't want to retrain every.
- 16:30Speaker 2: Time, no way. Reusing pre trained models saves a massive
- 16:34Speaker 2: amount of time. So the process involves serialization serialization. It's
- 16:39Speaker 2: basically converting the model's internal state, its structure, the learned weights,
- 16:44Speaker 2: all metadata into a format that can be saved to
- 16:47Speaker 2: a file, usually a compact byte stream.
- 16:50Speaker 1: Okay, saving it and getting it back.
- 16:52Speaker 2: That's de serialization, reading that saved file, that byte stream,
- 16:56Speaker 2: and converting it back into a working model. Object in
- 16:59Speaker 2: your application ready to make predictions.
- 17:01Speaker 1: What format does it save in?
- 17:02Speaker 2: Mlnet's default is its own native binary format. It's generally
- 17:07Speaker 2: the fastest and supports all mL net features, so it's
- 17:10Speaker 2: often recommended.
- 17:11Speaker 1: But you also mentioned ONNX before, Yes.
- 17:13Speaker 2: And that's a huge plus. You can also save models
- 17:15Speaker 2: in the ONNX format because ONX is an open standard.
- 17:19Speaker 2: This means you can potentially take your mL net trained
- 17:22Speaker 2: model and use it in Python with TensorFlow, or deploy
- 17:25Speaker 2: it on specialized hardware or in cloud services that understand ONX.
- 17:30Speaker 2: Big for flexibility makes sense.
- 17:32Speaker 1: Any tips for managing these saved models.
- 17:34Speaker 2: Yeah, good practices help. Maybe save the model architecture and
- 17:37Speaker 2: the learned weight separately if you update weights. Often use
- 17:40Speaker 2: clear versioning in your file names like sentiment, dash model,
- 17:44Speaker 2: dash v one by two, dot zip, have good naming conventions,
- 17:48Speaker 2: and maybe add integrity checks like file hashing to make
- 17:51Speaker 2: sure the model file hasn't been corrupted when you load it.
- 17:53Speaker 1: Okay, model saved now, getting it used. Deploying to the
- 17:58Speaker 1: cloud seems like a common goal.
- 18:00Speaker 2: Very common, and for good reason. The cloud offers huge advantages.
- 18:04Speaker 2: Scalability is a big one. Automatically handle more or less prediction, traffic, accessibility,
- 18:09Speaker 2: use your model from anywhere, cost effectiveness, often pay as
- 18:12Speaker 2: you go, and real time inference for applications needing instant
- 18:16Speaker 2: predictions like fraud detection you mentioned exactly, or live recommendations.
- 18:20Speaker 2: And mlnet is designed to be cloud agnostic. It works
- 18:23Speaker 2: well with Azure of course, but also AWS, Google Cloud.
- 18:26Speaker 1: How do you typically deploy it? Say, on Ashure?
- 18:28Speaker 2: A very popular pattern is using Azure functions. That's serverless compute.
- 18:33Speaker 2: You upload your code, including loading and running your model,
- 18:36Speaker 2: and Azure handles the scaling automatically. You combine that with
- 18:40Speaker 2: a WebAPI, often using something like ASP dot net core
- 18:43Speaker 2: to expose your model's prediction function of the simple rest
- 18:46Speaker 2: endpoint over HTTP.
- 18:48Speaker 1: So other applications can just call that API to get
- 18:50Speaker 1: predictions precisely.
- 18:52Speaker 2: Web apps, mobile apps, IoT devices, other back end services.
- 18:56Speaker 2: They just make a standard web request to your azufunction API,
- 19:00Speaker 2: send the input data and get the prediction back.
- 19:02Speaker 1: Well, that's pretty seamless. What's the process look like?
- 19:05Speaker 2: Generally you'd prepare your mL dot net model, maybe converted
- 19:08Speaker 2: to onnx for broad compatibility with an Azure services. Then
- 19:11Speaker 2: you set up an Azure function usually with an HTTP trigger.
- 19:14Speaker 2: You write the function code to load the model and
- 19:16Speaker 2: implement the API endpoint logic to handle incoming requests and
- 19:19Speaker 2: return predictions.
- 19:20Speaker 1: Okay, deployed, but the real world is messy, right, How
- 19:25Speaker 1: do you make sure your deployed model keeps working well?
- 19:28Speaker 1: That sounds like a whole other challenge.
- 19:30Speaker 2: It is, and that's where best practices for production environments
- 19:33Speaker 2: come in. It's not enough just to deploy. You have
- 19:35Speaker 2: to maintain and monitor like what kind of things? First,
- 19:38Speaker 2: performance and optimization. Constantly monitor things like prediction, speed, latency,
- 19:44Speaker 2: how many requests that can handle throughput, and critically its
- 19:47Speaker 2: accuracy over time. You might use techniques like quantization to
- 19:50Speaker 2: make the model smaller and faster, or batch processing if
- 19:54Speaker 2: you can predict on multiple inputs at once, or passing
- 19:56Speaker 2: results and scaling. Definitely leveraging the cloud's auto scaling features
- 20:01Speaker 2: is key. Maybe setting up distributed inference. If one instance
- 20:05Speaker 2: isn't enough.
- 20:05Speaker 1: What about security? You're exposing an API.
- 20:07Speaker 2: Crucial security and compliance. You need proper authentication and authorization.
- 20:12Speaker 2: Who is allowed to call your API? Tools like Azure,
- 20:15Speaker 2: Active directory or simple API keys can help. Always use
- 20:19Speaker 2: SSLTLS encryption, validate the input data rigorously and be mindful
- 20:25Speaker 2: of data privacy regulations.
- 20:27Speaker 1: And if things go wrong, we're just keeping it on it.
- 20:30Speaker 2: That's monitoring and logging. You need good telemetry, track requests, errors,
- 20:35Speaker 2: performance metrics. Tools like Azure Monitor and Application Insights are
- 20:39Speaker 2: essential for this set up. Health checks for your API.
- 20:42Speaker 1: Endpoint makes sense? What about updates? Models probably need retraining
- 20:46Speaker 1: or replacing eventually.
- 20:47Speaker 2: Absolutely so, you need a strategy for versioning and rollbacks.
- 20:50Speaker 2: How do you deploy a new version of the model
- 20:53Speaker 2: without downtime? And just as important, how do you quickly
- 20:56Speaker 2: roll back to a previous version if the new one
- 20:58Speaker 2: has problems?
- 20:59Speaker 1: Right?
- 21:00Speaker 2: And finally, troubleshooting, have a plan, understand how to analyze
- 21:06Speaker 2: error logs. Be prepared for model drift.
- 21:09Speaker 1: Model drift, Yeah.
- 21:11Speaker 2: That's when the real world data your model season production
- 21:14Speaker 2: starts to look different from the data it was trained on.
- 21:16Speaker 2: Maybe customer behavior changes or the environment shifts. This can
- 21:20Speaker 2: make your model less accurate over time, so they need
- 21:22Speaker 2: to detect it and likely retrain your model on newer data.
- 21:26Speaker 2: And of course, know how to use the debugging tools
- 21:28Speaker 2: your cloud platform offers.
- 21:29Speaker 1: Wow, Okay, that's a lot more involved than just model
- 21:32Speaker 1: to predict it is production.
- 21:33Speaker 2: mL is a whole discipline, but mL net and cloud
- 21:36Speaker 2: platforms provide the tools to manage it effectively.
- 21:39Speaker 1: So to recap, then we've gone from the origins of
- 21:42Speaker 1: mL dot net its core ideas, the different tasks that
- 21:45Speaker 1: can handle right.
- 21:46Speaker 2: Through the whole workflow prepping, data, training, tuning, evaluating.
- 21:51Speaker 1: And finally saving, deploying and managing those models in production,
- 21:55Speaker 1: especially using cloud tools like Azure Functions.
- 21:58Speaker 2: Yeah, hopefully you listening now have a much clearer picture
- 22:01Speaker 2: of how mL dot net empowers dot net developers, specifically
- 22:04Speaker 2: how it brings AI capabilities into their world, making compast
- 22:08Speaker 2: things more approachable, more impactful.
- 22:10Speaker 1: What's really exciting to me is that it's not static,
- 22:13Speaker 1: right Yeah. Mlnt is constantly evolving.
- 22:15Speaker 2: Oh yeah, new algorithms get added, the auto mL features
- 22:18Speaker 2: get smarter, the community keeps growing and contributing. It's a
- 22:21Speaker 2: very active project.
- 22:23Speaker 1: So as you, our listeners, think about your next project,
- 22:26Speaker 1: your next data challenge, maybe consider the possibilities here. What
- 22:30Speaker 1: opens up when you can bring machine learning into your
- 22:32Speaker 1: existing dot net skill set. This knowledge is just theoretical,
- 22:35Speaker 1: it's built to be shared and used. The fascinating question
- 22:39Speaker 1: is How will you use a tool like mL dot
- 22:41Speaker 1: net to transform your next big idea