Current location: Homepage > javascript > Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep57

Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep57

2025-07-11 11:52:20 [web3] Source: MetaScripta
time you will have ai programming pythontoinstall tensorflow and caras right sojust go ahead and uncomment this and youcan run this exclamation ma mark pinstall tensor flow P install kasasright you can go ahead and you can dothis uh if you are running it for thefirst time if you're working on collab Idon't think that there will be a needfor you to or do the same right indu youcantalk Target is a continuous variable itis a regression problem so you will haveonly one single neuron now in the in inbetween see this is this part is totallyup to us how many hidden layers you wantto have right this is upto you can have 10 hidden layers you canhave five hidden layers you can have twohidden layers you can have one hiddenlayer right this part depends up to usbut as soon as you have a look at thedata right as soon as we look have thefirst glance at the data we can say withshity how many neurons my input layerwill have how many neurons my outputlayer we'll havecorrect all rightnow moving on with this information wewill go ahead and we will see how can webuild the model using K right now let'sFOC Fus on this piece of code right nowthis one what I do is thatI me dividethis right so first what we will do isthat from Keras we will import modelsright now models is nothing but modelsis a li is a function which will containthe sub functions which are sequentialand functional within models we willhave functions uh of the type sequentialand functional in this case we will bebuilding a sequential modu so we will becalling modules. sequential later rightfrom caras we import layers right whatwhat do we mean by layers now if you seethese connections that we have frominput layer to Hidden layer from hiddenlayer number one to Hidden layer numbertwo and all right so we will have todefine the layers right so these aredense layers that we have because everyneuron of let's say hidden layer numberone will be connected to every neuron ofhidden layer number two so in order toDefine these hidden layers we also needto import a function known as layersright so we dothat uh over here what I do is that Itake the shape of my xtrain right inputshape one xtrain do shape 1 which willcome out to be 32 as my input Dimensionwhy because when I will be defining myinput layer I need to tell caras rightcaras will not automatically know thatmy data has 32 neurons I will have totell kasas that my input layer will willhave 32 neurons right so that is whywhat I'm doing is that I'm taking xtrainI'm taking the shape of the columnsright which will give me 32 and I'msaving that in a variable known as inputokay so now moving on to the next pieceof code right so let's now see till nowwe have only imported the librarieswhatever is required and we havedeclared a variable input dim whichcontains the number of neurons that myinput layer will have right now what Ineed to do is that before I move on tothe architecture definition defining thelayers and all I need to tell caras whatkind of a model I'm building right ifI'm building an artificial neuralnetwork what kind of a model will it bewill it be a sequential model or will itbe a functionalmodelsequential so I tell or I instantiate amodel object of caras right if you seethis models is coming from Keras andwithin from within this models I amimporting or I'm calling sequential sothis model object that I'm creating isof the type of sequential caras modelright so this first line what it does isthat it in instantiates a blank modelobject of the type sequentialokay once when we have defined the modelall we need to do in kasas is that weneed to keep on adding the different uhdifferent layers right now what do youthink what my first layer will be inthis particular model right now I havejust gone ahead and I have just in isinstantiated a blank Keras model objectlet's say like this now while definingthe layers if this is a sequential modelwhich will be the first layer that I'mgoing going toDefine input obviously right becausethis is a sequential model so if you seeover here the first code that I referthe the first layer that I create is Ido a model. add Right model. add willadd something and then I call a layers.dense now why why do I call layers dodswithin layers as well there aredifferent kinds of layers that we havein Kwe call densebecause this is something that I'veexplained before as well if let's say myinputlayerhad let's say my input layer had fiveneurons and my hidden layer number onehad three neurons so I'm telling kasasthat this will be a dense connectionright when I say dense every neuron willbe connected to each and every otherneuron right if you look at at this thisis nothing but this is a denseconnection that we are talkingabout so that is why I'm just tellingKaras that I want you to create createlayers but I want you to create denselayers when I say dense layers it meansthat every neuron of the Hidden layersor every neuron of input layer will beconnected to each and every neuron ofthe uh hiddenlayer is this clear to everyone if yousee this is is the dense connection thatI'm talking about and that's what I'mtelling K over here that the layer thatwe are defining is a dense layer when Isay A dense layer any layer that isgoing to come after this automaticallycaras will make connections of each andevery neuron of the previous layer witheach and every neuron of the next layerokay so if you see this is the firstlayer that I'm defining Right model. addI do a layers dods and then I tell[Music]uh kasas right that I want to have rightif you see over here this is the firsthidden layer being defined I'm sayingthat I want 16 neurons in the hiddenlayer number one the activation functionI'm saying is going to

(Editor: web3)

Recommended articles
Hot reading