Placeholder Image

字幕列表 影片播放

  • what is going on?

  • Everybody.

  • And welcome to part three of our experimenting with neural networks.

  • In this tutorial, we're going to be revisiting the past with the M n'est data set.

  • And everyone's like, Oh, God, not m n'est again.

  • Well, hopefully this will be something a little different than you're used to with the eminent status it.

  • So first, I'm gonna start, uh, just create a new directory, and I'm gonna call it em n'est data and this data set well, coming to hear, create a new file.

  • Uh, and then we'll call this m Innis data Crease Shindo cool and will open in sublime.

  • And we'll get started.

  • So first of all, to use em n'est we want to do from zoom in a little bit from tensor flow dot examples dot tutorials dot am n'est import input data.

  • And they're gonna say the M NUS data set itself is equal to input on her score data dot Read underscore data sets.

  • And then where do we want to read?

  • Those two will read them to m n'est uh, base.

  • Oh, I was really em.

  • This data and then not a period.

  • It was supposed to be a so lash m this data and then we're gonna say one underscore hot equals.

  • True.

  • That way it's just returns like a vector with 10 options.

  • And the one that's true is the index.

  • That's one.

  • And then the rest are zeros.

  • Now it a rate through this.

  • All this stuff should be stuff you've seen before.

  • If you followed mine or anyone else's pretty much, um, deep learning tutorial or really just you could use the amnesty is set for a lot of stuff, actually.

  • Anyway, uh, m nus dot train dot next batch 100.

  • So you would use batches if you're a training like a neural network or something like that.

  • In this case, it doesn't really matter, but we can use next batch Thio yield ourselves the next set of training that we want to use in this case.

  • 100.

  • Um and that's it.

  • We're just going to use 100.

  • That's how we're gonna decide how many samples action in total we wanna have.

  • Conversely, you could pass, you know, like a number like that.

  • I don't They don't have that many.

  • Just for the record, I think it's like 40,000 and 10 and 10 or something like that.

  • I forget the exact numbers.

  • But anyways, we just use 100.

  • Just for the record, there's there's m nus dot train dot test and then there's a dot Validate, um, for our purposes, we can actually use train and tests because we're not gonna actually try to test anything during training anyway.

  • So, really, you just would You would probably wanna leave validate just to use as out of sample testing, But otherwise you can actually use both of these, but we don't have to.

  • It'll create a lot of data.

  • Plenty for us to work with.

  • Um, so the next thing is yet you got batch X's batch wise, and then we could say, like, the data for the input data basically would be batch exes, and then we could say it zero with, and then we could say the late the label, the label is batch wise data label batch wise.

  • So now what we could do is we can print data and print the label.

  • But of course, you know, you're probably going to really know what you're looking at also.

  • Yes.

  • So this is gonna download everything.

  • Um instructions for update.

  • It looks like there's some sort of something's going to be outdated.

  • Pretty soon with grabbing this amnesty data, just follow the deprecation.

  • Warning if you get it or the error if you get it.

  • But otherwise I'm just gonna continue along.

  • Um, so anyways, we can see that this is our our data for the image, um, or the number.

  • And then down here, we can see is his euro.

  • We can't really tell that that zero, but it's also a 28 by 28 this isn't really structured that way yet.

  • So it's just one array.

  • So it's just one long string, basically.

  • And you would need to reshape it if you wanted to see what it looks like for real.

  • Um, but we'll get there.

  • So anyways, um, that's that.

  • Now what we want to do is, Well, first of all, there's a There's a few things for us to think about here, Um, but even just with regular neural network, um, you know, there's probably a reason to have this kind of precision like we don't we don't need that.

  • So we could we could handle for that.

  • Um and we gonna handle for some other stuff too.

  • But first, let's just go ahead and visualize this That way, as we change the precision, you can see what changes that actually makes.

  • Um So first, we're gonna go ahead and import Matt plot, Matt plot lived up.

  • I plot as peel tea and let's go.

  • P L t.

  • Mm.

  • You're really making me angry.

  • Oh, like, what is this afternoon?

  • How do I like?

  • There we go.

  • Cool.

  • Important.

  • Um, pie as MP.

  • Are you kidding me?

  • Jerk, that's really annoying.

  • Anyway, I feel like if you hit Tab, then sure.

  • I want youto auto complete when I hit Tab.

  • But if I hit the enter button Mm e, I don't like it.

  • I like it.

  • Stop that now.

  • Um, the next thing is, let's go ahead and just peel tea dot ym show.

  • Well, well, we can't even show the data because the data is just one long string.

  • So actually, we want to reshape it.

  • So let's say pixels.

  • Eagles data dot reshape.

  • And then we're just gonna reshape it to be a 28 by 28.

  • Now peel, tea dot ym show pixels and then pee lt dot show.

  • And now we can kind of see what we're working with again.

  • Still kind of your typical what you would see in any, um, you know, M nus tutorial.

  • There's your eight.

  • Lovely, Beautiful.

  • We can also convert to great.

  • That should be so see, map equals gray and he get what we're looking for.

  • Now what we want to do next is there's really no reason tohave like I was saying before, any precision like, we really just want to threshold this.

  • We want everything to be a zero or a one.

  • We want our Our goal is to get rid of as much of the bloat as we can.

  • So, in a character like this character generation, character level generative model we want, we want to simplify in the sense where we have this few characters as possible, right?

  • We want to condense this data as much as we can.

  • So one way that we're gonna do that is by, um, threshold in the data.

  • So one way we could do that with with with our numb pie here is basically data right here.

  • We can use numb pied out round int So n p np dot Our in't we round batch exes, and that's going around it to the nearest integer.

  • So we'll do the same thing with batch wise, and then let's run it.

  • And what we should see is a threshold image with fruit.

  • There it is.

  • So there's a one turn up 01 All right, so it looks good.

  • Let's just do one more just so we can get the idea of a threshold.

  • Because sometimes when you threshold, it's gonna fill in holes and gaps, and it might look kind of funky.

  • Um wow.

  • Another one.

  • Come on, man.

  • Give me something else.

  • I'm sick of this one.

  • Okay, so I get to, you know, maybe there was a little hole there, but anyway, you get the idea now, the next thing is, we still have a lot of, um, wasted characters in the sense of these, Like the periods here.

  • Right, The decimal point.

  • So, what can we do there?

  • Well, we could say dot as type ends and then as type and run that again.

  • And really, rather than data we should just print.

  • Uh, Okay, So here's another good example.

  • Where probably if you didn't threshold it some of these were a little lighter, but otherwise, you know, you could still tell that to To almost actually.

  • Looks like a coiled up snake like you could be right here.

  • Here's a snakehead.

  • Right.

  • But we still can't tell that that's a to here, but, um, since you guys have already kind of scene where we're going, we could rather than print data, print the pixels, and you should be able to actually, visually see what you're looking at.

  • We'll wait for it here.

  • Okay, Seven.

  • So if I just clear out of seven and we zoom out a little bit, you should be able to tell, like, just by looking at this.

  • Yeah, that is a seven like you can tell without even rendering an image.

  • Now, um, so we've simplified this quite a bit.

  • Like that's much more condensed than it was initially, but we still have things that we could change.

  • So the next thing is, this is a generative model.

  • It takes in a string.

  • So is there any reason for us to adhere to any array structure?

  • Um, and of course, the answer is no.

  • Right.

  • So all these extra spaces here do we really need those, right?

  • Like there.

  • There's no need for that.

  • So And like I said before, with the brackets, we could get rid of them, actually, kind of think that they probably kind of helpful to the model.

  • So I kind of want to leave the brackets, But we definitely could get rid of spaces here.

  • It doesn't need to be in array, so we can convert it out of an array and then always convert it back to an array later.

  • And so anyways, in the next tutorial, what we're gonna do is we're gonna actually convert this to string form and condense it even further on and then be on our way to actually creating a much a large training set of condensed data and see what we can figure out.

  • So anyways, that is all For now, if you have questions, comments, concerns, whatever feel for they're free to leave them below.

  • If you want to support me in the content, this is my full time job.

  • You can head to python programming dot net slash support for a variety of options.

what is going on?

字幕與單字

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

B1 中級

用MNIST生成--非常規神經網絡第3頁。 (Generating with MNIST - Unconventional Neural Networks p.3)

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