C Programming for Machine Learning (LIVE)

Siraj Raval · Beginner ·📰 AI News & Updates ·7y ago

Key Takeaways

The video covers C programming for machine learning, focusing on memory management, concurrency, and control flow, with tools like scythe on, Spacey, and Python, and techniques such as strong typing, pointer usage, and data pre-processing for natural language processing tasks.

Full Transcript

and spacey I love this combination of scythe on and Spacey this is one of my favorite combinations for machine learning all right hello world it's Suraj and welcome to my livestream on natural language processing in C now I know a lot of you might be thinking why C write Python works well enough it's a great introductory language to bring a lot of people into the field but there is a problem and let me tell you what that problem is the problem is that sometimes we want really fast implementations of machine learning algorithms we want machine learning algorithms that are going to work very very well very very fast and you know I'm talking about healthcare I'm talking about life-or-death situations I'm talking about times when milliseconds matter for both inference and for training so what C allows us to do as a language is to manually allocate memory and manually deallocate memory so what's happening in Python in the Python runtime environment is a process called garbage collection okay and a lot of you might be familiar with this but garbage collection is a runtime process that automatically looks for that looks for objects in memory that have not been D allocated and if if depending on the type of interpreter we're using if it feels like it's time to deallocate that object it will be allocated for us now this is great because we don't want to have to spend our time dealing with memory right allocating objects D allocating them we just want to worry about the algorithms so that's why we use Python but sometimes it's necessary so in this live stream what I'm gonna do is I'm going to first demo how siphon works what scythe on is by the way is it's a bunch of C extensions for Python so we could literally write C code inside of Python and I want you to do this with me in Google collab so go to collab research Google comm and once we've done that we will will first code out a python implementation then we'll do a size on implementation we'll benchmark both of them and then we're going to use it for natural language processing specifically using a library called Spacey and then after that we're gonna demo it for a little bit more deep learning after that alright so we've got a lot of things to do in this live stream I will marry you Konrad thank you very much I will marry all of you because you guys matter to me a lot like a lot okay so let's get into this I want you to do this with me in the browser yes we can code see inside of the browser okay I'm gonna show you what the deal is with this but before we do anything what I want you to do is install two dependencies with me okay ready so the first dependency we're gonna install is sites on itself it's acts just like a regular Python package but so we have pipe we have sites on and then we're gonna use space C which is space E is an NLP library the fastest NLP Python library that exists currently that uses carefully constructed sites on constructs for memory management to allow for rapid part of speech tagging and you know tokenization and word to vectorization and all those little NLP techniques that we need ok so these are the two libraries that we're gonna install and this is gonna take like probably two minutes to run so just let's let these in the dependencies install while we talk about the rest of this okay so Spacey takes a little time to install so as you can see Spacey as installing right now by the way because of collab I just want to you know I gave I gave collab a shout out on on Twitter but really amazing tool no longer can anybody use the excuse well it doesn't work for my Windows environment or my whatever environment now you can do it in the browser alright so back to this right so um Python it's great like I said but when it comes to execution speed necessarily it's not that good necessarily okay so right so here's a little image we can see of what's happening here when we writes out some psyphon code it's going to be compiled by the scythe on compiler now this is a specific compiler made to work with the Python compiler it's going to create two it's going to create two different of files a C file and in dot o file and both of them are going to be able to be launched from a Python file later now what is the difference between C and Python now not everybody knows C not everybody has been able to write Spacey Spacey is a very cool library I really like Spacey so not everybody is able to have has had experience with C but what is the real difference between both of these languages well there's one besides the memory management stuff that I talked about there is one thing that is a big difference and that is the the idea of strong versus weak typing as you can see in this image right here right so C has strong typing meaning the type must be known by the compiler and Python has weak typing and this is for this is this is also for memory management reasons the K it always comes back to memory when it comes when it comes to the C vs Python debate but let's go ahead and write a simple example first so what I want to start off with in this example is some basic Python ok let's see if our dependencies installed by the way see it's still running it's gonna take a little a little while but well ok so while this is this is a downloaded limit let me just answer some questions in the comments section someone is very happy that I use Spacey and YC though well like I said mission-critical applications need the maximum speed that we can we can we can utilize what were the two imports the two imports are scythe on and Spacey okay so scythe on is the set of C extensions for Python that we will use and Spacey is built directly on top of scythe on so it's like it's not it's not pure scythe on but it's very close to it and it's made specifically for scythe on which laptop do you have I have a MacBook Pro 2016 I think or 2017 I don't like the touch bar at all and in fact I envy people who don't have a touch bar can you please explain about both dependencies like I just did I love C I love C as well how much of C should no great question so if you're doing anything in robotics right so mobile robots factory robots robots then you're gonna need to know some see why because when it comes to hardware what you're dealing with when it comes to robotics specifically is a bunch of integration issues right you got to get the arm connected to the the body connected to the wheel base connect it to the you know other arm or whatever it is and all of these are drivers usually they're written in C++ or C and this can be annoying right because we have to integrate all of these and ideally it was all written in Python but that's not the case so we need to know some C if we're gonna do anything in robotics meanwhile this is still loading have you tried GPU laptop I have I have yeah but you know what overall I like the form factor of the of OS X I like the fact that I can use Final Cut Pro and that's why so C is so much faster yes it is I'm just gonna I'm just gonna start typing this wild while this loads by the way so let's create these rectangles right so what we're gonna do right now is we're gonna create a big bunch of rectangles right in Python pure Python knows iPhone and then we're gonna count how many rectangles we have okay and so this is gonna be a speed test so let's just do this right now so the first thing I'm gonna import is this and this is not going to require scythe on so I can go ahead and just start coding this right now so we want to create a random a bunch of randomly sized rectangles that's why I imported this pseudo random number generator called random now inside of our rectangle class good object-oriented programming practice we're gonna have an initialization function this this is the initialization function for the rectangle the rectangle is going to take two parameters it's going to be the height and the width so I'm gonna have the height and the width right so though because rectangles can have any different the the width and height of rectangles are different that's why I have two parameters for those else it would not be a rectangle now I'm gonna write out the formula for defining the area of a rectangle what is can anybody tell me the formula before I type it it's going to be yes it's going to be the weight or the width times the height very simple very simple area formula now okay so we have those two initialization functions now we can say let's check out these rectangles let's see what's what's happening here so in this we're going to check to see if it's area is within our threshold so we're gonna have some threshold value yes this video will be available later on YouTube and I will answer questions periodically as I'm coding this what we're gonna have is a function that's going to check the the area of each of the rectangles that I create now this counter variable in is going to start at zero now what we're going to say is for every rectangle that we have in our list of rectangles which is our parameter we're going to check we're going to check if I just want to make sure this is proper right nope yep good zoom I'll zoom in a bit let me zoom in more okay so for each of the rectangles that we have we're gonna we're going to check if that if the right of the area of the rectangle is greater than our threshold value now if it is greater than our threshold value then we're going to say let's increment our counter because that's what we're looking to count and then at the end of all of that we'll return the number of rectangles that we have number of rectangles like that okay and I made the screen bigger cool it could be less than but let's just say greater then okay so now we're going to say let's let's have this main function and we'll call it slow because we're gonna speed it up in a second and we're gonna say the number of rectangles is 1 million rectangles 1 million we want a million of these things rectangles and we're gonna initialize this rectangles object a list that we're going to input yes move 37 is free that we're going to input into the previous function that I just wrote okay for every rectangle in the range of the number of rectangles that we have and then close that and now I can perform the check so now I'll perform the check and I'll say check those rectangles check every single one that we have and just see just see like I'll call this check rec rectangle pie or check rectangles pie now just see if how many rectangles we have and now we can finally define that's ten million isn't it ten oh you're right that's 10 million rectangles that would have been a lot it doesn't matter actually they're really very small the footprint is small and we can now print out everything that we have now okay now let's see if this compiles good now let's time oh let's see if our dependencies installed by the way are you serious oh no okay great great the dependencies installed yo C is coming relax one step at a time this is a process my friends this is a process you can't start running until you start walking okay you got a walk before you crawl that's not how it works okay so let's run this thing we'll say let's run this we have our function let's run it time it what do we got here okay this is creating a bunch of rectangles and it's okay so there are 400 let's see there are 400 3987 rectangles that were within our threshold okay and that took a CPU time of two point two three seconds to do all of this now let's see how much we can speed this up using sites on okay so now here's how we're gonna use C in the browser or get ready for this by the way let make sure everything's good here's how we're gonna use C in the browser okay so here we go I'm gonna say load the extension scythe on this just told collab to load a site on extension now let's do this okay so now what we're gonna do for this faster sites on implementation is we're gonna say you're get ready for this we're gonna use a scythe on flag like this that's all we have to do now this this cut this code block is gonna use scythe on okay so the first scythe on file that I'm gonna import is called sidemen and what this is and I'm gonna use the word the the scythe on specific keyword C import instead of just pure import now what this is is it is a memory management helper for python specifically pool the pool object we're gonna use it to allocate and we can also use it to deallocate memory now in the case of this program we're gonna use pool to allocate a bunch of rectangles yes the screen this stream is recorded and you're gonna get to see it later okay so that is our first tool and then we're gonna have some good old Python as well for our random number generator we can use both sites on and Python in the same code block under this what's it called magic sell magic sell keyword or something this this thing up here okay so now let's let's do this again so we're gonna create this statement called sea death okay so what C def is it's a state it's a site on specific statement that's used to declare sea variables types functions anything sea related we can use C def for that right so what we can do in C is create a struct our type rectangle this is our type and now we can use pure sea variables a float for our width a float for our height okay so that's our C def for our struct now it's just like malloc exactly it's just like malloc good question keep them coming so now let's write our new check rectangles method okay so check rectangles sigh instead of PI now what are we going to give this thing well our the first parameter is going to be of course or rectangle but we're not just gonna give it a plain rectangle we're gonna give it a pointer pointer pointer rectangle because because what is a pointer can anybody tell me what a pointer does a pointer points to a space in memory why why do we use a pointer why don't we just call that object as a whole because it we can avoid making a duplicate of that object if we can just point to where it is in memory we don't have to make a duplicate that saves a space and that makes things faster so that's what we're going to use a pointer to to the memory yes you need commas so I'll call this rectangles and I'm gonna have a number of those rectangles right and I'm gonna have of course my threshold we want to save memory exactly what's one of the core values that our community has can anybody tell me that's related to saving saving memory saving money save time saving energy unnecessary stuff what is it so if someone can tell me well like well I type this be frugal by the way okay back to this I forgot it for a second oh my god I forgot one of my own core values our own core of karate alright so see deaf that that's that okay so now we're gonna continue like I said we can use CDF for declaring functions for variables as well and so we're gonna have this c variable in an int that will use a CDF for okay so now we're gonna do the same loop that we did before just like before except in C arrays contain no sighs so no size information that is so we need to state it explicitly which is what we're doing right here you guys are hilarious by the way you're gonna say the funniest things in the chat Java is a robust and secure language all caps that is what needs to be said you know like completely random stuff like that is the greatest man you guys are hilarious back to this so what are we gonna do here well we're gonna do exactly what we did before we're gonna take our weights we're gonna multiply by our height and that's not our weight I'm to machine learning mode right now our width by our height that's gonna be greater than our threshold and then we can say increment that and we'll return the number number of them okay make sure that's all good it's all good yep it's all good mm-hm yep now back to our main method now let's do this main rectangle don't worry we're getting to the machine learning we're getting to the machine learning I just want to demo some scythe on just just show you the performance gains that we get from this thing and prove that we can code see inside of this collab as well which I had to get working myself this it took a while but really it's you know it's easy thank you the area of the rectangle is initialized randomly for all of them they're a bunch of them it's not just one rectangle so how many we're gonna have we're gonna have like I said before a million okay we have a million rectangles we have this threshold dial you just like before it's gonna be 0.25 now let's use pool get ready for some Python people or some see now here here we go with pool by the way okay so the pool object is gonna save is gonna save memory addresses internally and so then in the it's not like garbage collection is not happening it's still happening okay garbage collection is still happening however we can manually allocate and deallocate memory in addition to that which is going to save us some runtime resources so I'll say four rectangles typo where four rectangles uh-huh we'll see we'll see where the type of is so we're gonna initialize our rectangles right now this is our list of rectangles and this bracket is going to typecast our what the object that we allocate here into a rectangle so here is us using this pool object as mem to allocate all of these rectangles just like that in memory now what's the size gonna be this is some pure C by the way the size is going to be the size of the rectangle that we just defined all right man this is going crazy with Java by the way I don't know why you guys are mentioning Java this is about seeing Python so get that job at octave here yes Java is lame i agree java is lame i'm just gonna say that all right back to this java so old Java's like computer science classes in like like ten years ago um I know I'm gonna get some heip for that I don't care anyway I'm just kind of trolling no I mean it's true I don't like Java anyway I mean there's deep learning for J I don't want to get too into this right now I'm coding something there's like an all-out war of programming languages happening okay so so let's do this now okay so we're gonna do the exact same thing we did before so for every rectangle we have we're going to initialize both its what width and its height randomly that and that's why we imported that random that random import okay so we'll do that for the width we'll do that for the height oh okay so so now we've randomly allocated all of these widths all of these Heights and now we can use our check rectangles function that we just defined and give it the number of rectangles and the threshold and we're good right right right yes good print them out put them all out okay everybody good where's the extra parentheses give me line numbers people okay let's see what's going on here this gonna work who knows mm hmm hmm I see I see okay so it's got an error okay gotcha gotcha gotcha gotcha this rectangle objects let's check this out oh yeah right duh all right let's get back to this if rectangle right where's that if rectangle dot W what does it say what's the error okay let's see what let's see what I did here for rectangle it's like one of these typing errors am i doing multiple things here at once see deaf rectangle yep mm-hmm yep I see so it's for rectangle in rectangles and that's how that goes I know I should have enabled line numbers oh yeah how do I do that enabling line numbers for rectangles let's see here okay I'm just gonna go through this so I thought all right you guys are you guys are distracting me hold on I'm just gonna put you in the corner for a second from they've got scythe on imported the pool I'm just gonna go over this because it's necessary anyway we imported the pool for memory allocation and then we created our struct our struct our type our rectangle type and then we said let me just see let's just do this okay let's just compile that okay this proves that we can compile C in collab okay so that was the first part now let me do the same thing over here I'm just gonna break this up break it up okay there we go invalid syntax oh you know what it's got to be inside of I've got to have this magic scythe on thing going on scythe on Oh okay we okay we got some we've got a lot of NLP NLP to cover by the way I have this code on github by the way so definitely check it out it's the latest repository that I have definitely check it out we got other things to cover here these are my comments by the way some amazing comments I have to say myself what way will wave okay so this one away okay cool I was about to say like wait a second okay now let's time it let's see the difference in timing main rectangles fast good okay milliseconds 842 milliseconds compared to what it was before yeah control ml okay thank you 2 point 3 to point to 3 seconds versus 842 milliseconds that is a 2x how many milliseconds are there in a second a thousand how many times were there mm so yeah it's like a 2x speedo for the same thing okay so there we go rule number one do not do a live demo see that's how exactly if you if you can't code it sometimes you got a copy paste you got to keep going I'm a human you know so that's how that goes all right so now we've timed it now okay so that's it for Saipan now straight to machine learning now we got that out of the way so when we're doing natural language processing we're dealing with strings right we're dealing with strings and see isn't necessarily all of these like numerical functions aren't necessarily made for Strings but what's so what we need is the kind of intermediary solution that allows us to use the fine grained control over memory that C allows which allows for a faster execution environment but also a high level interface that lets us deal with strings so what Spacey is is it's this great library I love this I love this branding by the way industrial-strength natural language processing fastest in the world big claim big big claim and look at this look at this beautiful oh man as a technical writer I I just I love their documentation I love their design especially like of the terminal window and the colors and stuff very cool stuff so when it comes to natural language processing we have to do a bunch of pre-processing steps before we feed any kind of text data into a deep learning or machine learning model whether it's a neural network or support vector machine right this includes tokenization part of speech attacking that part of let me slow down part of speech tagging dependency parsing named entity recognition what is this word a well it's it's a person it's it's a place right so so I really think like if we took this comment section and we just I think the birth of all programming means memes come from the Wizards in this comment section by the way like we are the we are the source of all programming memes god is HTML exactly exactly okay so all right so that's Spacey so let's let's code some space right over 400 times faster than n LT K which I've done videos on before which is amazing it's a newer it's a newer lot its newer than L n l TK and l TK is pretty old so we got to get we got to get with the times and in the coolest part I think is this idea of word vectors right so so before we input words into a machine learning model we have to convert them into vectors okay we have to convert them into vectors and vectors are a representation that is easily possible by function approximator z' like neural networks so so what is what specifically is Spacey doing two strings well what it's doing is what it does is it stores every string in a single data structure called string store okay this is a this is and then this is AC this is AC object and then all of these strings are indexed by a 64-bit sea level hash right so hashes the same idea behind Bitcoin you know this this long string of characters like numbers and numbers and letters and what this allows us to do is very fast lookup constant time lookup and constant time storage right so retrieval and storage are both constant time which is awesome and this is very fast but so that's what it's doing under the hood it's converting every string into this in this into this string store object it's storing it and then it's you were indexed by this hash so whenever we need it we can we can um pick it up so yeah so there's that and so there's a bunch of things that we need to do tagging so we're gonna do a few of those examples right now and the great thing about Spacey is it integrates with all of these major deep learning libraries very easily there are so many examples on github of this happening right here's one example but here's the space see repository by the way they've got a bunch of great examples if we just go under the examples folder we've got Oh care offs nice deep learning chaos alright so let's see what they're doing here they're doing an LS TM sentiment classification model right so they're trying to detect you know what the sentiment of some words are right this is natural language processing or a part of it so notice in their training loop before they here's their lsdm model before they give the the corpus the text to a model to train they are turning it into a bunch of vectors word vectors right like I said before how are they doing this well but what they import it spacey up there and then they said space you download English vectors so they've got a bunch of English vectors pre-loaded just like that and then we can take this NLP object and we could say it will make it into sentences get those word embeddings and then input those to the model so this is a pre-processing step works very well with deep learning models let's do a bunch of those things right now okay so the first thing we'll do is we'll set up space here right so we can say import space ECL I Spacey SEL I download you want the English corpus and we'll say load it right here en is for English all right yeah okay we've got that and now we want some test data okay so let's let's think of some test data I'm gonna say what do I want there to be for test data build it train it test it makes it build it train it test it makes it smarter better faster no no makes it no no what was it what was it oh my god I'm forgetting my own music oh my god okay we got to see this for a second smarter Suraj how does this go this was like build a train it test it makes it denser deeper faster smarter but but okay that's what was makes it denser deeper faster smarter I got to read papers to try and make me smarter I train my models in de cuz my takes longer oh man that's that's a sick song by the way sometimes I'm like listening to that like just like walking like I'm listening to my own music okay we're talking about Spacey not my smarter song all right where were we all right yes I know Hindi by the way I know Hindi I know Spanish I know Gujarati I know a little bit of Russian I'm learning Chinese I need to learn some Chinese and yes so don't even question what the deal is you know like I know I know I know Hindi okay so I got to read papers to try and make me smarter I train my models okay that's the second line in the cloud now cuz my laptop takes longer I parse through data like one more line and then we're done like like a boss now back then my code was wrong er subscribe if you want to learn now let's spread this AI power okay so four lines do you know English no actually I'm still learning English I don't know English so maybe someday I hope I hope someday I'll learn how to how that works okay so we have our we have our test sentence that will input just like this and now we have our parse data let's see if this works oh right Spacey privyet Bree Viet my friend I will rap don't tell me don't rap because that's gonna make me rap even harder okay that's how this works you know what I mean that's how this works let's see where we are time was 35 minutes good I'll definitely rap now no I was going I'm definitely alright here we go space these not define I did all right see I can't even spell my own thing alright here we go I don't speak Tamil though I should there's this hilarious like Tamil movie which is like all these robots like hundreds of them or something or it's like this it's hilarious parse multi sentence yeah I did define it oh right you can now load it yes okay there we go I loaded the model right so here we go let's do some part of speech tagging so what we're going to do is we're going to look for the part of speech of each of these words in my test corpus okay so I'm gonna say parsed data I so that's all of those words that I just defined yeah I speak I speak Dutch as well how hot it I speak some Dutch I mean it's a hard language I just spent a year in Amsterdam by the way I spent an entire lifetime in a year that was some pretty incredible stuff I don't want to get too reminiscent I don't want to reminisce I reminisce about things like Tupac okay I'm feeling like a joker today on this livestream man all right back to this I reminisce all right part of speech tagging what was that okay what are we doing here so we're going through each of those words in the parse data and we're saying where does it start where does it end and then for each of those words we're gonna we're gonna tag it okay so each of those should I should say tokens we're gonna say print the the word as well as it's part of speech and you'll see exactly what I mean right now mm-hmm break is invalid syntax really you go you go okay will I be attending these conferences look after slush okay slush in Helsinki nothing can compare slush was the most epic and I know I'm really promoting slush by saying this right now and their applications are gonna go up but slush was the most epic conference ever I mean okay let me just give you guys a little secret okay so like I go to this okay there's this like speakers dinner okay this to there's too much to like talk about right now we gotta get the coat on close the brackets right that's what it is of course right mm-hmm yep yep pork in where's torque in token worth and then underscore get Joe brackets right boo verbs nouns punctuation marks build it train it test it makes it denser deeper faster smart III got to read okay so that was one part we can do more dependency tagging named entity recognition where we had time wise 39 minutes we're so good torque in exactly that's how we roll torquing all right so that was one thing that we could do let's do another thing we can do some dependency tagging now what is this I am 27 years old Helsinki's in the house how to reach you right here Here I am gam-cho means how are you in Gujarati I'm good that's some russian right there it says in Soviet and I'm just kidding rap gotta read in papers all right so dependency tagging is when we have a bunch of words that depend on each other what specifically do I mean there's a tree of words that depend on each other so it's actually I should have had a slide for the dependency tagging an image speaks a thousand words there we go so it's just like this right submitted who submitted the bill well bills were submitted by who that's the preposition what's the object the senator what is his description Republican of Kansas whatever etc right so it's just like that now let's do this in our example let's do let me do another rap line of mine what was my latest rap it was like this models taking too long I needed editor and it's like when they update the weights they call it they call it backpropagate they call it back propagate that in your dictionary back propagate they want it the ways they call it back for per day that's what every single section of these new papers say that's what let just leave it at that okay so that's our example and now that we have our example we can say put it into our English model and now for every token that we have in our parse example now that that's been formatted properly let's print out both the original tag for it as well as its dependency so notice how all of these attributes of the token keyword is what we're using here head and this is using scythe on under the hood so notice the how I'm not specifically typing out see but it's very close to it they're not in text form they're just somewhere in my head and on the Internet in terms of videos okay now okay so for each of those files I want to show what the tree looks like so that's why I'm going to say what's on the left and then what's on the right of the tree right so T dot Worth for T and token rights mm-hmm let's see what happens here good when they update the weights they said okay so that's dependency tagging there we go like I said before and now for the okay so next time I will do line numbers okay so hola como estas mi nombre es suraj yo hablo espanol tambien which means my name is Suraj and yes I speak Spanish very well and I was just listening to despedido by the way cuz I'm going to LA in an hour and I always listen to despedido before I go to LA because this is how we do it down employ 30 cuz that that makes no sense okay the thing about named entity recognition is it so it's not as relevant but basically it's like it just come down to us using this token these attributes of the word token right but um I think that's it for this video yeah this is this is a good amount this is a good amount prosecute I'll definitely check out these docs these documentation for Spacey it's some great stuff I want to see more people using si implementations more Wizards using both sites on to speed up implementations of their models for data pre-processing especially when it comes to NLP I will be very impressed by that and you can expect us to go more low level in the future and that's it for this live stream now I'm going to do a rap part let me do a rap here and then we're done someone say word and then I'm gonna freestyle to that just say a word ideally about machine learning okay let me just pull up an instrumental yeah okay what about Julia okay here we go I guess it's gonna be I try to use NLP don't you see I got all of these word vectors I think it's three up down man King woman everywhere I'm trying to add these up and subtract them don't use care you can add them multiply it you can divide you can use all of these operations man it's all in your minds think of these words as numbers that you can add and subtract try to think of them as something more that's they go back to back you can line them up you can put them in a dictionary you can put them in any data structure its history yo okay that's it for this wrap Ganz's next time but that was my short rap thank you everybody for coming I love you guys and for now I've got to go to LA so thanks for watching alright that's it for this stream

