Placeholder Image

字幕列表 影片播放

  • what's going on, everybody.

  • And welcome to another unconventional neural networks tutorial video.

  • In this video, we're gonna be changing gears a little bit and trying to get a neural networks to do math.

  • So even though computers are actually really good at doing math, certainly better than humans, the problem is with neural networks.

  • Neural networks are kind of bad at doing math, and the reason for this is neural networks are really good at finding nonlinear relationships, where, as you know, most basic forms, math are actually linear relationships.

  • So neural networks are historically bad at doing just that.

  • But for the most part, no networks are just bad at math, period.

  • So my thought in curiosity is, could we figure out a way to get a neural networks to be able to do math pretty decently?

  • And if so, then we could continue to to increase the complexity of that math and my ending.

  • Curiosity is how Well, if if you could ever use a neural network to do something like, say, uh, you break some forms of encryption or something like that, um, that would be a curious case.

  • So So anyways, what?

  • We're gonna start with is just really basic.

  • Can we get it to do addition?

  • So, um so let's go ahead and get into that.

  • And to start, we have to decide on a way that we're gonna do this.

  • So my forward thinking is that I want I want to eventually get to the point where we allow for a variable number of input in a variable number of output and we might wanna have maybe you know, something plus something.

  • Sure, but we also might want to have something plus something divided by something.

  • But we don't want all the inputs to be something plus something divided by something we wanna have lots of variability here.

  • Um, so in order to do that, the probably the best way of doing that would be like the sequence to sequence library.

  • And the way that I'm going to do that is we're just going to use the what we've been using for the chatbots.

  • So it's just simply sequence sequence code.

  • And rather than doing words and doing like word in beddings and stuff like that, we're gonna make it a character based model.

  • So each character has value, and then basically the way it's read by the machine is a sequence of those characters, so it could be any character.

  • In this case, it's always gonna be numbers or certain operators like Divide Plus and so on, so to get started.

  • Ah, what we're gonna do is head over to the get hub project for the chap, but, um, put a link in the descriptions.

  • I'm gonna remind me if I forget.

  • Otherwise, it's just get hub dot com and it's Daniel Kooky Ella and then Mt Dash chap pot.

  • Go ahead and clone it.

  • Or do it get clone or whatever you need to do and get it.

  • If off whatever reason, it has changed.

  • Where is I want to make sure it's on screen.

  • Ah, the last commit here.

  • The one that we're using a C 503 d to C.

  • I linked to it in the descriptor in the text based version of the tutorial.

  • So if things are not working the way that I'm explaining them or whatever, then code to this exact commit.

  • So once you have that, I'm gonna go ahead and extract it.

  • Okay?

  • Wanna bop in here and probably first thing you should do is open up a command prompt and do a pip in stall.

  • Aah!

  • Dash or I think requirements, requirements.

  • Stop.

  • Text me.

  • Just make sure that runs.

  • It sure does.

  • I'm just gonna break it.

  • Um, it make sure you have all the requirements.

  • So once you've done that, you're probably ready to go.

  • So what we're going to start with is basically, you know, this all has, like, we need data that basically looks like this.

  • It has, you know, it creates a from and then points to it, too.

  • So we'll just look at this.

  • This is chat data.

  • So lovely, uh, start to the Chata.

  • Anyway, that's the chat data.

  • And it points to this.

  • Which would be the response is, Well, there's no reason why we can't actually say in the train dot from there's no way, though.

  • No reason why we can't say five plus two and then in the train dot to we just say seven right there.

  • We could do that.

  • And then the model could just be a character level model s, so we wouldn't have to necessarily just do five plus two.

  • It could be five plus 22 so on.

  • So now what I'm gonna do is I'm gonna pop up.

  • Guess what?

  • First, we'll just delete everything in here is there's no reason for this there.

  • And then, um I don't see any reason to write all this out with you guys.

  • I just assume at this point, no one following is like still rudimentary python.

  • So I'm not gonna wished yowls time.

  • So I'm gonna call this, uh did I don't know, math.

  • Come out?

  • Yeah, we'll call it math Data pie.

  • That's fine.

  • Let me open it with sublime text.

  • So this this will be in the tax base version of the few Torrey alot again.

  • There will be a link in the description, so you can just take it from there.

  • Ah, so I'm gonna copy Paste that in what museum?

  • Out a little bit.

  • Okay.

  • So what's going on here?

  • First of all, we just specify how many samples in total do we want right now.

  • 300,000.

  • You could make this, You know, anything you want.

  • I mean, it could be three million then.

  • This is the largest plausible value we're going to deal with right now.

  • Uh, so we'll say 100,000.

  • So basically it could be up to $100 So 50,000 plus two and there might be 25,000.

  • Plus, I don't know, seven or something like that.

  • So it could be any number within here, and then we're using random to randomly pick some numbers.

  • This is how many total samples.

  • And then basically, I've just got bay this little simple function here where to generate the pair that we want String in, string out.

  • You just say, Hey, I want you to generate a random addition.

  • I want you to generate a random subtraction.

  • So then what it does is it just creates, you know, like a string that's literally just is five plus two, and then the output is also a string of seven.

  • Okay, so that's all that's happening there.

  • And then here I just testing it.

  • Um, we don't really have to test it, but, I mean, I guess we could just comment this out just so you can get an idea of what you're looking at.

  • Test pair.

  • Ah, stranger.

  • So that I get should just run with the basics.

  • Yeah.

  • So here's an example.

  • And so this is the input.

  • This is the output.

  • We could run it again.

  • You can see input output, and currently it's always add.

  • But you could also have, you know, subtract for example.

  • And there you go.

  • So then what we're gonna do is come back when you do this comment this out again.

  • So then what we're gonna do is we're gonna reiterate over the samples, and we're just going to simply, um right now, we're gonna just do addition.

  • The question is, can we just do addition?

  • If we could do addition, let's make it a little more complex.

  • Let's do all of them.

  • Let's do addition, subtraction, multiplication division.

  • Um, And then if we could do off all of those, then the next question would be Can we do more complex things?

  • Like, you know, could we get to the point where we could do something like, I don't know, 55 divided by seven, plus three, minus five, divided by this right?

  • Couldn't we get to the point where we could get an algorithm to do that kind of math?

  • That's a little more complex.

  • Uh, And then from there you could also do.

  • We could try to do things like, you know, five X plus three equals.

  • I don't know this And then get the machine to always solve for X, right, That would be even more complex oven oven or least likely more.

  • I'm not actually sure that would be more complex for the neural network to figure out.

  • But anyway, those are just some of my ideas.

  • For now, we're just gonna do simple addition.

  • Can we get this to work?

  • So, uh, the other thing I want to do, I'm actually changes to about 500 just so we can actually get him Or and in fact, E one day like 1000 500 should be good enough.

  • We'll go with five.

  • Ah.

  • Okay, so we've got math data, it's gonna run.

  • It's gonna populate all toe all these little files.

  • And the reason why we're doing all these is just so that we can, um, So it just mimics what the chap what wanted?

  • So we're just kind of hacking that chap out code, which is funny, because actually, the chap bite is actually quite a bit of just a hack of the neural machine translations.

  • We're not actually doing any translation either.

  • So we're kind of hacking on top of a hack here, but that's okay.

  • So, um, that's kind of the whole point of this Siri's.

  • So let me save this and let's go ahead and run it.

  • It will probably take a little bit t get through everything.

  • Let's just move it aside.

  • Make sure, um, I guess it wouldn't matter, but so hopefully that'll be populated, I think.

  • Probably, I don't know.

  • Three million should go pretty quick.

  • I feel like it should be done relatively quickly.

  • Okay, there it goes.

  • Cool.

  • About 18 seconds.

  • So now we've got this data in new data.

  • So the next steps that we need to do just these air just steps of working with this package is we need to go into a set up.

  • Let's go into, um, settings dot pie.

  • Ah.

  • So usages editing with idol anyway, coming back over here.

  • Um, so the vocab size, basically, we need it to be You've got zero through nine.

  • So that's 10.

  • And then we have the addition symbol, which is a plus.

  • So that should be 11 total vocab.

  • And when we set it to that, that means it will be character level, and it will get nothing else if you made it bigger.

  • Um, it would add to the vocab numbers it sees more commonly, which in this case would just kind of random.

  • Um, I don't really see any point in doing that.

  • I don't think you're going to get any benefit from that.

  • Ah.

  • Then for BP, we we don't want anything to do with that Marine as a set that defaults.

  • And then the the embedded token.

  • Isar also said that two policies air really chat.

  • Um, these are really language specific things that we really don't need to be dealing with here.

  • Then for the iPAQ lines, um, trying decide if I really want to keep this.

  • I almost think you might want to do like to eat pox at this, but I think we're actually all I'm going to do for now, I just kind of want to see in general how this works, like we might not even finish this to, like, full accuracy or anything.

  • I'm just curious if it'll work.

  • Ah, so we'll do to maybe to a pox at that, Um And then, in fact, let's not even do that.

  • Let's just do this.

  • And then it goes to the one and then have it.

  • So we got 12345 Totally pox.

  • How much data do with three million or 300,000?

  • Three million?

  • That should be good enough.

  • Uh, we can always come back later and change it.

  • Also, I made text size 500.

  • So changed that too.

  • Uh, everything else I think I'll leave.

  • Oh, wow.

  • We should change the size of the network.

  • Um, I see what I did in my notes.

  • I'm not sure I don't even know if I did change it.

  • Let's do I mean, to buy 5 12 should be fine again.

  • This is just like addition.

  • Um, I'm gonna do, like, five by 1 28 though.

  • And then I don't think I'm gonna mess with anything else.

  • So I'm gonna go and save settings, and then once we've done that, we need to run.

  • Ah, the prepared up.

  • I prepared data pie.

  • You can't run that within this sub directory, though.

  • Come back out.

  • One directory.

  • Open up.

  • Command prompt.

  • Let's type in python set up slash Prepare underscore data dupuy and we'll go ahead and create that data.

  • Basically, all it does for you is create your vocab does your embedding stuff?

  • Um, actually, I guess because we did I think it's just two different forms of embedding.

  • Um, anyways, it basically just processes all your data.

  • Mostly what we're looking for is vocab in token izing our data.

  • Um, so we'll wait for that.

  • I guess everyone's gonna have to sit through this.

  • So I might as well sit together.

  • I don't think anyone's gonna go any quicker than I'm going any more tea.

  • Okay, All done.

  • Now, once we've done that, uh, we should be good.

  • Like, we should be good to actually run the train.

  • So let's go ahead.

  • Python trained up.

  • I Of course we don't have an empty You have to grab that recursive lee.

  • Argh!

  • I'm just like I'm grabbing it on windows.

  • So?

  • So what you should have done is when you do the get clone, like get cloned dash, dash recursive, right.

  • Uh, that's what you want to D'oh!

  • Uh, let me grab that.

  • So I didn't even do that because basically, we want just the empty package giving you one second.

  • Okay, So pull up that chap pot code.

  • We're just gonna go to this empty here.

  • I'm gonna go and clone that pauses, and then I'll drag it over.

  • Okay, so I just grabbed it here.

  • I'm gonna go and extracted here.

  • So it should contain this.

  • Which the directory and then hopefully right yet right in here.

  • Summers actually kind of just got Copy that and just move it into here.

  • Are, in fact, actually, what we could do.

  • Let's just, ah, delete this directory, and then we'll just rename this directory to that.

  • Okay?

  • What, you don't have getting stalls.

  • All right?

  • By the untrained up I take two.

  • Looks good.

  • Here we go.

  • Beginning to train.

  • Train.

  • Uh Ah.

  • Okay.

  • I always get smacked by this.

  • Okay?

  • So because we're using a bidirectional neural network, we can't do what I just attempted to do.

  • Let me just go into lead everything here.

  • Um, it needs to be an even number, so let's go in to set up.

  • I saw you get tagged by that all the time.

  • I really should have learned by now, but anyway, so let's do six.

  • Okay.

  • Okay.

  • All right.

  • Take three.

  • We got it.

  • This time we can do it.

  • Come on.

  • Ah, If you're on like a smaller Jeep, you actually you know what this should fit about?

  • Ngp This stuff any pretty much anybody could follow along with it.

  • You shouldn't use very much vee ram it all training.

  • I just want to see it start stepping through the data.

  • And if it does start stepping, um, a price.

  • I kind of want to, like, pause and, like, let it go through a bunch of training, and then I'll start back, or something like that are paused.

  • The recording can really decide what I want to do there.

  • If I want to just pick up in next tutorial.

  • Ah, with with how that goes, I think I'm gonna stop it here.

  • And then we'll go in the next tutorial.

  • I'll kind of go over the results with what we had and then figure out what we want to do from there.

  • So that's what I think we're gonna do.

  • So if you have questions, comments, concerns, something going wrong for you.

  • Whatever.

  • Feel free.

  • Leave those below.

  • If you're enjoying this content, feel free to support at Python programming.

  • DiNozzo, Lash support.

what's going on, everybody.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

A2 初級

用深度學習做數學(加法)--非常規神經網絡第10頁。 (Doing Math with Deep Learning (Addition)- Unconventional Neural Networks p.10)

  • 7 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字