How does Lexical Scoping in Mojo ๐Ÿ”ฅ works (under 3 minutes)

Underfitted ยท Beginner ยท๐Ÿ“ ML Fundamentals ยท2y ago

Key Takeaways

This video teaches lexical scoping in Mojo

Full Transcript

so this is a snippet of modu code I want you to take a look just for a second pause this video if you have to and tell me what you think this script is going to print when I run it so first of all we have a variable X that I'm declaring and I'm using int 32 as the type of that variable however I'm assigning the value hello to an INT anytime you try to assign a string to an INT 32 by variable if that string is empty then the variable will get the value zero if the string has a value like in this case is hello then X is going to get the value one so here the first print statement should print the value one now I have a condition here and I'm saying if x and if you know python you know that in this case X is going to be true because the value of x is one therefore this is the class of condition that is going to execute inside I'm red declaring the variable X this is something that's new in modu is called shadowing a variable because this new X now is valid within this scope of this condition this x is going to die after the condition is over and this x is just a completely new variable it's not the same as the outer X now this new X I'm assigning a value of the outer X I'm referencing the outer X right here plus 10 because the outer X has the value of one this x here now is going to have the value of 11 right it's going to be 1 + 10 that will be 11 now remember this declaration of X is going to die as soon as I get out of that condition therefore this line should be referencing the outer X which has a value of one so if I execute this code right now we should see 11 111 on the screen let's see if this is true if I'm not drunk and 111 I hope that makes sense

Original Description

I teach a live, interactive program that'll help you build production-ready Machine Learning systems from the ground up. Check it out here: https://www.ml.school To keep up with my content: โ€ข Twitter/X: https://www.twitter.com/svpino โ€ข LinkedIn: https://www.linkedin.com/in/svpino ๐Ÿ”” Subscribe for more stories: https://www.youtube.com/@underfitted?sub_confirmation=1
Watch on YouTube โ†— (saves to browser)
Sign in to unlock AI tutor explanation ยท โšก30

Playlist

Uploads from Underfitted ยท Underfitted ยท 52 of 60