Original Description

The ability to write implementations of machine learning algorithms in pure C allows developers to very efficiently manage memory allocation, concurrency, and control flow. That means fast implementations that can outperform preexisting models in other languages, including even (gasp) Python. It’s a useful skill to know and in this live stream I’ll use C and C-based Python tools like Cython + spaCy to develop some really fast natural language processing algorithms for text data. We’ll be able to tokenize, tag, normalize, vectorize, and dependency parse articles of text to derive valuable insights. No installation necessary, we'll do this together using Google Colab in the browser. Join me, there’s a lot to cover here! Code for this video: https://github.com/llSourcell/c_programming_for_machine_learning Please Subscribe! And like. And comment. That's what keeps me going. Want more education? Connect with me here: Twitter: https://twitter.com/sirajraval Facebook: https://www.facebook.com/sirajology instagram: https://www.instagram.com/sirajraval This video is apart of my Machine Learning Journey course: https://github.com/llSourcell/Machine_Learning_Journey More learning resources: https://pydata.org/berlin2016/schedule/presentation/51/ https://smerity.com/articles/2018/cython_for_high_and_low.html https://explosion.ai/blog/writing-c-in-cython https://spacy.io/api/cython https://medium.com/huggingface/100-times-faster-natural-language-processing-in-python-ee32033bdced Join us in the Wizards Slack channel: http://wizards.herokuapp.com/ Learn more about the School of AI: https://www.theschool.ai And please support me on Patreon: https://www.patreon.com/user?u=3191693 Signup for my newsletter for exciting updates in the field of AI: https://goo.gl/FZzJ5w Hit the Join button above to sign up to become a member of my channel for access to exclusive content! Join my AI community: http://chatgptschool.io/ Sign up for my AI Sports betting Bot, WagerGPT! (500 spots a
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Siraj Raval · Siraj Raval · 0 of 60

