Trying to Learn a Programming Language Live

Rob Mulla · Beginner ·🎨 Image & Video AI ·3y ago

Key Takeaways

This video demonstrates learning Rust for Data Science through live coding

Full Transcript

for you they made me blind they made me hello everyone it is Tuesday November 29th 2022 I hope you're having a great night and great start to your week we are going to do some live coding here I know um on Sunday we were doing some coding and uh uh that was fun but we're gonna switch up gears here today we're gonna try to learn a brand new language the language of rust a coding language that I have never had any experience working with so my background is in data science I work with python pretty much exclusively I've never really messed with other programming languages what's up Vegas welcome to the chat so I want to expand my palette a little bit I have worked you know I write SQL I do bash shell script I I've done stuff with r but you know we need to learn something brand new and that's going to be rust today so we're going to see how it works and we're gonna try to just figure it out from scratch so let's go over to the camera and let's talk about goals for today we got some goals number one is to figure out well I I need a rate shorter things here hey everyone in the chat welcome how are you doing all right so I need to figure out number one install rust um rust Jupiter notebook and then data science tutorial I just want to get into it and start coding hey why rust I don't know I don't know why not rust it seems like it's popular and um yeah let's just learn a little bit about rust before I dive too much into it so uh let's look up the Wikipedia page for Russ the programming language so we know a little bit about what we're going to learn today so rust is a multi-paradigm okay I'm not going to read all this uh it emphasizes performance type safety and concurrency that's something python doesn't do is um is require you to uh to identify what type of each element that you create is it rust or goat we're going to do Rust so before last stream I talked about doing with with go but I found some tutorials with Russ so we're going to go with this so um how old is it it was first appeared in 2010 and it's clock cross platform it has file extensions RS and R lib there's already some stuff I learned about rust that I when I was trying to get it set up here but let's go ahead and shut this down I have a Jupiter notebook up but we're gonna go into my rust data science so this is the only thing I've done so far the only thing I've done so far is at first I try to install rust and then um I did it just with with uh apt sudo apt install R rust or whatever it was called um rust something and then I found out that you need to use this package manager um so rust up so this was something I found online which said to install using this URL and I forget what it's even called see this is really going to be really gonna be like a newbie trying to figure out how to install yeah rust up so if you've installed rust up in the past I guess this is like your package management I don't know but I ran this command to install rust so it looks like this rust install downloading installer um okay so it's gonna update yeah and then there's all this stuff with cargo like use cargo to install stuff oh another reason why I wanted to uh work with rust is because this kind of sparked me this guy's YouTube video on like he did just like a simple coding video it's a good one I'll put it in the chat um but it's a way oops I hope that link works this guy goes through like how do you is rust for data science and the answer is kind of no for the most part but I guess there's some way there are some times where Russ might be helpful and it's definitely uh potentially faster than Python and then he goes through this example I think he just does like a a simple decision tree um but we're gonna follow this this tutorial that we have but first I need to get rust installed on my machine so proceed with installation is going to be one rust is now installed great Okay so to configure your shell run source home cargo EnV what where am I am I in the shell okay so now now let's you should look at cython 2 in the future yeah definitely I mean I can't just spend all my time learning new languages or else I'll I'll get nowhere but it's fun from time to time to try to learn something new right especially in front of people so they can make fun of you feel free to make fun of me if you want okay so rust for data science tutorial I found this here but before that oh yeah our to-do list so we installed rust that is checked off of our to-do list number one is done number two is let's try to install this Jupiter notebook because it will be kind of familiar to do it this way I guess so if I go into my terminal NRA which cargo is Cargo installed let me exit out of there and try to reroute which cargo okay so now it's found my cargo located in my uh local directory and I'm going to do cargo install EVC XR Jupiter all right so I don't know what it's really doing right now it's pulling a crate so I'm I'm assuming this is something like pip installing while that's installing let's go cargo is a rust package manager that's right so this is like this is like crayon for r or um or pip for python or pie pie I guess it's called or I guess it's kind of like kinda like it it manages dependencies it compiles your packages that's more like conda and makes distributable packages okay so I guess it's downloading this EVC XR Jupiter and I'm wondering while that's going on let's go into this cargo directory and see what's going on in here so there's a EnV file this looks like it's probably called in my bash RC right now so let's open my bash RC cargo yeah look this bottom line was added to my I'll make some lines here so this bottom line was added to my not that other stuff but this was added to my bash RC which then made cargo identifiable from just my Straight Up shell so that that made this cargo EnV available now I can look there's a package cache oh maybe that's been um modified as we as this is installing so I shouldn't look in there there's also a registry and let's just cat things because I don't wanna there's a signature don't know if that's bad for the show everyone uh off topic is that Andy's here this is a 60 minute IPA um so we are what are you guys saying scython is basically python with types in some decorators learning curve is non-existent but it's a lot faster oh okay um python usually like most of python that I use when it's trying to do stuff that's fast it's using a C library and just using the python API so it's like the python doesn't have to be fast as long as it's just access it's the easy interface to interact with the stuff that needs to be fast right have you had a tutorial on setting up tmux looks very much like the conf I have I did make a YouTube video about um about my setup but like my entire setup I didn't go into too much detail I just said that my uh tmux basically is made it based off of this like pretty uh tmux config file that I found online all right so um let's see what this says to do to install this so now that we have this wait so I can just call this okay so then it has in here so guys in here there's a bin directory and these are all my compiled stuff so like rust is in here wait oh rust C that's rust C that's what I had to pip install all right so that's just straight up rust but now because this bin directory is a part of my path I guess that's why I can just run this EV xcr install okay so what did that do that wrote a bunch of stuff into my local share Jupiter okay so now I have all these kernels rust were these all already there now I just have this kernels rust there's a JavaScript linter let's open this logo what is this logo oh it's just a lust rust logo really small one small for you all there we go so there's a rust low logo here in this now kernels okay uh if your operating system is the older version it has a different lib C to actually use Jupiter you'll need a Jupiter notebook installed you'll also need the source for the rust standard library and called if you've already used rust analyzer you'll likely have this installed to install this okay so now I just run a normal Jupiter notebook and it's going to know that all right running Jupiter lab in here I don't think it's just gonna show rust oh whoa look how wrong I was look how wrong I was it is here uh you love the new Twitter video on YouTube today thanks Big Larry uh glad you like that I try to make it short and sweet for you all what am I learning stunner we're trying to learn rust [Music] we're trying to learn how to code in Rust we're trying to learn data science with rust um so let's shut this down what if I [Music] activate Jupiter uh title two and then a new Jupiter lab in here is Russ going to show up because I think it might be pointing to a different no it shows up in here foreign so here up in the top right can you guys see this it says the kernel I'm using as rust am I Coating in Rust here let's just print hello world if it was python this would work but clearly we're not in Python we're in Rust world baby we are rusters we are officially rusters foreign we did it Rob there's a place I can find a list of all the things you've scraped from Twitter you mentioned a few but wasn't sure if it was all all the things you could scrape from Twitter big Larry isn't that like an infinite answers to that question that's like saying what are the I'm I might not be getting your question right because oh do you mean like the different things that you can um filter your query on like there's set syntax when you're searching it when you're querying uh in Twitter to filter down your searches hopefully that's what you mean hello ow that D D and B sounds good yeah is it too loud I am kind of annoyed that when I stream I can only listen to unless I want my videos to get taken down I can only really listen to music that you know it's fine but it's not my favorite type of music like it would be cool to just when I first started streaming streaming I didn't care about the video staying up so I just listened to old music I enjoyed and I kind of missed those days okay so how do we comment in Rust two backslashes that was just a wild guess all right so now we're coding in Rust in a notebook I thought Russ is compiled how would that how does this work custom output I don't know what this is prop prompting for input let's see if this little bit of code works where is it prompting I'm so confused name that took forever to say name Rob no not gonna tell you my password okay so that worked that worked here that worked in we're running rust and let's also go to this other example they have which is much longer let's try to figure out what they're what we're doing in here so we're making a matrix this stuff confuses me what is going on HTML that push string what's that what's TD oh this is making a table it's like making a HTML table okay okay so that looks like something I get it it's a lot of code to make that but you know it's rust so it's super fast all right let's restart this and let's try to do some data science uh we've got to learn the hello world of rust right that should be the first thing that we do whenever you learn hello world will be what we print here whenever you learn a new language you need to you need to print hello world so we always have to make a main function I guess I'm not sure if that actually is true in so rust has a lot of brackets it looks like like this we Define our function like this and of course print is print Ln blow world like this am I missing something exclamation point after this and semicolon okay so this needs to be double quotes it's not like python where it doesn't care about quotes um then do I need to run Main in this cell because I'm it's not like I've written a script here there we go we wrote hello world we did it I think rust uses brackets whereas python uses indentation okay so like anytime you see this it's as if we have a new tab or or space indentation all right we wrote hello world that should have been number one on our number two on our list but we've done these two so yeah let's say three is hello world we did that now this is four do you like the music video you sent me Robert oh yeah that was kind of bizarre I forget what it was I see what you're saying Herbie Hoover who Reef Hoover is smart yeah like why am I doing all this when I can just print Ln uh I gotta remember double quotes hello world okay so it adds this maybe that's just because we're executing it in Jupiter and it's acting weird because of that but it adds this so can I assign let's just let's just mess around here a little bit so can I assign a variable like uh like in Python if Taco equals one that's not gonna work right so we're gonna have to define a taco is it like an INT taco maybe just looking at this will be a good way to before we jump into the data science stuff know the basics like The Primitives all right so we did Hello World The Primitives are we have integers I8 1630 okay so this is like the um bits used unsigned integers oh these eyes are assigned user unsigned effort floating points Char for characters that's going to be like a string bull true or false and then unit type whose only possible value is an empty Tuple why why does anyone understand that looks pretty much like JavaScript someone's saying if you're learning rust in the fly you're going to be in for a world to hurt well we're just trying to do all right so in order to define something let's do let Taco let's just let the taco be and then we're gonna say this is a uint equals five is that gonna work air expected semi uh oh yeah it's not you went you and python thing so I need to do I need to do u8 u8 yes we have a taco we have five tacos uh uh let's do five tacos and then let's do I ate and do negative five for pizza Taco plus pizza no implementation for adding um hmm but since I can't make this Taco into negative five because it's an unsigned and why am I why am I um hiccuping so much uh let's make this 32 bits which one is faster python or rust I think rust pink rest but it's all right so let's just do an I ain't oh wait I ain't and then try to add taco and beer it equals yes okay so now we can do that so in order for us to add these two things they have to be the same primitive what if what if one of these is is a i8 can we add these together no implementation for this okay so then they also have arrays which looks like they're lists and tuples which are like a tuple foreign oh this is weird it infers the type let mute infer type equal 12. where's this I-64 inferred from oh it's inferred from when it's defined immutable's variable can can be changed error this type of variable can't be changed all right let's go ahead oh I think we know rust now we know enough about rust what else should we do rust for long uh let char oh wait no let me Char equals Rob expected oh wait I can write in here oh these are scalar four bytes each I don't understand how would you have a long string then characters a strings ABC so what what's a string [Music] where's a string doesn't have a size no net compile time oh man this is just as bad I really don't know what I'm doing I write the whole thing [Music] string uppercase literals and operators so integers floats characters strings booleans and unit type can be expressed using literals integers can alternatively be expressed using hexadecimal octal or binary notation using these prefixes respectively all right so this kind of makes reminds me of python like a binary string would has this B before the quote I don't know should we just follow a tutorial that like then try to figure it out there all right we made a matrix data science tutorial in Rust let hello string from Hello World okay Stefan's here to save the day let me try to copy this of course it's not gonna let me copy it um so here we is we assign hello equals to this string then we have to say from hello world and then can we do print Ln hello do I need a semicooling error format arguments must be a string literal can I do like type on hello what's this delimiter crap I have no idea did he did he mention why Russ no just because I'm trying to like I want to be in pain tonight so we're going to learn rust I don't know I just want to learn something new um I did mention this this uh this guy's YouTube video did kind of spark excitement in it for me so this is I put this in the chat earlier so I guess if you're looking for a reason why it would be that um it would be this one and I just want to see if I can use another programming LinkedIn language to do data science oh Stefan has no idea why that works but you found this in the docs all right we're going to figure it out we're going to figure out this data science tutorial so let me pull this one over here rust for data science tutorials so I don't know if I can run cargo in here uh but let's yeah I can't just run this here right this would be within rust so I need to exclamation myself out of here and maybe that doesn't work like it does in Python so this is probably something I'm gonna have to do here so I'm gonna have to do go here rust data science which I'm in yeah this directory I'm in and then I'm gonna run this cargo new our data science tutorial one and well and then that's just going to create a new application so now if we go into this tutorial what do we have automatically we have a get so is this it's already a git repo that's interesting you thought Julia was making a comeback someone thought Julie is making comeback maybe it is so all this this cargo really does is it created a directory that's now here if I refresh this I think that has a source with our main rust file okay so it cargo will create this automatically it looks like it also created oh the name of it the version the Edition whoa It's a year old and that's that so we did that I think I understand how cargo works okay so then we have to once we've cd'd into this directory then we cargo add so this is like installing I think ND array I'm imagining that's like numpy-ish ND array brand ND array stats noisy float Polo toe okay Andy array oh I didn't spell it right forgetting my A's okay so this creates the io index added some stuff so now let's see what's in this cargo ah cargo lock so this is cool it's like keeping track of all of our packages some of these names remind me of python stuff like enter tools that makes me feel good and the array makes me feel good all right noisy float so these are all the packages I think we just installed you guys with me trevlar is helping me out let me equal string so we're gonna get the hello let me and string equals rub oh this was is this what is missing and then oh wait and I don't think this is code that you're saying and then print me oh this looks like python-ish this looks like the old python format yes is is learning rust look at me Rob is learning Russ look at me wait Rob is yeah that worked your 2ml has your dependency someone says so okay so that's this cargo 2ml I see this is like so this is like my requirements that txt like the equivalent ish of that uh demo is asking hi I want to offer promotion to your channel viewers followers the price is lower than the competitor um no don't advertise on my on my Channel please that sounds that looks like so scammy how do I ban this person am I really do we have that big of a crowd that it's worth spamming to Bam Bam people are so excited for me to ban this guy [Music] I'm gonna just put them in timeout all right um so our source I guess this is where a real code would be this is where our main is it's weird that I have this I hate these ipy checkpoints but move this and we're on our way so what have we done we've installed some packages basically we've made in an environment I I think or like we made a setup thing for uh for going and now we're going to actually do our code um all right so why are we using ND array in Rust there are already arrays or lists yeah we looked at that we we already learned all that well we kind of understand that they're there are lists here um right these are arrays and also vectors in the language itself allows for many different types of manipulation through powerful iterators what is more that is offered a bit by the bear rust language so that's interesting it's kind of like numpy being built into python so you would think it would be faster but they're saying still ND array is specialized to handle n-dimensional arrays with a mathematical end view so it's basically like they're saying in this tutorial that rust at its core can do a lot of the things numpy can do but it rust still has its own numpy because there's some things it can't do that it needs thus ndra builds over the power already provided by the language okay that makes sense um so at the top of our main rust file we would add this so should we do two things at once I think I should just run everything in hmm now this is interesting so how is this going to work do I have to now go into this Source directory and create a rust it's gripping in here is that gonna work no because it's Undeclared module in here so let's just say I I ditched if I was to ditch the whole Jupiter thing and just go into this Source directory and in here yeah let's remove this Untitled and in their main do we just add it up here now how do I run this wait is rust compiled I think so yeah Robert you're confused I'm confused we're all confused we're you are with me on that one so I'm looking at their example yeah so they do have it like this our main file has this ND array Prelude star is this star kind of like import Star in Python probably a bad thing to do not explicitly saying but now here's the problem I don't even know how to run my rust program like I don't know how to see if this program runs from the way it's built maybe it compiles just in time someone say that sounds like like true ah cargo run this guy's here to save me could not find that oh wait because I'm not in my and not in my cargo space cargo space hey cargo run boom we've saw like we've learned rust completely here no no we didn't it's still failing unused import how did it know to print hello world what the f what the flip oh did I put that in my main yeah I did put that in my main I was I was freaking out there for a second all right so we it's just yelling at us because we didn't use this it's an unused import ant is there no one that knows Russ that can help you know it's uh trevlar trevlar in the chat in in twitch has been helping um so let's keep on going let's go with this um I don't so I don't think I can I don't think I can use this without actually okay so let's try let's try it here can I just say it was the problem that I didn't use can't automatically determine the type of variable of array one please give it a type is this a warning let's put this all in a main uh what's the syntax what's the syntax is it like this oh wait I also deleted that one cannot find macro array in this scope so I just restarted the kernel I'm going to see if this works ignore warnings like python problem solved bury your head in the sand error cannot find the macro array in this scope what the what now it's yelling at me two times all right so maybe we're just gonna have to give up on on that and just go in Vim just Vim it remove this Untitled crap remove this stupid iPod checkpoints and let's just go like we're total hardcore hackers and we're gonna go here into Russ for data science we're going to go into our data science tutorial we're going to go into the source and we're going to Vim in this Main and then we're going to make a tab right below it yeah let's just do this we're so cool and let's go ahead and run cargo run here now it's complaining that this is not used but now we're gonna in here say let array one equals our array which I guess we're importing from here and then one dot two Dot three dot or dot five Dot six Dot I think in the actual GitHub repo it's more than that and then we're gonna print our array all right let's save that and it's yelling at us unexpected token oh oh semicolon even tells look at this how nice rust is help add semicolon here a noob like me didn't know that and it helped me out thanks okay we ran it we ran our program we have an array it's like a numpy array but it's in Rust so it's definitely better what language are you learning I'm new in your channel hey welcome die um we are learning rust I usually code in Python and and I'm trying to learn rust for data science yeah let's just go into here yeah now this is cleaner cargo run so now we have an array that that makes sense I know what's going on there now you guys with me um now I gotta actually close this stuff out so I can jump back and forth a little bit easier how far into this are we and I just learned how to make an array hey Rome wasn't built built overnight slowly and surely all right now let's let's compare this to a list so it says that ndra provides an array macro that detects which type of array base is needed in this case a 1D array that makes sense notice that underline array base already implements standard format display function okay and notice that comp compare it to the standard rust array let's call them lists in order not to confuse them with ND arrays okay so let's compare these with like a normal array let LS1 equal uh let's just copy this stuff over right let's let's yank this and that's oh man that's how bad I am in them yank this and put it here yeah okay so there we go so now we have this list which isn't being used so it's complaining about that and then we're going to print yeah let's just copy this line but let's make this LS1 and well let's call this a 1D list and let's go ahead why is it saying it can't be formatted with the normal formatter okay so then I have to do in here 1D list slash T oh that's what it's saying that's Auto formatted I have no idea what this is colon and then a question mark yeah so it formatted these as integers I guess is the big thing that we're learning here do you guys follow everyone loves rust but no one marries what the heck is Prelude I think that's the sub module in which we're importing this array I don't know for sure but I think I don't like that there's a star there this gives me like bad vibes from python you never want to you never want to uh just import Star in Python now let's make a vector a vector is going to be yeah let's just let's just copy this copy this and paste it right here and change this to a vector let vet one equals x oh VEC exclamation point so the vector I think is also been imported from ndra and this is going to be a One D vector and then we'll just do this guys following me here and then we're going to run this all right so those look identical all right look we got the exact same result that they're saying we could get with this now let's try to sum try to sum two arrays all right sound good wait till they get to borrowing I'm going to work through small examples rust rustlings what's that I'd rather stub my toe at the end edge of the bed then learn rust wild a thrill that means that you get to like watch me stub my toe so you get to live vicariously through my toe stubbing what's this rustlings that you guys sent a project to contain small exercises to get used to reading or writing rust code yeah this is a good good idea I think we should stick on task though I have problems with that um so we're going to stick with this tutorial so we've done this now we're going to try to sum two arrays so we already defined array one up there so we're gonna create another array called array two and what did they do here they made it like 2.2 3.3 4.4 Etc oh they didn't even go all the way all right then we're going to let array 3 equals array 1 plus array 2. so if we know anything about Matrix uh or or like a linear algebra right what do we think the result is going to be because I honestly have no idea but I think if this is acting like an array and we're summing it with this array then the first value should be two right and then the second value should be 4.2 so let's check and see we're going to print this 1D array equals array 3. and don't forget your semicolons what did I do wrong here why is it yelling at me found print and Ln I thought println is corrected correct oh oh I was just talking about how I need to not forget my semicolons and I forgot one up here thank you linter cargo run yes so the result is what I thought it's two hopefully you guys can see this two 4.2 6.3 8.4 Etc what's the difference between a vector and array I don't actually know I know the difference between the list and array they told us well they've told us so far that the list doesn't do this Auto formatting I guess the vector doesn't too when you print it and then I guess there's some math like should we try to do this with try to sum two lists I'm guessing that's where it won't work let's try to break things right so we're gonna call this uh LS2 and then LS3 is going to be LS1 Plus LS2 and then we're gonna call this summed lists and then we'll make that LS3 and I think we have to do this I have no idea what that question Mark's all about let's try to Cargo run this all right so this fails why does this fail array base owned repper dimension on you size one to float six so LS1 yeah so it's not doing like the vector Edition I think that's why this is breaking not to get too sidetracked with things that don't work but I'm guessing that's the difference between a list and array does that answer your question Vector is a dynamic array someone's saying Trevor all right so let we're gonna do some data science see stuff we sum two arrays oh look they do it next they do it uh I was one step ahead of them not really but I'm gonna set paste so I can paste this in here they're comparing move all this over foreign versus summing lists so if we this is how we summer sum the array we already know how to do that so let's delete this but if we wanted to sum the array we would have to make a mutable LS3 which is a clone of LS1 so I'm guessing this like a copy this is like dot copy um and then we would have to Loop over each item in the length of the second list and add the two together and add that into this mutable thing yeah so this would be super annoying this would be like how you if you wanted to add two lists in Python you'd have to do this that without importing numpy so it's a it's the same thing I think and then I guess there's a there's an easier way to do with a vector but still this is not super clean so I think we can understand looking at these three examples why out of all of these we would choose to use this array from ND array yeah ND array because it makes this this addition of vector is a lot easier okay let's try to find okay so now later in this tutorial they're they're showing us multi-dimensional arrays I kind of get the idea of that I mean I probably don't but like they're doing a DOT product let's just let's just paste this in 2D to raise a remote let's just abandon quickly example using Russ standards construct since we've shown and let's just focus on ND array sounds good so let's paste this in let's paste this in and see what we got here how do I unset paste I forget how to undo the paste all right so now we have other kinds of arrays and operations what's this from LM from lm211 let's see what this array four and five when we do a cargo run it's gonna break here oh it's starting to do random stuff down here yeah I got ahead of myself so let's delete all this and now we have a multi-dimensional array that's a 4D array and this is our 2D array so this is just like just like numpy you could have like a uh it's like a tensor it's in pi torch or or tensorflow or numpy you can have 3D arrays when I look at this language I miss R and python more they're way simpler I agree TY but it's cool to learn something new right so this already is a 2d array array 4 is 2D array I don't know what this from alum okay so there's just various methods to create and instantiate 2D arrays so this is okay this makes sense so this is like in in numpy If You just defined an array like this actually this syntax would work I think uh if you did like NP array and then you wrapped it around basically everything here it would work and then this is just saying to make it of the size two by one it can't be because then how would you sum these with the value of one in it can we go to like a rust okay so maybe we should be doing this yeah like doing searching on Google to figure out what this stuff means instead of guessing um but yeah it looks like this is the size and these are the dimensions and it creates a vector where T is cloned I don't know anyways this works oh because our output array is I'm not quite sure with the macro array we need to specify all elements while in the array from Allen oh it says it here we need to offer the shape in this case two by one and then the element to fill the array in this case one so this is a lot like numpy yeah so this is very familiar so in numpy you do like NP ones like or ones NP ones would um yeah let's open up IPython import no numpy as NP so in in Python and numpy you could do an array of one two three right that'd be our array or we could make it a 2d array and then if we save this off as my array then my array shape is two by three but then you could also do NP ones and then give it a shape of two by one and it's going to make this two by one array so I think that's what we did here and we did this Plus my array yeah I'm not quite quite sure why this oh it's because we're we're looking at the wrong output this is just the output of the 2D array I think which is the same as here in numpy two three four five six seven got it got it so we need we kind of need like up here we need another print Ln multiply arrays uh my semicolons I'm gonna get it after a while lots of rust is there to stop you shooting your eye out or someone else's when writing a hardware device driver oh I don't want to shoot my eye out with Russ so I'm happy to not shoot my eye out hello good morning some people are State some people are saying they love rust nice have you checked out polars to create data frame in Rust not yet but I've heard so many good thing about polars polars has a python API too I need to make like a video about polars either there's like uh MLM scheme where people are promoting polars or it's actually good one of those two is true all right so I think I understand this this is multiplying the Rays this is creating the identity Matrix that's that we know how to do so let's [Music] so how would we do identity Matrix in numpy is it like e-y-e numpy identity Matrix oh it's just yeah it is ey and p e y e five yeah that just makes an identity Matrix an identity Matrix so you don't know is a matrix that is um ones across the diagonal it's always like this makes sense oh someone yes said yes I so all right so now we know how to do this in Rust kind of it's the same thing e y e a lot of similarities it's kind of like I don't know learning a going from English to something else go into English to Spanish like you hear some words and you're like oh I know that word and you suggest to learn rust I just have from your live in search about rust programming language and see some videos uh you just left so someone said they just left my stream to go watch other videos about Russ okay that might be a better way to do it probably I don't blame you what's going on some people are asking what's going on uh we're trying to learn rust so this is a 40-year race I think we're good with this let's continue with this tutorial I think we can get completely through this tutorial tonight so I'm gonna go ahead and close this all right so let's add randomness randomness so I'm guessing that's like in here in the bottom right if I import random then we can do like Rand int between zero and five your IPython really doesn't like me import numpy as NP NP random oh I guess we could do MP random huh import random uh okay I'm not sure why that's not working [Music] random Rand int three to nine it might be because I'm running rust there that works do lots of people in data science use rust no I don't think so but that's why we're learning it we're getting ahead of the curve ahead ahead of the game man in 2030 you're gonna have to know all of rust in order to get a job and we're gonna be like oh I have wait wait how many years would that be eight years of experience everyone in the chat can say they have eight years of rust experience when they apply for a job in 20 30. hopefully I'll be dead but don't say that do not say that all right so we're gonna import some new stuff let's go to the top of our script and let's add use ND array random this is our like our random Ness and then iterator random that's I don't know what that is we're gonna find out should we yeah we should just let this run uh let's do let mutable range equals Rand thread range [Music] um and then let faces equal and let's just paste this let's move these over all right so now we have all of our random faces letter array 16 equal an array from the shape Vector so it's going to be of this shape two by two and this choose multiple faces Dot charged dot choose multiples and mutable range for unwrap wow that seems hard and then we're gonna do some prints sampling from these faces so we're just going to print the faces the elements are and then that's going to be the result why is this complaining oh because I didn't do a semicolon one little semicolon and you're never going to let it go rust raster all up in my business because I didn't put one semicolon there we go do you guys see we have random faces provided to us by rust every time I run this they're different top left looks like it's smiling a lot nope now it's crying that's cool gotta I gotta unwrap speaking of unwrap I need to unwrap like what this line means I know this makes it two by two I would never know how to do that on my own but I I think I understand that didn't Mozilla simply create rusts because they were sick of memory management and see possibly so then we're taking these characters choose multiple what's the what's coming from random oh oh this mutable RNG is the random thread RNG what's thread RNG it is choose multiple always just something you can do from how did we just do let faces equal and then this worked I thought we would have to Define faces as like a I don't know I want to go back to that Jupiter session and try this here because this is this is driving me crazy this is driving me nuts how can we just do this let faces equal that this broke before when we tried oh wait wait so that just works but I can't do like let uh dogs equals five does know that this type is oh I don't know how to get the type of things all right so we know we can do random stuff let's do some data visualization let's do some data visualization and that might be it we're going to use ND array stats which is a crate for exposes statistical routines for array base it can do a correlation thank you and make a histogram that's what we're gonna we're gonna try to look at the history how to do the histogram so let's go up to the top of this and let's add some more it's actually just right over well everything that we have already with the correct Imports that I know um so what are we importing histogram sampling strategy this we might actually not end up using and then noisy floats I don't really know anything about that so data viz we're gonna make a random and a array with yeah let's just put all this in here we're going to make our array with random numbers a size 10 000 using a normal distribution I think that's what the standard standard normal that we imported is that makes sense so this array 17 should be like a normal distribution go go golang for DS yeah go and go and uh Russ are both fighting for my attention for for doing data science stuff here's the thing there's no way people are switching because the available resources are not the level people to switch that's true I mean I don't think brother brother brother will you teach us to rest our programming language from scratch please let you please answer my question I have math exam today I have to read what do you want what do you want python programmer data dude just comes in and says box plot what do you do yeah make a box but everyone's just like ganging up on me I'm just trying to learn I don't know where the box plot does it have box plot in here let's not deviate too much from this uh this tutorial where I'm learning all right so we have this random array what's this n64e what's what's rust rust N64 is that Nintendo 64 seriously this is like a Nintendo 64 Runner what okay so it's it's noisy float I wish we were doing Nintendo 64 ROMs all right no noisy float is a floating Point behaving like a f 64 that does not allow null values okay n is the same as stands for so I don't know man we're just doing it so there we're going to make a grid Builder what's grid Builder come from grid Builder comes from this histogram and let's just try to run this this isn't going to run yeah it's gonna yell at me because I'm trying to import things that I haven't used I thought I used this already so we gotta add this other random example that uses uniform and then this sampling strategy we kind of skipped over this stuff oh that is cool that you can do like sampling without replacement but okay let's try to run this now why is this not working let o palato is not found uh I see you what do you think about Julia will it be used in the future or not I don't know I don't really know the future um I see gnu plot looks like matplotlib missing use yeah but what the freak why why is this not working what's poloto someone want water Waddles wants to say your videos helped a lot great I'm glad thank you so much for hopping in and and hanging out and I apologize that this video is not gonna help anyone it's just watching me struggle can someone explain to me poloto what the heck what in the bruh here is their in their GitHub repo how they're using it I'm basically doing the exact same thing so let's let's just make sure it's not it's not just me let's clone this repo maybe this um maybe the version changed or something so let's do git clone of this oh yeah all right so clone it there's no oh git clone this all right now we have it our data science tutorial one which is the one I directly cloned and then cargo run in here please work so maybe it's pulling different versions oh look poloto poloto's here it worked this one worked and then if I open this here I see we have our beautiful histogram with a clear background so it's actually not that beautiful but it did create a histogram maybe look in the 2ml [Music] someone's saying okay that's a good idea all right so this is in my version actually I don't know what version I'm in because I renamed that directory so I'm going to go into my version here and Vim and my cargo 2ml okay so let's compare these versions whoa so poloto's version completely changed from 2.17 to 17 .0 did they change from doing I don't know what what numbering convention that is so can I just change this the 2 17 0 that's not gonna work is it hey that worked thank you chip monkeys got my back and I load juice I lose yeah so it was in my cargo ml but it was a older version or newer version Maybe how do we make this histogram not so ugly graph.histogram so custom ticks I want a custom background looks like they're using a blue here let theme equals theme dot append how come I didn't have have to say use poloto here that that makes zero sense to me like why didn't I have to import is it because it's an ND array Prelude or is it because I'm using this syntax then it knows to use directly from that library and I don't have to import it hat night I'm joining the Russ gang not exactly I'm just trying to feel feel out what the hubbub's about so this graph is a plot y marker I put in poloto in it auto completed to Pi plot because it's like no you want to use Python don't you you don't want to use our or rust so we should be able to I think we should be able to in our Jupiter in our in our um Jupiter session of for us to where am I here will this work under Undeclared create or module paloto so how do I declare rust Jupiter example example with crate okay so I do do I do extern crate no way this will work oh wait maybe it did oh but it just sent it to standard out which doesn't work upgrade right simple theme upgrade right huh so it looks like the way that you build it here though is like build and label can I add this to our existing plot that we know works build and label I know that's not correct what's it saying about this mismatch closing delimiter huh yeah I I think what we learned tonight is I have no idea what I'm doing when it comes to rust but we're just gonna do the very last thing we figured some stuff out we figured some stuff out we're gonna do the very last thing in their tutorial close close this stuff close this crap down go back to our tutorial not this tutorial not this one but this one and we're going to make a scatter plot we're gonna make a scatter plot which just is using random numbers this is where it creates the output standard normal scatter SVG thank you okay so this is how we add lines to it maybe we can try to modify that insert this here oh set paste insert that in there try to run this cargo run that bad boy all right it built we got a scatter plot here of course with that clear background so it looks so ugly can I open it with something else um open with another application Pinta nope still has an ugly clear background you can draw it in here in a different layer all right what do we learn new languages are hard not as smart as I think I am oh that's always true and um you can do some stuff it seems like in Rust I don't know why I would ever want to um but there may be a reason like I know rust has its role for doing things I'm just saying for data science stuff I don't think I'm going to be leaving numpy anytime soon to use ND array and rust even if something needed to be really fast would I ever be able to code it I mean if I knew Russ really well then then maybe I would yeah it's like the chicken or the egg problem right is it worth learning so I can use it well not if I don't know how to use it but I won't know how to use it unless I learn so that's that I hope what about go we were gonna look at go too I don't know I get confused with all this stuff I wonder if golang is not as steep of a learning curve and with less boilerplate is it that was less than two hours yeah that was quick I cannot I mean I can't handle it that long it was fun though to try to uh to learn a new language you know we we did walk through the tutorial I'm just gonna go ahead and paste this tutorial here so make sure you like give it stars on um on GitHub and stuff watch me not be able to even find it this is the tutorial I walked through today there's a sklearn analogous for go link go learn okay I also know there's like a SK learnish for for rust yeah linfa I think this is what that guy's video is about lympha inspired by Python's SK learn or scikit learn so it looks like it does clustering regression even svms that's pretty good all the pre-processing and stuff so yeah if you can do everything in SK learn in Rust I would just have to see it side by side and then try to determine is it worth it [Music] 72 episodes does rest have a notebook version oh yeah we were doing that earlier that's what this is but I didn't know how to import external libraries until just right now and even then I don't really know what's going on so we're at at the beginning of the stream trying to just print hello world and we got that far so this is all in Rust [Music] Brooks build [Music] um so this would be a good tutorial probably a good idea to learn another language besides python someone saying I I agree I mean it can't hurt to at least know how it works and then someone sent this rustlings yeah I saw this earlier I heard this one's good all right on to the data what do we want to do who are we gonna raid [Music] we will raid our boy Nick Nick Wan data science he's probably doing stuff in Python and not in Rust so you guys might enjoy it more uh thanks everyone for hanging out with me tonight it was a lot of fun let's give the raid and then let's uh let's get going right why is he not showing up Nick win Nick win all right 10 seconds until the raid's over so thank you all for hanging out tonight we do oh let me ruin my let me remember to uh promote a few things before we leave so if you are in twitch chat and you type in exclamation uh YouTube if someone could do that that will bring up my YouTube channel which I'm also gonna just type in here uh which is youtube.com slash from Mulla and then also you can join our discourse Discord you can follow me on Twitter that should bring us up and uh yeah just like follow me on the interwebs also subscribe on Twitch if you haven't already alright that's it have a good night bye YouTube have a good

