 I know it's been a long day and I know people are tired. You guys should pat yourself on your back, sit back, and listen to this. But yeah, so if you're here for the next 25 minutes, you're probably going to learn something really, really cool. How many of you here on a day-to-day job do data analysts or AI work or build models like I do? One, two of you, what about the rest of you guys? Are you anywhere related to data science or things of that sort? Not really. But yeah, so if you are just paying some attention here, you would probably learn a couple of cool things here. Number one, I'm not going to cover what exactly AI is, what AI can choose from, because that's a huge topic. And 20 minutes is something I cannot cover that part. But again, rush is the state of our system programming language, which has been adopted in the industry at a very fast pace. I'm here to give you an essence of what's like to build machine learning models in the system programming language. It gives you a lot of control. As a data scientist, sometimes I go back home and think that I really didn't do great work. I just called a library, gave it some parameters, and did something, and went back home. I do understand what the library is doing, but I really don't know what's happening inside. So that kind of makes me feel a bit bad about it. So that's when I went back and started looking into how can I build models for myself? How can I write everything from scratch? And then I also wanted good control and wanted to make sure that I'm just not building another Python package, which probably I'm the only person who's going to use. So that's where I started exploring other languages and just happened to me. So I'll talk about all of this. Before one thing, I'm very passionate about this topic, because A is something that I do for my living, and rush is my other thing that I do for fun, probably speaking about rush and stuff like that. And that's how it got me into this program. It's called the Mozilla Tech Speakers Program. So people who don't know about it, it's a pretty cool thing. So what they basically do is they take in some really enthusiastic community volunteers and train them to be developer advocates, to go out and develop a facing conferences like these, to talk about Mozilla Firefox and Web in general. So that's pretty much about my affiliation. So I forgot to even introduce myself. My name is Vigneshwar. I live in Bangalore. I work for a research department in a big data firm. We work with a lot of Fortune 500 companies and in my day job, I basically build AI pipelines and there's things related to AI pipelines for all these problems. So yeah, that's pretty much about myself. So let's get started. So for starters, I wanted to give you a picture about what does AI look like? What do people claim as AI? So for me, we will reach AI or we will start, I'll start to say AI exists when AI starts to understand love or something of that sort. Things that matter to humans. Like we can understand certain things but AI just sees everything as numbers and but it's possible, my friends. So that's again, a very good possibility and realities that AI is capable of doing it. Our machine learning models and techniques that we have in place right now are totally capable of doing this. So first thing is the eyes part of AI. We want our models or our predictive models to see like human eyes. And there's something called Turing test. I'm not sure if you have heard about it. So that basically says that if you give two results, one generated by a human and one generated by a machine to another human. And if he's not able to differentiate between the difference, that means you have actually these something really, really cool. That's basically AI for you. And to talk about computer vision, yes, we have these there and techniques like convolution neural net. That's what broke the barrier and made sure our numbers went really high, especially in accuracy and stuff like that. We are now pretty much capable of detecting all kinds of objects. Those kind of problems basically fall in the bucket of object classification and tracking. So the moment you see something, you identify what it is and start to track it. Our human eyes are super cool at doing that. But to do that in the machines is pretty complex stuff. So convolution neural nets basically are neural networks that basically conduits, as the name says, across your image to generate some computations that help you to classify different images. But things can stop over there because in an image, if you have a set of objects, you want to basically classify them. So that's where RCNN came into place. And algorithms like selective search and multiple hypothesis theorem help you to achieve those kind of trafficking algorithms. What are the use cases? You would find a lot of use cases in surveillance like for safety purpose and things like that. Apart from this, there are a lot of business use cases that will blow your mind off, which you can just catch me later after this talk. I can talk all about that. So next up is stat boards. We want to start reading and understanding humans. I say a statement that skies are in the clouds. My mission doesn't understand it. I want my mission to basically say that the moment I start saying these skies are, it should associate it with clouds. Are we able to do that? Yes, we are able to do that as well. So algorithms like neural networks, LSTMs and stuff like that help you to do it. So what it basically does is like it's kind of getting you the attentions and the mappings better. I'm just gonna leave it over there because getting into details is super interesting but we don't have the time for that. Again, what are the use cases? You would see a lot of these big, big B2C clients using them because whenever you have customers and you want to support them, chat boards are a really, really cool thing to use. Going ahead, predictive maintenance. This is something that all the industry are looking forward to, why? Because it saves money. I want to make sure that my cars is good, my fridge is working fine and things like that. So here we do a lot of time series analysis where you have data coming in at a regular interval. You want to basically find an anomaly. If that any part of a mission that's not working really good, I want to detect that. So IoT space has a lot of use cases. And a lot of, again, amazing techniques mostly into regression, Kalman filtering. Again, there's a huge set of algorithms here. Again, I'm just gonna leave you with some names so that you can go back home and think about them. Again, complex games. When I showed this slide to my friend for the first time, he was like, hey, this is nothing to do with AI. But the reality is that we are trying to simulate everything in games because games are virtual environment where we can let our AI free and start to observe patterns. So in recent days, you have seen organizations cracking Dota, organizations cracking Go. These are amazing stuff. If you just go back and think about the complexity in those games, it's even difficult for humans to crack it. Algorithms like Markov addition process, a dynamic program which falls in the class of reinforcement learning are able to do this. Again, the applications are self-driving cars. Another cool stuff. And then they're trading engines that help you to make more money. And there's a whole lot of series of optimization problems that you can solve using these set of algorithms. Next is voice search. So automatic speech recognition, trying to find what's being spoken. Algorithms like, in a feature-engined part of it would be sectograms where you do fast Fourier trams. So convert your data into in the frequency domain and then you run your CDC algorithms. So again, end of the day, there's better mapping and things like that. Again, the applications are huge. The moment I'm talking, you can live caption it because right now even in conferences, I've spoken to a couple of conferences and for people who are supporting people who can't see or things like that, content captioning is a very cool thing which is available in YouTube. And all these hands-free interfaces and things like that help a lot. So what's Mozilla's role into this? Mozilla are doing something really cool. They are building a speech recognition engine which follows the deep speech paper by Baidu. That's something that everyone does. Like if you go out there, you'll find TensorFlow implementation on it just by Googling the name. But what they are doing differently is that they made the data openly available. This is something that researchers like you and me lack. We don't have the data. Only big companies have those because they have infrastructure to collect those data. Like if I'm an independent researcher, it's very difficult for me to get the data and build a class model that can go to production. So that's where I feel Mozilla is doing really cool and I'm very proud about it. And the second most important point that I wanna talk, why I showed you all this application is that if you are able to combine all of this together, that's when actually you start to think about true AI. AI can solve problems, interesting things like complex games. It can see and hear like humans. It can write like humans. Are we there yet? Maybe, I don't know if some interesting companies working on these kind of problems in their research lab, but it is totally possible. We should start thinking about that. And I don't know, we have all the algorithms available with this. Maybe this will become a reality very soon. So what's like to build ML models because I just saw two of you raised your hands for the rest of the group. Let's look into some standard definitions by which we can start building machine learning models. The first part is about problem definition. So in a chat-broad problem, you basically want to find that what is the user asking and how do I serve them? So that's a good problem description for you. So it all starts with basically data collection where you have the data source lying across a different server, some different sources, like if you're mining from the web and things like that. It's just spread across everywhere. So you want to first collect that and make sure you put it in Hadoop or those kind of data warehouse systems. Post which, you do some EDA. EDA is called explorative data analysis where you run techniques like factor analysis and things of that sort. Basically gives you more understanding what what data is look like. Where is that any numbers that are missing and you do outlier treatment and make sure your data is really cool. And then the next part is where you create a model which is nothing but a mapping that understands your data to the problem that you're trying to solve. It could be classification type of problems. It could be regression type of problems. And then once you have that, you want to now deploy the model. You want to make money out of the model, right? So how do you do that? You probably are going to have a platform which sells these model as services. Restful API. So developers like you and me who are software engineers can just send the data to that particular REST API and they will give you some good results back. This is how it's been done right now. So I wanted to basically talk about an artificial neural network that's like a very simple thing. So first, this is a learning algorithm. Why was this even discovered or invented? Thing was like when you have your data very simple, right? Spread across a line or something or that. So it's very easy to build a manifold. A manifold is nothing but the line that you see in that graph. But when things become complex, when data becomes complex, like when you have speech, audio, and these kind of complex data format is very difficult to create that manifold. That's when you start building a learning algorithms like neural network. So how does a neural network look like? It's pretty simple. It's again a competition that we are doing. We take in a lot of features. We have some weights. That weights are what we're trying to learn. And a combination of all these neurons basically make your whole neural network. And to understand a bit of terminology here, the first layer is the input layer. The last one is the output layer. The output layer basically gives you the number of classes that you want if you're solving a classification problem. In the output layer, you basically say, if there are only one class, you just need one neuron as the output. If there are more than three, you'll have equal, that may number of neurons as the output layer. And going ahead, we want to know how good is our machine learning model or our neural network model. So that's where cost function comes into place. A cost function here is basically an cross-entropy loss. I'm not going to go into the details of that. But think that you need to understand here is basically, I need to understand how good is my machine learning model. Cost function basically helps you to do that. And the next step is the back propagation step. So back propagation basically tells me that how do I make sure to learn those weights? I need to learn the best weights to solve that particular problem, right? So that's when I have algorithms like stochastic gradient descent and stuff like that coming into place. So that's pretty much about the AI part that I want to talk about. Now let's look into how to build it. So rush system programming language, right? And what I'm going to say here is it's very, very easy to learn. So if you have heard about this company called Syrium, it's a France-based startup who have done something really cool. So they embedded their voice assistant model inside Raspberry Pi's. So it basically helps you to be really, really safe because you don't want the data to go to cloud servers and stuff like that. So Snips has basically done a lot of work over there using Rust. So they basically feel performance, portability and safety is something that Rust offers you out of the box and they are very happy about that decision. There's another app called Wire which is basically a business platform. They wrote their entire cryptographic algorithms in Rust and they got like 141 times performance in their cryptographic part. And this is very, very easy to do because Rust offers you a lot of foreign function interface that allows you to do that. If you can see the GIF over there, it's basically showing how fast the app is loading. Performance gain. If you have heard about Firefox 57 or also known as Firefox Quantum, they have done something really, really cool. So they wrote major part of their code in Rust and got again a lot of performance boosts which has increased their market share. So this is something that the community is really, really proud about, Rust. For the last three years have been voted as the most loved programming language. This is really cool for a language that just got raised in 2015. So the whole community is really, really proud about that particular part. There are a lot of these amazing companies that are using Rust at various places. I highly recommend each one of you to go and check out this page called Friends of Rust. And there's a talk by Ashley Williams who happens to be one of the Rust core members who talks about how can you convince your company to start adopting Rust. And then she talks about a lot of, just apart from being a Rust talk, it takes the talks in general about what are the different things that you need to consider when you're adopting a new language. So I highly recommend that. So why Rust? So these are my reasons. I basically come from high level languages. So most of the data centers around here use Python or other languages which are very, very easy to use. So you have a function, you have a library, you've given some parameters and things happen to you. Rust is something similar. We love that, right? We are spoiled by high level literators and things like that. Rust kind of gives that, but it gives you the same time, more control and more safety. So if you ask me to define Rust, I say that Rust gives you both part of the spectrum. It gives you safety like C++ at the same time. It is super, super productive. You know, there's these things that we really like about high level languages. The community is really great. The tool ecosystem, if you ever use cargo, you will really love it. So there are two things that you need to know about Rust. That is the concept of ownership and borrowing, which I'm gonna talk really soon about. So this is a small snippet of a JavaScript code which basically has a class circle which takes a radius and computes the area. So what basically happens in most of the high level languages, everything goes to the heap memory, which is nothing but a place where I can drop in all my values. So here I'm basically creating some heap memory and then after some time, there's some software called garbage collector which goes back and deletes everything over that. So the problem with this is that it adds in some runtime delay. Your things are gonna be a bit slower due to this. Even for referencing in high level languages is pretty simple. You have some instance, you have some variables, you just have to pass it. Things just work for you. We have been doing sorts of this sort. So let's look into how to implement the same thing in Rust. So I have some value. I'm giving it to a couple of new functions. This won't compile. So it just says that, hey, what you've already used, vehicle. You can't use this thing again. Like when I saw this for the first time, I was like, what's happening here? I just tried to reference it. It should work fine. So that's where the concept of ownership comes into place. And this is the concept that basically gives you that safety that I was talking about. So Rust basically says that the whole variable that you're trying to use is owned by a scope. The moment you transfer it to some other scope or some other function, and it does not explicitly return it back, it's gonna clear it off. So what does this give me? It does not have a garbage collector anymore, right? So this is what a garbage collector does. And when you work with scopes, you're basically eliminating the garbage collectors from the picture. So then how do you start staring variables? And how do you do that? So that's the concept of borrowing. You just basically lend it. So you reference values by having this Amazon symbol which basically references values. So what's happening under the hood is that you're just sharing the location of the variable in your heap or your stack memory. So there are two type of borrows. You could do immutable borrow and mutable borrow. If it's an immutable borrow, you can just reference the value, you can't change it. If you're digging a mutable borrow, you can go to the location and change values. But it comes with the, what do you say? A point that, you know, if you're doing immutable borrow, you can have any number of threads or any number of functions accessing them. But if you have immutable borrow, only one instance can access it, right? This gives, all this basically gives you a more safety and more control. So these are a couple of rules that I just talked about now. All variables are immutables. You can have only one mutable reference at a time and you can have as many immutable references. So what's like to build an artificial neural network using Rust? So I kind of used this package called juggernaut, but why I basically chose that is because it has a really, really cool tool. If you can look back at the screen, the background is, it should work fine. But this, you can go to this link called juggernaut.rs-demo, where you have a TensorFlow board like thing where you can give in some parameters and train stuff on the web. All of this has been written using VASM, it's called WebAssembly. So if you write Rust code, you can package things to the web really, really easy, which again is a really cool thing about Rust, but I just don't have time to talk about it. Catch me later, I can just spend a whole day explaining about it. So the first thing that we need to do is, you know, prepare a dataset. This is a very sample code that I'm just using. Things might change, you need to do the pre-processing depending on what kind of application that you're building. The second step is to, you know, create constructors for the algorithm and the type of network that you're building. The third one is where you start initializing and start giving away different parameters for your model and the last part is where you test it, how good it is. So the point here that I'm trying to convey is that if you look into the code really, really carefully, it looks really like Python. Like, you know, I get that feel of high-level languages. I really, really like because for me, C++ is a bit difficult. Like, you know, I've been coding on Python my whole life and then when I want to really adopt system programming, Rust really helped me and, you know, kind of helped me to build my machine learning models really, really fast. So what are the different value additions? So let's look into a simple code of doing dot product. I have two vectors and then I'm, they have a reference to, I am iterating to each one of them and finding the dot product. It's pretty simple, right? If you look into the diagram below, multiply these two of them and keep adding it. I want to paralyze it, you know, make sure things become faster and I want to do it safe because when you do things like parallelization, that's when things go wrong, right? Because you don't know what's happening under the hood and concurrency models are a bit difficult for me as well. Like, as a data scientist, I'm not exposed to those kind of low-level concurrency paradigms. So what I did was, I just changed one small thing. I just made from ITER to Paraiter and I use this package called Rion. And what it basically offers me out of the box is that, it gives me complete memory safety and super fast. One of the world's fastest data parallelism libraries out there. And it looks at the hardware and says how many cores are available and automatically chooses the number of threads to you know, start and do your computations. For especially people like us, like you know, when we do a lot of computation because you know, AI as such, you call these models and all these formulas and in your hardware are going to do a lot of computation. So things like this can really, really boost our overall performance. Another interesting thing that I noted, all those favorite packages that we use, like NumP, TensorFlow, if you actually go down a look under the hood, they have a lot of system programming that's been done over there. And this Keras again, Keras is something and I'm sure like a lot of people must have used, which is like written completely in Python. One reason why I really like Keras is that it's super easy to use. And I truly believe that you know, people like us from the AI community can go and learn Rust and build two packages like Keras in Rust which gives you like super, super high performance. I'm into that, I see a lot of people into that. And because as a scientist, as AI researchers, knowing system programming will really, really help us make our toolkits, make ourselves really better in building these models. So when should we use Rust? At right now, these are my reasons. If you see some computation part in your code and you want to shift it from Python, Rust is a good usage, like you want to run some optimization problems, which are very easy to implement, you should definitely go ahead and try Rust. Hardware, accessing hardware, you can access these kernel APIs very easily. The standard library of Rust allows you to do that. So variety applications and people working on GPUs, you could do that. Implementing concurrency paradigms, it really helps. So what does Rust has to offer you? Rust is a state-of-art programming language which gives you high-level iterators. If you are kind of comfortable with Python, Rust should be kind of easy to learn. It has a strong functional programming influence. And the biggest reason why I adopted Rust was that, you know, basically to improve my toolkit, I kind of felt really productive and more powerful when I went back to build my AI models because I knew that Rust gives me that control and the safety aspect that I always wanted. So thank you so much. I know this is the last talk. Thank you for sticking around and you can reach out to me at the red divignature, I can also write in Twitter and write to me at divignature.gmail.com. All my links, a couple of good reading links that I've put at this URL, go ahead and check them out. Yeah, just hit me up if you want to discuss more and I'm looking forward to some good questions. Thank you so much. Questions here? Yeah, so there's something called the Rust Book. If you haven't explored system programming before or have felt system programming difficult, I will highly recommend that book. It's because it covers everything in so detail and it's very, very easily written. So the Rust Book, just go and search it. Yeah, I'm not promoting my book even I also have written a book on Rust. So I have authored a book called Rust Book, but yeah, if you want it for free, the Rust Book is the name. The Rust Book is the name. It's very easy and it's written, it's maintained by the community itself. So you should definitely check it out. Yeah, if you had a lot of money, you could buy my book as well. And what's the easiest way to get started in terms of picking up a package for doing data science and machine learning? So right now, if you want to go back to your office and start implementing Rust and build machine learning models, I won't recommend that because it's still in this testing phase, a lot of communities still coming up with these packages. But as I mentioned before, if you see some part of your code that is taking a lot of time, you want to do some parallelization or you want to move, like how the wire app moved their entire cryptography algorithms to Rust. So that's like huge performance difference. So I highly recommend to do that for product companies. That's like a bless. But yeah, but if you want to do like CNNs and RCNs and stuff like that, Rust is not there yet, but there's a TensorFlow binding for using that. I'm not sure how good it is because I haven't used it before. But yeah, things are really, really looking really good to me and there's a lot of potential with Rushlang and the kind of AI products that we are building. Okay. Yeah, I don't want to get into the discussion, but it depends on what you're building at the end of the day. Both are great languages. I don't like to compare between languages. This is something that I really don't like to do because of the fact that there's something to learn from each one of them. Rust is easier for me because I'm from that, I'm from Mozilla community, so I caught a lot of references and stuff. And it really was a really good experience learning Rust for me. It was very fast at the same time. There's a lot of new things to learn as a data scientist. So you're saying that in your life? No, I'm not saying that. What I'm starting to say is that I've been to explore a lot, so I'm not the right person to answer it. Second point, I wouldn't compare between languages because there's definitely something to be offered by both of the languages. So yeah, but I recommend Rust in case you want to get down. At the same time, you don't want to do a lot of system programming, you don't want to get into a lot of code, use high-level iterators and stuff like that. Yeah, Rust really helps. Yeah. Thank you so much. Thank you so much for having me. Thank you, everyone.