← Previous Next →
1 What is Bitcoin?
What is Bitcoin?
Siraj Raval
2 5 Ways to Use Bitcoin
5 Ways to Use Bitcoin
Siraj Raval
3 BTC Fever - Siraj [Music Video]
BTC Fever - Siraj [Music Video]
Siraj Raval
4 5 Reasons to Build Decentralized Apps
5 Reasons to Build Decentralized Apps
Siraj Raval
5 The Interplanetary File System
The Interplanetary File System
Siraj Raval
6 How to Build a Dapp in 3 min
How to Build a Dapp in 3 min
Siraj Raval
7 Life Before Smartphones
Life Before Smartphones
Siraj Raval
8 4 Ways to Use Smart Contracts
4 Ways to Use Smart Contracts
Siraj Raval
9 3 Dapps You HAVE to See
3 Dapps You HAVE to See
Siraj Raval
10 Char's Life as a BitTorrent Engineer
Char's Life as a BitTorrent Engineer
Siraj Raval
11 4 Reasons AlphaGo is a Huge Deal
4 Reasons AlphaGo is a Huge Deal
Siraj Raval
12 Build a Neural Net in 4 Minutes
Build a Neural Net in 4 Minutes
Siraj Raval
13 Sentiment Analysis in 4 Minutes
Sentiment Analysis in 4 Minutes
Siraj Raval
14 The Hackathon Life
The Hackathon Life
Siraj Raval
15 Your First ML App - Machine Learning for Hackers #1
Your First ML App - Machine Learning for Hackers #1
Siraj Raval
16 Build an AI Composer - Machine Learning for Hackers #2
Build an AI Composer - Machine Learning for Hackers #2
Siraj Raval
17 Build a Game AI - Machine Learning for Hackers #3
Build a Game AI - Machine Learning for Hackers #3
Siraj Raval
18 Build a Movie Recommender - Machine Learning for Hackers #4
Build a Movie Recommender - Machine Learning for Hackers #4
Siraj Raval
19 Build an AI Artist - Machine Learning for Hackers #5
Build an AI Artist - Machine Learning for Hackers #5
Siraj Raval
20 Build a Chatbot - ML for Hackers #6
Build a Chatbot - ML for Hackers #6
Siraj Raval
21 Build an AI Reader - Machine Learning for Hackers #7
Build an AI Reader - Machine Learning for Hackers #7
Siraj Raval
22 Build an AI Writer - Machine Learning for Hackers #8
Build an AI Writer - Machine Learning for Hackers #8
Siraj Raval
23 Build a Chatbot w/ an API - ML for Hackers #9
Build a Chatbot w/ an API - ML for Hackers #9
Siraj Raval
24 One-Shot Learning - Fresh Machine Learning #1
One-Shot Learning - Fresh Machine Learning #1
Siraj Raval
25 Generative Adversarial Nets - Fresh Machine Learning #2
Generative Adversarial Nets - Fresh Machine Learning #2
Siraj Raval
26 Tone Analysis - Fresh Machine Learning #3
Tone Analysis - Fresh Machine Learning #3
Siraj Raval
27 Generate Rap Lyrics - Fresh Machine Learning #4
Generate Rap Lyrics - Fresh Machine Learning #4
Siraj Raval
28 Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Siraj Raval
29 Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Siraj Raval
30 Build an Antivirus in 5 Min - Fresh Machine Learning #7
Build an Antivirus in 5 Min - Fresh Machine Learning #7
Siraj Raval
31 TensorFlow in 5 Minutes (tutorial)
TensorFlow in 5 Minutes (tutorial)
Siraj Raval
32 Build a Recurrent Neural Net in 5 Min
Build a Recurrent Neural Net in 5 Min
Siraj Raval
33 Build a Simulation in 5 Min
Build a Simulation in 5 Min
Siraj Raval
34 Build a TensorFlow Image Classifier in 5 Min
Build a TensorFlow Image Classifier in 5 Min
Siraj Raval
35 Tensorboard Explained in 5 Min
Tensorboard Explained in 5 Min
Siraj Raval
36 Generate Music in TensorFlow
Generate Music in TensorFlow
Siraj Raval
37 Build a Game Bot (LIVE)
Build a Game Bot (LIVE)
Siraj Raval
38 Deep Learning Frameworks Compared
Deep Learning Frameworks Compared
Siraj Raval
39 Introduction - Learn Python for Data Science #1
Introduction - Learn Python for Data Science #1
Siraj Raval
40 Build a Neural Network (LIVE)
Build a Neural Network (LIVE)
Siraj Raval
41 Twitter Sentiment Analysis - Learn Python for Data Science #2
Twitter Sentiment Analysis - Learn Python for Data Science #2
Siraj Raval
42 Recommendation Systems - Learn Python for Data Science #3
Recommendation Systems - Learn Python for Data Science #3
Siraj Raval
43 Predicting Stock Prices - Learn Python for Data Science #4
Predicting Stock Prices - Learn Python for Data Science #4
Siraj Raval
44 Pong Neural Network (LIVE)
Pong Neural Network (LIVE)
Siraj Raval
45 Deep Dream in TensorFlow - Learn Python for Data Science #5
Deep Dream in TensorFlow - Learn Python for Data Science #5
Siraj Raval
46 Visualizing Data with D3.js (LIVE)
Visualizing Data with D3.js (LIVE)
Siraj Raval
47 Genetic Algorithms - Learn Python for Data Science #6
Genetic Algorithms - Learn Python for Data Science #6
Siraj Raval
48 Enter Siraj [Music Video]
Enter Siraj [Music Video]
Siraj Raval
49 Build a Web Scraper (LIVE)
Build a Web Scraper (LIVE)
Siraj Raval
50 Why is P vs NP Important?
Why is P vs NP Important?
Siraj Raval
51 How to Make a Neural Network (LIVE)
How to Make a Neural Network (LIVE)
Siraj Raval
52 How to Make an Amazing Tensorflow Chatbot Easily
How to Make an Amazing Tensorflow Chatbot Easily
Siraj Raval
53 How to Make an Amazing Video Game Bot Easily
How to Make an Amazing Video Game Bot Easily
Siraj Raval
54 How to Make a Tensorflow Neural Network (LIVE)
How to Make a Tensorflow Neural Network (LIVE)
Siraj Raval
55 How to Make a Simple Tensorflow Speech Recognizer
How to Make a Simple Tensorflow Speech Recognizer
Siraj Raval
56 Joel Shor - Really Quick Questions with an Awesome Google Engineer
Joel Shor - Really Quick Questions with an Awesome Google Engineer
Siraj Raval
57 How to Make a Path Planning Algorithm Easily (LIVE)
How to Make a Path Planning Algorithm Easily (LIVE)
Siraj Raval
58 The Best Way to Prepare a Dataset Easily
The Best Way to Prepare a Dataset Easily
Siraj Raval
59 Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Siraj Raval
60 How to Make a Tic Tac Toe Neural Network Easily (LIVE)
How to Make a Tic Tac Toe Neural Network Easily (LIVE)
Siraj Raval