1 Test-Time Augmentation In Machine Learning.
Test-Time Augmentation In Machine Learning.
Underfitted
2 Don't Replace Missing Values In Your Dataset.
Don't Replace Missing Values In Your Dataset.
Underfitted
3 Introduction to Adversarial Validation In Machine Learning.
Introduction to Adversarial Validation In Machine Learning.
Underfitted
4 Introduction To Autoencoders In Machine Learning.
Introduction To Autoencoders In Machine Learning.
Underfitted
5 Active Learning. The Secret of Training Models Without Labels.
Active Learning. The Secret of Training Models Without Labels.
Underfitted
6 Early Stopping. The Most Popular Regularization Technique In Machine Learning.
Early Stopping. The Most Popular Regularization Technique In Machine Learning.
Underfitted
7 The Confusion Matrix in Machine Learning
The Confusion Matrix in Machine Learning
Underfitted
8 3 Tips to Build a Career in Machine Learning (Unconventional Advice)
3 Tips to Build a Career in Machine Learning (Unconventional Advice)
Underfitted
9 I can predict cars CRASHING. And it's 99% accurate!
I can predict cars CRASHING. And it's 99% accurate!
Underfitted
10 A Critical Skill People Learn Too LATE: Learning Curves In Machine Learning.
A Critical Skill People Learn Too LATE: Learning Curves In Machine Learning.
Underfitted
11 The BEST Machine Learning Interview Strategy.
The BEST Machine Learning Interview Strategy.
Underfitted
12 OpenAIโ€™s Whisper is AMAZING!
OpenAIโ€™s Whisper is AMAZING!
Underfitted
13 5 Lessons Youโ€™re NOT Taught in School
5 Lessons Youโ€™re NOT Taught in School
Underfitted
14 TensorFlow On Apple Silicon. Step-by-Step Instructions
TensorFlow On Apple Silicon. Step-by-Step Instructions
Underfitted
15 Generating Images From Text. Stable Diffusion, Explained
Generating Images From Text. Stable Diffusion, Explained
Underfitted
16 The Wrong Batch Size Will Ruin Your Model
The Wrong Batch Size Will Ruin Your Model
Underfitted
17 8 Mistakes Holding Your Career Back | Machine Learning
8 Mistakes Holding Your Career Back | Machine Learning
Underfitted
18 AI Just Solved a 53-Year-Old Problem! | AlphaTensor, Explained
AI Just Solved a 53-Year-Old Problem! | AlphaTensor, Explained
Underfitted
19 Bias and Variance, Simplified
Bias and Variance, Simplified
Underfitted
20 Should You Stop Splitting Your Data Like This?
Should You Stop Splitting Your Data Like This?
Underfitted
21 The Function That Changed Everything
The Function That Changed Everything
Underfitted
22 This Model Caused A Nuclear Disaster
This Model Caused A Nuclear Disaster
Underfitted
23 Will Your Code Write Itself?
Will Your Code Write Itself?
Underfitted
24 The Simplest Encoding Youโ€™ve Never Heard Of
The Simplest Encoding Youโ€™ve Never Heard Of
Underfitted
25 Superhuman AI Cracked An Impossible Game! | DeepNash, Explained
Superhuman AI Cracked An Impossible Game! | DeepNash, Explained
Underfitted
26 Can you become a Data Scientist without a Ph.D?
Can you become a Data Scientist without a Ph.D?
Underfitted
27 How to 10x your productivity with ChatGPT?
How to 10x your productivity with ChatGPT?
Underfitted
28 Cheating the Prisoner's Dilemma
Cheating the Prisoner's Dilemma
Underfitted
29 We integrated OpenAI's Whisper with Spot
We integrated OpenAI's Whisper with Spot
Underfitted
30 The Machine Learning School program
The Machine Learning School program
Underfitted
31 We integrated ChatGPT with our robots
We integrated ChatGPT with our robots
Underfitted
32 Solving complex tasks using a Large Language Model (LLM)
Solving complex tasks using a Large Language Model (LLM)
Underfitted
33 5 problems when using a Large Language Model
5 problems when using a Large Language Model
Underfitted
34 We just discovered faster sorting algorithms!
We just discovered faster sorting algorithms!
Underfitted
35 The 3 most important updates to OpenAI's API.
The 3 most important updates to OpenAI's API.
Underfitted
36 People are divided! Does GPT-4 understand what it says?
People are divided! Does GPT-4 understand what it says?
Underfitted
37 How much should you charge hourly as a Machine Learning freelancer?
How much should you charge hourly as a Machine Learning freelancer?
Underfitted
38 Building a RAG application from scratch using Python, LangChain, and the OpenAI API
Building a RAG application from scratch using Python, LangChain, and the OpenAI API
Underfitted
39 Building a RAG application using open-source models (Asking questions from a PDF using Llama2)
Building a RAG application using open-source models (Asking questions from a PDF using Llama2)
Underfitted
40 How to evaluate an LLM-powered RAG application automatically.
How to evaluate an LLM-powered RAG application automatically.
Underfitted
41 Step by step no-code RAG application using Langflow.
Step by step no-code RAG application using Langflow.
Underfitted
42 I built a simple game using Langchain. Here is a step by step tutorial.
I built a simple game using Langchain. Here is a step by step tutorial.
Underfitted
43 I used the first AI Software Engineer for a week. This is happening.
I used the first AI Software Engineer for a week. This is happening.
Underfitted
44 I deployed a recommendation model. Testing Models In Production using Interleaving Experiments.
I deployed a recommendation model. Testing Models In Production using Interleaving Experiments.
Underfitted
45 How to run PyTorch, TensorFlow, and JAX on your Mac (Apple Silicon)
How to run PyTorch, TensorFlow, and JAX on your Mac (Apple Silicon)
Underfitted
46 How to train a model to generate image embeddings from scratch
How to train a model to generate image embeddings from scratch
Underfitted
47 Building an AI assistant that listens and sees the world (Step by step tutorial)
Building an AI assistant that listens and sees the world (Step by step tutorial)
Underfitted
48 Why are vector databases so FAST?
Why are vector databases so FAST?
Underfitted
49 A Machine Learning roadmap (the one I recommend to my students)
A Machine Learning roadmap (the one I recommend to my students)
Underfitted
50 How to build a real-time AI assistant (with voice and vision)
How to build a real-time AI assistant (with voice and vision)
Underfitted
51 An introduction to Mojo (for Python developers)
An introduction to Mojo (for Python developers)
Underfitted
โ–ถ How does Lexical Scoping in Mojo ๐Ÿ”ฅ works (under 3 minutes)
How does Lexical Scoping in Mojo ๐Ÿ”ฅ works (under 3 minutes)
Underfitted
53 Building a CI workflow for those who hate it (using GitHub Actions)
Building a CI workflow for those who hate it (using GitHub Actions)
Underfitted
54 How to run Python Code in Mojo ๐Ÿ”ฅ
How to run Python Code in Mojo ๐Ÿ”ฅ
Underfitted
55 AI will not take your job. Here is what I think will happen instead.
AI will not take your job. Here is what I think will happen instead.
Underfitted
56 How to fine-tune a model using LoRA (step by step)
How to fine-tune a model using LoRA (step by step)
Underfitted
57 Late initialization in Mojo๐Ÿ”ฅ (Python doesn't support this)
Late initialization in Mojo๐Ÿ”ฅ (Python doesn't support this)
Underfitted
58 The $1,000,000 problem AI can't solve
The $1,000,000 problem AI can't solve
Underfitted
59 A gentle introduction to RAG (using open-source models)
A gentle introduction to RAG (using open-source models)
Underfitted
60 Automating feedback using ChatGPT and Zapier
Automating feedback using ChatGPT and Zapier
Underfitted

Related Reads

๐Ÿ“ฐ
CentryAI
Learn how CentryAI simplifies machine learning model development and deployment with its no-code platform and microservices architecture
Dev.to AI
๐Ÿ“ฐ
# Engineering Log #03 โ€” The honest asterisk got cashed in (product F1 0.887), and the model finally became a product
Learn how to engineer and deploy a model to become a product, achieving a high F1 score of 0.887, and understand the importance of model development and testing in the engineering process
Dev.to ยท yubin hong
๐Ÿ“ฐ
Part-05 Performance Tuning & Optimization: The Production Secret Sauce
Optimize Spark jobs for better performance by identifying bottlenecks and applying targeted tweaks
Medium ยท Python
๐Ÿ“ฐ
AI Bisa Membantu Forecasting Penjualan, Ini Cara Menggunakannya
Learn how AI can improve sales forecasting and reduce errors, crucial for business success
Medium ยท Machine Learning
Up next
Dropout in Deep Learning
AnuTech-CH
Watch โ†’