Creating a Dataset and training an Artificial Neural Network with Keras

  Рет қаралды 27,689

Krish Naik

Krish Naik

Күн бұрын

Пікірлер
@generationwolves
@generationwolves 5 жыл бұрын
Thank you for the video. In addition to the issue on lines 52/53 that the others pointed out, the scaled train samples were never used to fit the model. Also, the test samples were never scaled. Just bringing it notice so people can make corrections accordingly.
@shivamsrivastava416
@shivamsrivastava416 5 жыл бұрын
line no.52 and 53 test_sample = np.array(test_sample) #It should be there in place of test_sample = np.array(train_sample) please let me know if i am wrong
@sandipansarkar9211
@sandipansarkar9211 4 жыл бұрын
superb video krish for practice for beginners.Keep it up.Thanks.
@rahuljaiswal9379
@rahuljaiswal9379 5 жыл бұрын
u r a good teacher, thanks
@The_midnight_motivator
@The_midnight_motivator 4 жыл бұрын
actually what is the use of ML in predicting this simplething u can simply use an if and else condition in python itself
@oussamaaatiq8293
@oussamaaatiq8293 4 жыл бұрын
Code: # -*- coding: utf-8 -*- """ import keras from keras.layers import Dense from keras.models import Sequential from keras.optimizers import Adam import numpy as np from random import randint from sklearn.preprocessing import MinMaxScaler #from scikit-learn import MinMaxScaler train_sample = [] train_label = [] for i in range(1000): younger_ages = randint(13,64) train_sample.append(younger_ages) train_label.append(0) older_ages = randint(65,100) train_sample.append(older_ages) train_label.append(1) train_sample = np.array(train_sample) train_label = np.array(train_label) scalar = MinMaxScaler(feature_range=(0,1)) scalar_train_sample = scalar.fit_transform(train_sample.reshape(-1,1)) model = Sequential([Dense(16,input_dim = 1, activation = 'relu'), Dense(32, activation = 'relu'), Dense(2, activation = 'softmax')]) model.compile(Adam(lr=0.001), loss = 'sparse_categorical_crossentropy', metrics= ['accuracy']) model.fit(train_sample, train_label, batch_size = 10, epochs = 10) test_sample = [] test_label = [] for i in range(1000): younger_ages = randint(13,64) test_sample.append(younger_ages) test_label.append(0) older_ages = randint(65,100) test_sample.append(older_ages) test_label.append(1) test_sample = np.array(test_sample) test_label = np.array(test_label) test_sample_output = model.predict(test_sample,batch_size=10) test_sample_output = test_sample_output.round() from sklearn.metrics import confusion_matrix predictedvalues = confusion_matrix(test_label, test_sample_output[:,1])
@ShubhangiKrishnan
@ShubhangiKrishnan Жыл бұрын
Bless you
@saichandrareddy9140
@saichandrareddy9140 5 жыл бұрын
Accuracy = 1959/2000 above there is mistake at 52, 53 Thanks for good lecture.
@pankajackson
@pankajackson 3 жыл бұрын
Such a good explanation but theres a small mistake in line 52 n 53. Parameter should be test_sample and test_label instead of using train data that u created to train ur model
@elmlt
@elmlt 6 жыл бұрын
Thanks for the video! It really helped me (I am just starting to explore the world of ML, tensorflow & Keras, and have not found many good hands on step by step examples) But I think that there is an issue in the example. In line 52 & 53 your code says: 52: test_sample =np.array(train_sample) 53: test_label = np.array(train_label) I think it should be: 52: test_sample = np.array(test_sample) 53: test_label = np.array(test_label) Due to this issue, I understand that the prediction was made with the same data that was used to train the model. Right? (maybe this is why you got such good predictions) But this still helps to learn how to create the models!!
@krishnaik06
@krishnaik06 6 жыл бұрын
Hey Ernesto I think you are right...sorry for the mistake...Actually I made this video at a go...probably u can make the changes and go ahead with the implementation
@aniketanvekar5462
@aniketanvekar5462 5 жыл бұрын
Y didn't u use scaled train sample in model.fit()?
@praneethcj6544
@praneethcj6544 4 жыл бұрын
Please make more coding videos sir where explaining main part intuitively... Thank you sir
@kevalkavle
@kevalkavle 4 жыл бұрын
Which IDE is used here?
@RAZZKIRAN
@RAZZKIRAN 3 жыл бұрын
first dense 16 nuerons, second dense layer 32 , out put layer 2, what about input nuerons, In which state we have supplied input number of nuerons?
@louerleseigneur4532
@louerleseigneur4532 3 жыл бұрын
Thanks Krish
@evonkeith
@evonkeith 5 жыл бұрын
whats the idle that you use?
@rohanshah8129
@rohanshah8129 2 жыл бұрын
SPYDER
@arunkuduva123
@arunkuduva123 4 жыл бұрын
Thanks for the video, How can we use confusion matrix to see the performance of regression kind of problem... the problem you described is classification kind of problem
@manjunathaeshwarappa3122
@manjunathaeshwarappa3122 4 жыл бұрын
In regression you have to check cost function( actual output - output obtained, square it and then sum it up) . Higher the value of cost function line is not fit. So need to use gradient decent to achieve lowest cost function.
@satyanarayanajammala5129
@satyanarayanajammala5129 5 жыл бұрын
where is the scaled data is used no where it is used
@mdazhar6804
@mdazhar6804 5 жыл бұрын
scaled data is used for training. but it must have also scaled the test data.
@asifamussawar1225
@asifamussawar1225 3 жыл бұрын
nice
@The_midnight_motivator
@The_midnight_motivator 4 жыл бұрын
actually what is the use of ML in predicting this simplething u can simply use an if and else condition in python itself
@byte_fiend
@byte_fiend 4 жыл бұрын
sir i have a doubt... if our test dataset has only 500 data then how our total data comes 2000 in confusion matrix.
@shindepratibha31
@shindepratibha31 4 жыл бұрын
By mistake, he took test_sample=np.array(train_sample).That is why the confusion matrix shows 2000 count.
@shivasss100
@shivasss100 5 жыл бұрын
Your just awesome i can Say !
@ANILKUMAR-qd8lx
@ANILKUMAR-qd8lx 6 жыл бұрын
Hello output Dense function Dense(1,activation="sogmodi") y u r used softmax please can you explain
@krishnaik06
@krishnaik06 6 жыл бұрын
Hey Anil sigmoid help you to transform your output between 0 to 1. Since this is a classifier type of problem
@sandipansarkar9211
@sandipansarkar9211 4 жыл бұрын
where s the ipython notebook.thanks
@rajusrkr5444
@rajusrkr5444 5 жыл бұрын
provide the code in link sir, so that easy to practice , no need type again
@amiryavariabdi8962
@amiryavariabdi8962 3 жыл бұрын
Dear the artificial intelligence community I am pleased to introduce DIDA dataset, which is the largest handwritten digit dataset. I will be grateful, if you could help me to introduce this dataset to the community. Thanks
Convolutional Neural Networks from Scratch | In Depth
12:56
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
The spelled-out intro to neural networks and backpropagation: building micrograd
2:25:52
LSTM Time Series Forecasting Tutorial in Python
29:53
Greg Hogg
Рет қаралды 229 М.
Deep Learning With PyTorch - Full Course
4:35:42
Patrick Loeber
Рет қаралды 788 М.
The Essential Main Ideas of Neural Networks
18:54
StatQuest with Josh Starmer
Рет қаралды 1 МЛН
Train Neural Network by loading your images |TensorFlow, CNN, Keras tutorial
18:29
When Maths Meet Coding
Рет қаралды 325 М.
Artificial neural networks (ANN) - explained super simple
26:14
Neural Network Architectures & Deep Learning
9:09
Steve Brunton
Рет қаралды 805 М.
What is Agentic AI? Important For GEN AI In 2025
22:36
Krish Naik
Рет қаралды 82 М.