This video teaches C programming for machine learning, covering topics such as memory management, concurrency, and control flow, with a focus on natural language processing tasks. It provides a comprehensive introduction to the tools and techniques needed to build efficient machine learning models in C.

Key Takeaways
  1. Create a C program to manage memory allocation and deallocation
  2. Use scythe on and Spacey for faster implementation and industrial-strength natural language processing
  3. Implement data pre-processing steps for natural language processing tasks
  4. Use pointer usage and strong typing to optimize memory management
  5. Fine-tune machine learning models for specific tasks
💡 Using C programming for machine learning can provide significant performance improvements due to its ability to efficiently manage memory allocation, concurrency, and control flow.

Related AI Lessons

The AI Moat Paradox: The Better Models Become, the Less Models Matter
The AI moat paradox suggests that as AI models improve, their importance may decrease, and understanding this concept is crucial for AI professionals and businesses.
Medium · AI
170,927 AI Papers Reveal the Biggest Research Shifts of the First Half of 2026
Discover the biggest AI research shifts of 2026 based on 170,927 papers, and learn how to apply these trends to your work
Medium · Machine Learning
170,927 AI Papers Reveal the Biggest Research Shifts of the First Half of 2026
Discover the major research shifts in AI from 170,927 papers published in the first half of 2026, and learn how to analyze trends in AI research
Medium · Data Science
[PoV] When Everyone Is Smart, No One Is
In a world where AI makes everyone smart, the value of intelligence decreases, and new challenges arise
Medium · AI
Up next
Man dies after horror Gold Coast house fire; high-speed Sydney motorway pursuit | 9 News Australia
9 News Australia
Watch →