Original Description

I normally code in python. I wanted to try to do Data Science in Rust, so this is me trying to learn. Rust is hard. What could go wrong? Watch live on twitch: https://www.twitch.tv/medallionstallion_ I was inspired to make this video because of @codetothemoon video about Rust for data science: https://www.youtube.com/watch?v=mlcSpxicx-4 Timeline: 00:00 Intro 5:30 Installing Rust 12:32 Rust in Jupyter 20:00 Hello World 35:00 Data Science in Rust 44:00 ndarray 1:08:00 Randomness 1:16:00 DataViz 1:24:16 Histogram My other videos Speed up Pandas Code: https://www.youtube.com/watch?v=SAFmrTnEHLg Intro to Pandas video: https://www.youtube.com/watch?v=_Eb0utIRdkw Exploratory Data Analysis Video: https://www.youtube.com/watch?v=xi0vhXFPegw Working with Audio data in Python: https://www.youtube.com/watch?v=ZqpSb5p1xQo Efficient Pandas Dataframes: https://www.youtube.com/watch?v=u4_c2LDi4b8
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Rob Mulla · Rob Mulla · 0 of 60

← Previous Next →
1 A Gentle Introduction to Pandas Data Analysis (on Kaggle)
A Gentle Introduction to Pandas Data Analysis (on Kaggle)
Rob Mulla
2 Exploratory Data Analysis with Pandas Python
Exploratory Data Analysis with Pandas Python
Rob Mulla
3 7 Python Data Visualization Libraries in 15 minutes
7 Python Data Visualization Libraries in 15 minutes
Rob Mulla
4 Kaggle competition starter notebook walkthrough
Kaggle competition starter notebook walkthrough
Rob Mulla
5 Kaggle Competitions: A Beginner's Guide to Winning
Kaggle Competitions: A Beginner's Guide to Winning
Rob Mulla
6 Jupyter Notebook Complete Beginner Guide - From Jupyter to Jupyterlab, Google Colab and Kaggle!
Jupyter Notebook Complete Beginner Guide - From Jupyter to Jupyterlab, Google Colab and Kaggle!
Rob Mulla
7 Audio Data Processing in Python
Audio Data Processing in Python
Rob Mulla
8 Complete Data Science Project!
Complete Data Science Project!
Rob Mulla
9 Make Your Pandas Code Lightning Fast
Make Your Pandas Code Lightning Fast
Rob Mulla
10 Image Processing with OpenCV and Python
Image Processing with OpenCV and Python
Rob Mulla
11 Speed Up Your Pandas Dataframes
Speed Up Your Pandas Dataframes
Rob Mulla
12 This INCREDIBLE trick will speed up your data processes.
This INCREDIBLE trick will speed up your data processes.
Rob Mulla
13 Complete Guide to Cross Validation
Complete Guide to Cross Validation
Rob Mulla
14 Easy Python Progress Bars with tqdm
Easy Python Progress Bars with tqdm
Rob Mulla
15 Economic Data Analysis Project with Python Pandas - Data scraping, cleaning and exploration!
Economic Data Analysis Project with Python Pandas - Data scraping, cleaning and exploration!
Rob Mulla
16 Python Sentiment Analysis Project with NLTK and 🤗 Transformers. Classify Amazon Reviews!!
Python Sentiment Analysis Project with NLTK and 🤗 Transformers. Classify Amazon Reviews!!
Rob Mulla
17 Get Started with Machine Learning and AI in 2023
Get Started with Machine Learning and AI in 2023
Rob Mulla
18 The Trick to Get Unlimited Datasets
The Trick to Get Unlimited Datasets
Rob Mulla
19 Video Data Processing with Python and OpenCV
Video Data Processing with Python and OpenCV
Rob Mulla
20 Object Detection in 10 minutes with YOLOv5 & Python!
Object Detection in 10 minutes with YOLOv5 & Python!
Rob Mulla
21 Pandas for Data Science #shorts
Pandas for Data Science #shorts
Rob Mulla
22 Object Detection in 60 Seconds using Python and YOLOv5 #shorts
Object Detection in 60 Seconds using Python and YOLOv5 #shorts
Rob Mulla
23 Machine Learning for Facial Recognition in Python in 60 Seconds #shorts
Machine Learning for Facial Recognition in Python in 60 Seconds #shorts
Rob Mulla
24 Time Series Forecasting with XGBoost - Use python and machine learning to predict energy consumption
Time Series Forecasting with XGBoost - Use python and machine learning to predict energy consumption
Rob Mulla
25 Detect Text in Images with Python - pytesseract vs. easyocr vs keras_ocr
Detect Text in Images with Python - pytesseract vs. easyocr vs keras_ocr
Rob Mulla
26 Solving an Impossible Riddle with Code
Solving an Impossible Riddle with Code
Rob Mulla
27 Do these Pandas Alternatives actually work?
Do these Pandas Alternatives actually work?
Rob Mulla
28 Time Series Forecasting with XGBoost - Advanced Methods
Time Series Forecasting with XGBoost - Advanced Methods
Rob Mulla
29 Data Science Uncut - Data Shootout Kaggle Competition (Aug 1 2022 Stream)
Data Science Uncut - Data Shootout Kaggle Competition (Aug 1 2022 Stream)
Rob Mulla
30 Kaggle Dataset Creation from Scratch- Data Science Uncut (Aug 10 2022)
Kaggle Dataset Creation from Scratch- Data Science Uncut (Aug 10 2022)
Rob Mulla
31 Chess Board Computer Vision AI - Data Science Uncut (Sep 7, 2022)
Chess Board Computer Vision AI - Data Science Uncut (Sep 7, 2022)
Rob Mulla
32 25 Nooby Pandas Coding Mistakes You Should NEVER make.
25 Nooby Pandas Coding Mistakes You Should NEVER make.
Rob Mulla
33 DEFCON Hacking AI CTF Solution on Kaggle - Data Science Uncut Sep 11, 2022
DEFCON Hacking AI CTF Solution on Kaggle - Data Science Uncut Sep 11, 2022
Rob Mulla
34 More Chessboard Computer Vision AI - Data Science Uncut - Sep 13
More Chessboard Computer Vision AI - Data Science Uncut - Sep 13
Rob Mulla
35 Medallion Data Science Live Stream
Medallion Data Science Live Stream
Rob Mulla
36 Community Kaggle Competition Overview - Corn Classification (
Community Kaggle Competition Overview - Corn Classification (
Rob Mulla
37 Deep Learning Image Classification - Corn Kernels - Data Science Uncut
Deep Learning Image Classification - Corn Kernels - Data Science Uncut
Rob Mulla
38 OpenAI Whisper Demo: Convert Speech to Text in Python
OpenAI Whisper Demo: Convert Speech to Text in Python
Rob Mulla
39 Yolov7 Custom Object Detection in Python Tutorial  - Chess Piece Detection
Yolov7 Custom Object Detection in Python Tutorial - Chess Piece Detection
Rob Mulla
40 Live Kaggle Coding - Enzyme Stability Prediction - Data Science Uncut Sep, 27 2022
Live Kaggle Coding - Enzyme Stability Prediction - Data Science Uncut Sep, 27 2022
Rob Mulla
41 Finding Chess Cheaters with Python! - Data Science Uncut Livestream
Finding Chess Cheaters with Python! - Data Science Uncut Livestream
Rob Mulla
42 Data Science Uncut - Kaggle Community Competition & Chess Data Analysis - Oct 4, 2022
Data Science Uncut - Kaggle Community Competition & Chess Data Analysis - Oct 4, 2022
Rob Mulla
43 Flight Delay Dataset Creation (Data Science Uncut)
Flight Delay Dataset Creation (Data Science Uncut)
Rob Mulla
44 5 Reasons to Kaggle #shorts
5 Reasons to Kaggle #shorts
Rob Mulla
45 ♟️ Data Science - Chess Data Analysis
♟️ Data Science - Chess Data Analysis
Rob Mulla
46 EXTREME PYTHON & DATA SCIENCE LIVE STREAM
EXTREME PYTHON & DATA SCIENCE LIVE STREAM
Rob Mulla
47 What is Clustering in ML?
What is Clustering in ML?
Rob Mulla
48 What is K-Nearest Neighbors?
What is K-Nearest Neighbors?
Rob Mulla
49 LIVE CODING: Flight Data Exploration with Pandas & Python
LIVE CODING: Flight Data Exploration with Pandas & Python
Rob Mulla
50 Kaggle Survey vs. Twitter Sentiment
Kaggle Survey vs. Twitter Sentiment
Rob Mulla
51 If Top Chess.com Players were STOCKS - Live Coding Data Anaylsis Stream
If Top Chess.com Players were STOCKS - Live Coding Data Anaylsis Stream
Rob Mulla
52 Data Visualization BATTLE!
Data Visualization BATTLE!
Rob Mulla
53 LIVE CODING: Stocks & Sentiment Analysis
LIVE CODING: Stocks & Sentiment Analysis
Rob Mulla
54 Progress Bar in Python with TQDM
Progress Bar in Python with TQDM
Rob Mulla
55 Flight Cancellation Data Analysis
Flight Cancellation Data Analysis
Rob Mulla
56 Synthetic Dataset Creation for Machine Learning - Blender and Python
Synthetic Dataset Creation for Machine Learning - Blender and Python
Rob Mulla
57 The Ultimate Coding Setup for Data Science
The Ultimate Coding Setup for Data Science
Rob Mulla
58 Dataset Creation SPEED RUN - Live Coding With Python & Pandas
Dataset Creation SPEED RUN - Live Coding With Python & Pandas
Rob Mulla
59 Data Wrangling with Python and Pandas LIVE
Data Wrangling with Python and Pandas LIVE
Rob Mulla
60 Forecasting with the FB Prophet Model
Forecasting with the FB Prophet Model
Rob Mulla

Related Reads

📰
How can I batch-generate 3D assets from prompts or images using an API, and which 3D generation APIs support batch generation?
Learn to batch-generate 3D assets from prompts or images using APIs for efficient pipeline creation
Reddit r/artificial
📰
How AI Head Swap Works: The Technology Behind Realistic AI Image Replacement
Learn how AI head swap technology works and its applications in image editing
Dev.to AI
📰
How I Built an AI Pet Portrait Generator That Turns Photos Into Art
Learn how to build an AI pet portrait generator that turns photos into art using deep learning techniques and Python libraries
Dev.to · William Li
📰
I Put Google’s Squoosh Codecs in the Browser — and Cut My Image Bill Before the Upload Even…
Learn how to use Google's Squoosh codecs in the browser to compress images before upload and reduce costs
Medium · Programming

Chapters (9)

Intro
5:30 Installing Rust
12:32 Rust in Jupyter
20:00 Hello World
35:00 Data Science in Rust
44:00 ndarray
1:08:00 Randomness
1:16:00 DataViz
1:24:16 Histogram
Up next
Short.ai Review 2025: Turn Long Videos into Viral Shorts in One Click! 🔥
DroidCrunch
Watch →