Placeholder Image

Subtitles section Play video

  • what is going on?

  • Everybody, welcome to the second part of our machine learning with Hallie three tutorial in this video, we're gonna be building on the last one.

  • So in the last video, we, um we basically were checking t see if we could do this like math of relative positions to get the surrounding coordinates of any given ship.

  • We definitely confirmed that we could, including getting like the rolling over of the edge of the map and so on.

  • So we are confident that we can do what we want to do.

  • So now what we want to do is work on what does the what is the individual ship?

  • See, so to speak.

  • And what is the input layer to our neural network?

  • In this case, it was specifically a convolution.

  • All neural network.

  • So coming on down here to this, like, block of code that we took from the testing grounds that we built, we just kind of needed slightly modify this, but not not too much.

  • Most of what is here actually gets to remain.

  • We're gonna be adding quite a bit, though, so for size three is probably too small.

  • We just did that for testing purposes, I would go with a 15 or maybe even a 16.

  • If we go with a 15 that would give us a 31 by a 31.

  • So it's always gonna be this number times two plus one, and that will give you the grid size.

  • I'm gonna go with 16.

  • Purely.

  • Because if we want to use things like Mobile Net and Inception and some of these other models, the minimum size is 32 by 32.

  • So we could re size or we could pad or whatever.

  • Or we could just build data that has the proper size right out of the freaking gate and we'll be all set.

  • So I'm gonna do so next eso size 16.

  • That gives us, at the end of the day a 33 by 33 grid that every ship sees.

  • So on the smallest map, it will see the entire map on the largest map 30 33 by 33.

  • Grid is huge.

  • Should the ship exceed those boundaries?

  • For whatever reason, it's probably already lost any ways.

  • But okay, anyway, uh, cool.

  • So 16 by 16 For now, surroundings is currently empty and later we were gonna populate with coordinates.

  • But we really don't need to do that.

  • That was just for quick testing purposes.

  • Now we want to do is populated with meaningful values.

  • So what I propose is that surroundings contains It's a list of lists where each list is your pixel value, so to speak.

  • And we should have the following.

  • I think my I've lost my That's unfortunate.

  • My caps lock light on my keyboard no longer works.

  • That sucks.

  • Oh, what a bummer.

  • I don't know if I could go on in this tutorial.

  • Ah, that's really depressing.

  • Oh, man.

  • My number, like all those lights aren't working anymore.

  • Darn it.

  • Okay, show must go on.

  • I guess, uh, I'm really dead inside now.

  • Okay?

  • Anyways, eso So the first value will be how light amount, Um, Then ship and then drop off.

  • So probably will be a shipyard, but it could be, um it could be a just a simple drop off location.

  • I doubt we will make it that for we will probably only have, uh, shipyards rather than adding more drop offs and stuff.

  • I don't think we'll get big enough.

  • T need drop offs.

  • But, hey, that would be really cool.

  • And it'd be great to be prepared.

  • Should we be so lucky.

  • Okay, so, um so that's what we want, Purcell.

  • So for each pixel, let's say in this image that we're going to draw the first value.

  • So So it's we will be able to depict this as if it's our g B.

  • So we could show this in, like, open CV or something just to test.

  • But anyway, that should be all the data we need.

  • The only thing we're kind of missing here is what turn number are we on?

  • So we have really At this stage, we're not in putting to the neural network.

  • Where in the game are we?

  • So if you're like, really early in the game, you could travel pretty good distance.

  • That's fine, as long as you and the other thing we don't know is like, how much?

  • How light do we currently possess right now?

  • So in the early game, or like kind of early mid ish game, it's okay to travel long distances, but towards the end of the game, if you travel out too far and you have time to come back and deposit the end of the game.

  • That's no good.

  • So So we have no concept of where we are in the game or how much how late we actually have.

  • Um, so that's kind of unfortunate that our model won't have that data later on.

  • Maybe we could also pass turn number or even a ratio of, like, turn number out of how many turns we know there will be.

  • So you know exactly how many turns there will be by the size of the map.

  • So you could maybe, rather than three channel continent, you could have a four or five, so we could have turned number and Hal i TTE And then maybe, you know, make the max How light?

  • I don't know.

  • 70,000 or 80,000.

  • Something like that is a pretty high threshold.

  • So it would still be between zero and one, which you want for scaling purposes.

  • Anyway, for now, we'll stick with the three channel, But there's every room, toe, ADM.

  • Or of things for sure.

  • Okay, So to know, certain things like ship and drop off we want to know is that our ship, or is an enemy ship is it our drop off location or an enemy drop off location.

  • I think these things matter.

  • So before we generate over ships, we do wanna have, um we want to know where are we want to know our ships.

  • And we want to know, um, we would like to know our drop off locations, so at least our drop drop off.

  • We'll call this drop off.

  • Um, come, um, I'm trying to decide how I want to do this drop because, like the drop off ourselves, we really could just go me dot Get?

  • I think it's me dot Get drop offs like drop offs equals me dot get drop offs.

  • But I don't recall if Mita get drop offs.

  • Contains also me dot shipyard.

  • I don't I don't remember.

  • And this I don't know if this is a list, so let's make sure that's a list and then plus, um ah, me, that shipyard, we'll just do this.

  • So this should just be drop off objects in shipyard objects list be dot get drop offs.

  • In fact, let's do so.

  • How about Mmm mmm.

  • Decide how I really want to do this.

  • Ah, And then for now, let's just say ships equals, Um, no, we definitely need.

  • We want to know what the position.

  • So let's do, um, d dot position for D in.

  • Okay, uh, because we want to know, Because we're gonna be on Lee looking at the cell, so we definitely need to do it this way.

  • Uh, drop off.

  • So it's called this drop off positions, and then we'll call this ship opposite positions and then, yeah, we'll just do what we had done before.

  • I can't remember if this was in our text based version or not.

  • If we had done up to this point, uh, ship positions and drop off positions, but this definitely we need.

  • So now it'll be Estai.

  • Position for s in list me dot get underscores ships.

  • Okay, so now we got the drop off positions in ship positions.

  • This way, when we go to check that cell on the helo on the game map, if it has a ship and we don't have those coordinates in our ship positions, we know that's an enemy ship.

  • If we D'oh!

  • Hey, that's our chip.

  • Great.

  • Cool.

  • Same thing.

  • We're drop off, we can find out.

  • Is it our drop off Or is this an enemy drop off just by checking to see if we have that position in those lists.

  • Okay, so now, So this is a row.

  • We are definitely going to keep that as a row.

  • So now what we're gonna do is for X and then for her.

  • For why?

  • Rather than for X what we're gonna say I just want to make some space so I can see what the heck I'm doing here.

  • And then we'll zoom in.

  • Hopefully Kinkle.

  • So first of us, a current cell equals game map, and then we want the game map at ship dot position.

  • So shipped a position that ship, as in this ship up here that were iterating through shipped up position, plus ah, position, object of x and y.

  • So this is just that relative coordinate relative to our current ship.

  • So that's that sell that we're currently interested in.

  • So current cell may be of interest would be a better Ah, better name, then what we're gonna say if current underscore cell don position in drop off positions, um or let's see if current if current position in, because in theory, we could have I kind of have to do it because you could have an enemy ship on your drop off.

  • That's totally possible.

  • So and actually, I don't know the answer.

  • So if two ships collide the highlight scenes, But if an enemy ship is on your drop off location and you go to the drop off location, I don't know what happens to your how light like, will you deposit it or does it sink to the bottom of the ocean?

  • I don't know the answer to that.

  • Anyway, someone comment below.

  • If you know the answer, what happens in that scenario anyway?

  • If current in drop off positions, um, if current, let's say drop, um drop friend foe equals.

  • So if that position is in our drop off will say that's a one else drop friend Foe equals negative one.

  • So if we happen to find a drop off and it's not that we'll check these numbers, hopefully this will make sense later.

  • This is probably the worst logic ever.

  • If current cell dot position in ship, what is it?

  • Ship?

  • Is that what we call that?

  • Ship positions?

  • Ship positions?

  • Um, ship, friend, ship, friend, Foe equals one.

  • Um, else ship friend.

  • Foot foe equals negative one.

  • So we can use this as a multiple.

  • So I believe we can on Lee find out, um, if a cell has a ship like it's a true or false kind of thing.

  • Um, so either it has ship where it doesn't have a ship, So we're gonna use that by, uh, weaken, because I don't think we can find out if it's our ship or their ship.

  • The only way we can know for sure is if, um if it's in our list of ships or not, I could be totally wrong.

  • Like I said, this is just me running through this problem.

  • I am sure there are many ways that we could do things better than I'm going to do them.

  • Okay, So, um, so, basically, what we're going to say is, uh we need to get a few things.

  • So, first fall, how light to know about that?

  • We're gonna say Halle equals current, so dot how light, um, underscore amount.

  • And that gives us the current amount.

  • Which the maximum you could ever have is 1000.

  • So a given cell can't have over 1000.

  • I don't believe At least naturally it can't again.

  • If two ships crash into each other there they lose all their Hallett.

  • But it doesn't sink.

  • It just stays afloat.

  • So I don't know.

  • What if two ships have 1000?

  • Hal I TTE is that make that 2000?

  • How light?

  • Where is it?

  • Max?

  • Out at 1000.

  • I really don't know because the constant Max Hallett is is 1000.

  • So I don't know again comment below, if you know the answer to that one anyway, for now, let's just assume it will always be 1000.

  • And once in a while it'll be more.

  • But basically we want to make We want everything in with neural networks especially.

  • But most machine learning algorithms want everything to scale between zero and one or negative one and positive one.

  • So in this case, Hallet amount being anywhere from 0 to 1000 we don't really want that.

  • You said we want to divide it by Constant Stott.

  • Max Hal I TTE and then I'll give us a decent on number.

  • But to stop for any gigantically long decimals will also around that to the nearest to decimal points.

  • Just so we don't get anything too absurd.

  • Um, and it was just this way we can keep our data set size relatively small, because over time, each game could It's gonna be probably quite large.

  • And we just there's no need to have a super long decimal point.

  • There were really just looking for general numbers.

  • So then, ah, ship status would be current cell dot ship again.

  • This is a true or false are, actually, um I think maybe it returns a ship object if there is, and then otherwise, it's none.

  • Um, I think that's the way it goes.

  • I'm not positive.

  • Also.

  • Yes.

  • So we're interest, so that would be a problem.

  • So we're rich already saying four, shipping me that cat ships.

  • If we come down here and redefine ship, we're gonna get in a little bit of trouble.

  • So, actually, let's say a ship.

  • So a ship equals current cell dot ship, Then the next thing was structures.

  • So current, so dot structure again, that's going to be a nun, or plausibly a actual structure.

  • I don't recall it'll be nun or a thing, though, So if hal I TTE is none.

  • If Fallon is none, um Hal, I equals zero.

  • Uh, if a ship is none, then we're gonna say ship a ship equal zero If structure is nine, structure equal zero.

  • If Halle is not, I always like to get This is usually where I you do like a double equals, but it doesn't appear that I've done anything wrong.

  • So cool.

  • So we got that now, um, if a ship in effect.

  • So in this case, Hal I TTE is is, um, if if a ship is none else else, um, a ship equals ship friend foe times.

  • Um And in this case, it's a ship object.

  • So we would say a ship don't How light amount divided by Max lips.

  • No, constance dot Max Hallett.

  • And again, we're gonna want around that Ah, shit.

  • From four times this.

  • So negative one times this or positive one times that round.

  • And we're gonna round that too.

  • Again.

  • The nearest to that should be fine.

  • And then structure in this case, um, if structure is non structure, zero else structure equals, um what was it struck structure?

  • What we say here?

  • Ship, friend or foe drop friend or foe.

  • So, whatever.

  • It'll either be negative one or positive one.

  • So, anyone we're like multiplying here is if the ship of its our ship, it's a positive one times, however much Hallett is on that ship divided by the max hat light.

  • So let's say it's 50% full.

  • It'll be, you know, uh, 0.5.

  • Okay, so, um, once we have that, we have our three numbers that we really want here.

  • So we can just say, um, you know our amounts or, uh, ally, a ship and structure.

  • And then we do rode out upend amounts and then should be one tab back.

  • Right?

  • So we have our once at after this, we have our full row.

  • So then it would be surroundings dot upend row and then, um, for ship in me dot Get ships.

  • So at some point, we want to write that in this case will only have one ship.

  • So really, we could just go one tab over yet again with open?

  • Um, I don't know, test text with the intention to upend as f f dot Ride the string version of surroundings.

  • Oh, no, that's good thing.

  • I scrolled down.

  • Um, okay, that's fine.

  • I think everything else is fine.

  • Let's save that.

  • Um, in fact, let's just do this.

  • So isn't it?

  • Is it game?

  • If game diet turn number equals?

  • I don't know.

  • Five.

  • We'll do this.

  • I think we I think it's game dot turn number.

  • Hopefully that's right.

  • And then we just come up here.

  • But a break aura surrounds surroundings.

  • Surroundings.

  • Okay, hopefully that was it.

  • So we just had a silly little error that said it wasn't defined.

  • Okay, Looks good.

  • Let's see.

  • Testa text.

  • It's open that bad boy up in choosing another app.

  • My apologies for doing this, uh, someone text.

  • Great.

  • How dare ye Also she at 00 ship should have a value, so it's gonna take too long to find it.

  • But hopefully that gets populated at some point.

  • But also we have a nun.

  • What was that structure?

  • None.

  • If structure is none.

  • Oh, we tight boat.

  • Okay, structure.

  • Way type with Hawaii's Oh, my gosh, structure.

  • How do we do that?

  • I did say I should probably just not even bother with tutorial.

  • Okay, Save that.

  • Let me run that again.

  • Let's see what we get.

  • Make sure it updates.

  • Test up toast.

  • Really?

  • No way.

  • then update.

  • This should update automatically treasures.

  • All this is gonna be so frustrating to me.

  • If, uh, really, um I really thought we had the answer.

  • At least not locally.

  • For me.

  • It will update in sublime automatically.

  • Yeah.

  • Still says none.

  • Fool, man, What else am I missing?

  • Struck?

  • Sure.

  • Structure, structure, structure.

  • A pen structure.

  • Dang it if drop friend foe one or negative one occurrence.

  • And I hate when I have stuff like this.

  • Uh, if structure is none, it just looks so clear to me.

  • Um uh, if it's none than it zero.

  • Otherwise it's dropped.

  • Friend or foe, which is defined.

  • Drop off positions because drop friend or foe, if maybe never defined.

  • Like if I do that, Um but it would say that's not defined.

  • If I went to run this, I don't think that would pass as none.

  • It would.

  • Yeah, not defined.

  • So it is defined as drop friend or foe as being one or negative one.

  • Isn't tinkering fun?

  • Everybody, Uh, if turn number, it is the C 1 28 Let's check.

  • Got updated at 1 27 which is privilege it You are killing me, son.

  • Oh!

  • 00 no, that's embarrassing.

  • Okay, so the problem is this almost positive?

  • Ah, that's gross.

  • You stupid idiot.

  • We're just depending.

  • Uh, I should just quit, huh?

  • Okay.

  • All right.

  • We are off.

  • Okay, so I was just depending to it, and I just wasn't scrolling down far enough like a big dummy.

  • Okay, So once we fix that little error, there's some people probably yelling at the screen, like Come on, man.

  • Okay, so that's good.

  • Um, fortunately, at some point, we should have the 00 which would be like, somewhere in the middle.

  • Ish, right, because I'm going.

  • We should have a ship that has some degree of Hal I TTE.

  • I'm not seeing it.

  • But later, we're gonna have more ships come out anyway, and I think we'll be fine.

  • So we will find out soon enough.

  • So Okay, so we have the data now.

  • What we want to do is so test out text.

  • What I'd like to do is fully visualize that.

  • I think so.

  • Let's create a new folder and let's call this folder gameplay.

  • Okay, then we'll close this and cool.

  • Um, so rather than at the very end doing this, What we should do is like before command.

  • Q.

  • We can just say something like this, so let's go ahead.

  • And, um, let's say N p we Are we importing numb pie in the first place?

  • No.

  • So we will import numb pie as NP scroll down to the bigger the end.

  • N p dot save what do we want to save it as well.

  • We're going to save it as, uh, game play slash, and then we're gonna go with game dot turn number dot N p Why?

  • And then don't forget to actually save something.

  • That's probably useful, isn't it?

  • Uh, surroundings surrounding surrounding, It's cool.

  • And then so this ship's always gonna move north.

  • Cool.

  • Um, um um um, I think we're good.

  • I will say that.

  • And let's test it.

  • What could go wrong?

  • Everybody all right?

  • Looks good.

  • It's slowed down, so I bet we are saving.

  • Let's check.

  • Okay.

  • I've got some some beautiful, beautiful, numb pie files in there.

  • So now what I'd like to do once this is done, is we'll just use testing grounds, I suppose, uh, and let's do, um So you would want to make sure you have open CV python.

  • So that would be pie Dash 36 Hopefully, that will give us plenty.

  • I think that's what we're using.

  • I'd even really I haven't really been paying much attention.

  • So let's see what python corresponds to your really quick should be Python.

  • Okay, Python.

  • Three points.

  • Expensive.

  • And the reason why we're not using 37 right now is because tense airflow, to my knowledge, still does not yet support 3.7 or really 3.7 dozen support test if it doesn't work on 3.7 yet.

  • Okay.

  • So, uh, I don and Pip install open C v dash Pike on.

  • Make sure we have it.

  • We didn't.

  • That would have been annoying.

  • Okay, Swings open CV just to display this and, um, business.

  • Display it in the video form.

  • So ah, what I'd like to do.

  • Let's see here.

  • Uh, e I guess we're going to testing grounds and then let us import CV two important, um, pie as np.

  • Uh, Then what we're gonna do is for and range of, and we could, like, iterated over here.

  • Figure out what the max number is.

  • I'm just gonna say Okay, it's for 25 So for 25 in the fact that would stop at it'll start at zero and stop at 4 24 So I guess you would have to say for 26 I don't know.

  • 4 20 five's fine, though.

  • And then what we're gonna say is de for data equals np dot load and we're going to load gain play slash i dot n p.

  • Why?

  • I believe it was just a turn number.

  • Yes.

  • So I loaded the data.

  • Um, let's go ahead and just make sure it's working, print and D, and then we'll just break right away.

  • Really?

  • So Oh, what a nuke.

  • Striking really gate.

  • OK, gameplay zero game play one dot n p.

  • Y does not exist.

  • It literally starts at two.

  • Okay, that makes sense.

  • Because we didn't have it.

  • We don't have a ship.

  • So in turn one, there were no ships, and we send a command cue to make a ship so we don't have anything till turn to okay, but here it is beautiful.

  • So we could display it.

  • So, um, so in theory, we could Ah, I think we could just do this even to dot m show we'll just give it is empty title, and then d let me save that.

  • And I'm gonna run this outside of sublime.

  • Sublime is not always the best way to run things.

  • Um, this might be one of them.

  • So what is it?

  • Python testing grounds.

  • I didn't see anything, did I?

  • Do we maybe have to await key or something?

  • E.

  • I don't know.

  • I think this would give us just one thing, though, right?

  • But it still cuts.

  • Let's try CBT.

  • Wait, The key?

  • I don't know.

  • Five.

  • I just want to see the darn image man CV to dot M show you see?

  • It pops up.

  • I'm trying to think of What?

  • What is it?

  • What does it take?

  • Ah ah.

  • Ugh.

  • I thought it's what?

  • I thought it would sit there for me, but it doesn't appear to be okay.

  • There it is.

  • Okay, this is really small again.

  • It's a 32 by 32 so but I can see a little bit of something there.

  • Okay, So So first thing we want to do is em show.

  • Um and we need to resize d.

  • So we're going to see the two dot re signs.

  • We're gonna re size D And then you can say I think this is like from what point?

  • Maybe I really don't know.

  • But it always is.

  • 00 and then FX Let's make it 50 times larger and f y 50 times.

  • So we're just the function of X is times 50 function of why times 50.

  • Okay, we'll save that.

  • Let me run it again.

  • Still running?

  • Apparent, apparently.

  • But what's going on?

  • Sir, please this fight the intestine grand Stop.

  • I wou okay.

  • Maybe a little large.

  • Okay, a little smaller next time, everybody.

  • And now I guess I can't break out of this.

  • We're gonna wait for that.

  • Let's do like, um I don't know, maybe a 30.

  • But you could probably start seeing the how light already.

  • Um, Python testing.

  • Okay, great.

  • So there we have it.

  • This so would be I bet this is B g r.

  • Right.

  • Because the Hallen is clearly blew that dot in the middle is probably actually the shipyard because our ship probably has no color at all, because, yes, it is a friendly ship, but it has priced zero Alex, it was just created.

  • All right, cool.

  • We're pretty where this is coming together.

  • Well, so now what we want to dio is Can I get away with the following 25 D?

  • Um, what was it for?

  • 25 saved this.

  • Sometimes this doesn't work.

  • Um, trying to think sometimes to get it to actually play video form.

  • You need a little more crazy stuff, but let's see what happens.

  • Python testing grounds, please work.

  • Whoa, it works.

  • Uh, for some reason, that stuff's flipping around, and I can't decide why that would happen.

  • Why would that happen?

  • Is it possible we're That's very curious.

  • Why are we flipping like that?

  • I will have to come back in the next video.

  • I guess I don't want to spend too much time sitting on this.

  • And I guess all, uh, we'll come back in the next video.

  • And then once I figured that out, once we have that working, really, the next thing is to just start saving the data and eso we'll play games.

  • We'll come up with some sort of reason for which ones we want to use for training data.

  • Which ones we don't.

  • And then from there we can start training a model and see how that model does.

  • I'm confident I'll figure out what the heck is going on here.

  • Why is that flipping around?

  • Figure that out once, figured that out.

  • Uh, we will be all set also.

  • Yeah, maybe I'll do some more logging or something.

  • I don't know.

  • Anyone is killing me, but I'm not gonna keep weighs in video anyway.

  • I will see you guys in the next video.

  • We'll solve this and continue taking over the world.

  • Quick.

  • Shout out to the most recent channel members.

  • Vin issues Nathaniel Aikman, Alexis Wong and Daniel.

  • We are, Thank you guys very, very much for your support.

  • You guys are awesome.

  • I will see everybody else in the next video.

  • Okay, Problem solved.

  • Um, really stupid issue.

  • Basically, it was just by chance, which a I got to write first because we were playing scented body versus center.

  • But both of them were attempting to write for that given turn number.

  • So whichever one wrote it last, that's the one that got that turn.

  • So I made a quick center, bought two and just commented out the n p dot Save bit, uh, and then if we rerun that, um, which I have here, let me make sure Cindy bought two.

  • Uh, Then run that, then come into the testing grounds.

  • Once that gets to be to some degree done, we can run testing grounds on.

  • We can see we no longer have that flippy floppy.

  • It works the way it is intended.

  • So stupid, Stupid error.

  • But it's the way it goes, I guess.

  • And actually, I was talking Thio Daniel a k A Day knows a k a problem solver, aficionado, And, um, as often happens, you start explaining your problem to somebody else, and then you realize what you've done eso anyway.

  • Funny.

  • Okay, So, uh, the last thing I want to show before we get into this the next tutorial cause I don't wanna have to show the visualization again, is if we do secrets dot choice.

  • And then, um what was the option?

  • Direction, Order?

  • I think we can save that.

  • Come over here.

  • Rerun that, And just what I want to show is this ship as it collects.

  • How light it should show up as g um, as green.

  • Rather not G s o.

  • Now let me appear.

  • Not CD m cmd python testing grounds.

  • I thought he would move randomly.

  • Why didn't he move randomly, Big dummy.

  • Oh, do we do?

  • Maybe we did.

  • Player two.

  • Yeah, we sure did.

  • Last tutorial of the day.

  • Also unbelievably along tutorial.

  • Um, my apologies, but people were asking for longer tutorials.

  • This is what the people have wanted, right?

  • Huh?

  • Okay, so that should be, uh, plenty of data.

  • So let's run this python testing grounds.

  • Okay?

  • So he wiggles around, as you can see, kind of turns green as he picks up more.

  • How light.

  • If you're running this locally, you'll probably way more likely to see it.

  • Then you could in my replay.

  • But it does happen.

  • So let the record show.

  • All right, that's all.

  • Just wanted to show what the problem was, because I don't want to really have to spend time the next video on it.

  • So that's all.

what is going on?

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it