This was an amazing example of clear and concise education. You are nailing these tutorials better than some 60 year old professors. And with push-ups.🤯
@@nan6849 I don't know what happens in the module, but I believe it actually is AI. But what I'm saying is, that you just don't get to know anything abiut AI. What even is a neural network? No clue because this video is explaining nothing
If you get an error at the end that is something like "ValueError: Input 0 of layer "sequential_1" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)" then replace the 1st line the segment "model.add" instead of "model.add(tf.keras.layers.Dense(256, input_shape=x_train.shape, activation='sigmoid'))" use "model.add(tf.keras.layers.Dense(256, input_shape=x_train.shape[1:], activation='sigmoid'))". Most importantly recompile all segments both from start to finish after making this change.
Thanks for sharing! Can you explain why the error was happening in the first place? Is it because the x_train shape is still including the first column and hence this solution is just slicing the data set from to start from 1 instead of 0?
Great video. As someone who as taken a full AI course in College I can say that they should really use your example as lecture 1. Show the students what they can do, and then teach them each of the components that they simply used from the tf library.
As a college professor for years, a good approach (depending on the starting points of the class) would be to give the students this video and a few other bits of material before class, get them building themselves, and then help with errors and confusion during class time.
Thanks! I liked the part where you opened the internet tab to show the parts of the neutrale net in reference to the code. When I see code I usually get flustered but that illustration helped make sense of the code. Please keep making more videos! 😀
If you got it to work could you tell me how? I couldnt get past the "model.fit(x_train, y_train, epochs=100)" Line. If you did it, please let me know how!
Perfect video! BTW for those experiencing an error at the end with the input_shape giving ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30), Just use this instead of the first line: model.add(tf.keras.layers.Dense(256, input_shape=x_train.shape[1:], activation = 'sigmoid')) Remember to run all code blocks from top to bottom again, to make sure it works perfectly fine! Do not try to just run this separate code block otherwise it will never work.
@@國勳徐 no difference, its just a colab bug nowadays that most machines cant handle for some reason. the second line basically removes all bugs and when u run it all in a row it makes sure that the last line is executed properly
Thank you for this awesome video Kahnrad. This is wonderfully explained. UPDATE: model.fit() will throw an error unless line 24: model.add(tf…Dense(256, input_shape=x_train.shape, …) is changed to: x_train.shape[1:] Then recompile top down, should be solid
Make Your First AI in 15 Minutes with Python: Follow this quick and easy guide to create a simple AI application using Python. Perfect for beginners, this tutorial will help you understand the basics of AI development and get hands-on experience in just a quarter-hour.
For people getting the ERROR at the end use this line instead model.add(tf.keras.layers.Dense(256, input_shape=x_train.shape[1:], activation='sigmoid')) on the first line when adding models
@@fufusytb i put this code on the last line and it worked, but the data doesn’t configure with the gpu for the testing of the AI machine we just created
This was great! I am a clinical psychology and am I'm helping with retention in the treatment program for at risk youth. Babe I've been looking for a way to do to do machine learning to predict which kids are at highest risk in order to throw more resources behind them. I think I've found it! Thank you! If this works the way that I hope it will then you will be impart responsible for adding to do the safety and securityOf hundreds of youth.
pretty crazy nail the kids just going into high school with AI predicted system. I'm curious about this and maybe diagnosing cars and certain model issues. Or even install a system that helps tell what's causing issues.
btw if u get an error on the fit, replace the 3 layers (3 adds) with this: model = tf.keras.models.Sequential() model.add(tf.keras.layers.Dense(256, input_shape=(30,), activation="sigmoid")) model.add(tf.keras.layers.Dense(256, activation="sigmoid")) model.add(tf.keras.layers.Dense(1, activation="sigmoid"))
Thanks for such a comprehensive and informative guide! I’m trying to make an AI that manages data from plants in my garden, and this has been such a great help.
if someone have error : ValueError: Input 0 of layer "sequential_1" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30) Then clear whole block 6 and paste : model.add(tf.keras.Input(shape=(x_train.shape[1],))) model.add(tf.keras.layers.Dense(128, activation='sigmoid')) model.add(tf.keras.layers.Dense(256, activation='sigmoid')) model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
Here is the fix for the problem you are all having with the 'model.add' line . . add this to the block above it import tensorflow as tf model = tf.keras.models.Sequential(tf.keras.layers.Dense(1))
SOLUTION TO VALUE ERROR: Just follow the vid and then in the section between model = tf.keras.models.Sequential() and model.compile, replace the code with: model.add(tf.keras.layers.Dense(256, input_shape=x_train.shape[1:], activation='sigmoid')) model.add(tf.keras.layers.Dense(1, activation='sigmoid')) in place of the previous model.add section code and then just train from the beginning. solution courtesy of outplayed_1283
I got the same error It helped to replace that section with: model.add(tf.keras.layers.Dense(256, activation='sigmoid')) model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
Hey! great video! I do keep getting an error even on your colab notebook in the line "model.fit(x_train, y_train, epochs=1000)" I get: "ValueError Traceback (most recent call last)" " ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)" Any thoughts on what might be happening?
This AI is great, and the video is perfect. For those experiencing errors in the last two blocks, here is what to do: Change the fifth block's code to this: import tensorflow as tf model = tf.keras.models.Sequential(tf.keras.layers.Dense(1)) Run the fifth block a few times, then try again- it should work
thanks a lot man this helps a lot! may i know why do we need to code as you mentioned and how does this fix the error? im still new to machine learning and trying to get to the bottom of this.
I mean, I really don't understand much about advanced coding and algorithms like this, but it was interesting following along. Just wish I could understand more of whats going on...
Follow a yt channel called Siraj Raval. Search for his videos about activation function, loss function, etc. It taught me a lot about AI / Machine Learning
Great video, very clear. Any ideas about the warning at the end of the program about incompatable shapes between the model and the input? Obviously it works, but is this something that needs fixed in a more advanced application?
Great video... everything worked until i got to the model.fit(X_train, y_train,epochs=10) line. Got a ValueError Traceback (most recent call last) in () ----> 1 model.fit(X_train, y_train,epochs=10) I checked X_train and it was 455x30 and y-train was 455x1. So dimension wise everything was good. I used X_train instead of your x_train but I was consistent so that was not an issue. I am wondering if the model.fit function has an issue. Any ideas? UPDATE:I changed the model.add(tf.keras.layers.Dense(256, input_shape=X_train.shape[1:], activation='sigmoid')) line and recompiled all code so it worked... THANKS
You saved me, I was getting pretty bitter and couldn't figure it out. Its running now but I admit as of the writing of this comment I don't 100% get the fix. Going to rebreak it and debug more. But thanks much for this. You saved my pc from a punch
I tried your update and still having the same issue. Any thoughts? "Epoch 1/10 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) in () ----> 1 model.fit(X_train, y_train, epochs=10)"
Thank you just learned programming or understood more and more the basics in c# and was looking to use ai in my job in a production company. Your video was a huge help considering I did python last I think 7 or 8 months or even longer but loved the simplicity of that kind of subject. I know it can go complexer but the basics are super easy to learn because of you! So thank you and keep up your work man! :)
Jesus Christ is God and is the only way. Hell is real whether you believe it or not. I used watch wicked anime, mastberate/porn, vape, beer, violent video games and now I don’t do that anymore; I didn’t even think changing how I am now. Hell is real whether you believe it or not. There isn’t multiple ways; catholic, muslim, etc will lead you to hell and I was a catholic before!
@@SquidBeatsYou're a bot. Whoever made you is an extremely sad human being. Attempting fear tactics to mold others to your religion goes against your religion. I'm sorry, but nobody cares. Liking your own comment is pointless. Quit attempting to force people to conform to your ideas just because you think enjoyable aspects of life are bad.
@@SquidBeats Some grandma died.and back from the dead.She described that hell/heaven is not real.Just a void and nothing. I'm in ROS(robotic) religion btw.
Great, great video. Using the Tensorflow & Keras with the scikit-learn was super cool, especially in knowing it will help doctors make important cancer diagnoses, makes it awesome. Great job!!
I got this: ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 398, 30), found shape=(None, 30) why? how to fix it?
When I run; model.fit(x_train, y_train, epochs=1000) it gave an error with last line; ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)
Wow I don't know much about Machine Learning I'm only thinking about learning it for now and I understood most of what you just taught! Awesome video make more like these!
Hey, just a tip for you as you go about learning. I see videos like these as a cool introduction to the subject that's more just like "ooh cool, look what that does". The mistake I often see people make is they just watch lots of videos like these, thinking they're learning. You're not really learning anything, you just know the pure basics of how a NN works. If you really want to get into machine learning, it's a lot of math and theory - so be prepared for that. If you have any questions feel free to ask :p
@@colinbalfour1834 i am currently learning ml, i do come up with some doubt whenever i work with some datasets , may i know your discord or any other social media you have
@@colinbalfour1834 just wanting a subsubject name, if you could go back in time right now and relearn some of these data science concepts, how would you start?? and for a more specific one, i learn by creating my own mental model of 'axioms' or rules in structure as opposed to studying rigorously, so in my benefit do you happen to know of any group of topics or problems that show the majority of general rules id see in the subject? maybe moreso for beginners
@@colinbalfour1834 hey, what do you think is the best way to learn the mathematics behind neural networks? I’ve tried to learn some math regarding linear algebra and stuff but i’m a bit lost on how to apply it directly to machine learning.
Hi @Khanrad ; can you make a video on how to mini-graph those outputs inside the IDE? So we can repeatedly visualize our output? Scrolling through the data is OK when the set it small. Ideally Colab-Jupyter would have a button to the right of the output to mini-graph upon completion. Further to that I'm aware output should be stored for CI/CD analysis later. It's a convivence request. I use Low Code in Azure-ML, I can highlight output and it will show a mini-graph. or I can export it to PowerBI. Output in my environment is saved in the dataverse and ETL with Synapse.
I use the graph thingies with this code: import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import train_test_split import tensorflow as tf def visualize_output(output): if isinstance(output, pd.DataFrame): for column in output.columns: _plot_mini_graph(output[column], column) elif isinstance(output, pd.Series): _plot_mini_graph(output, output.name) else: print("Invalid input type. Please provide a DataFrame or Series.") def _plot_mini_graph(data, column_name): plt.figure(figsize=(8, 4)) if data.nunique()
Help! I'm trying to learn how this works and completed this example. I was thinking that I could try doing a weather forecast and try to stuff whatever I can think of into the csv file - recent temperatures from various places, date, co2 readings, etc. Any hints on how I can expand the model to cover my example? Or perhaps another tutorial?
@@theadameubanks something like data collected in a week in cancer unit in some hospital, like ur cancer.csv, but diagnosis column is empty to AI fill it :) It'd be awesome, I'm studying how I can do it yet in a simple way hahah
Hi Khanrad, great video. When I try to run your code as wel as my own version i get the following error at the last step: 'ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)' What do you think could be the issue?
This video is very good and you made the whole concept very easy to grasp beside that you have a strong good voice that keep me concentrating with you through the whole video, thank you.
Fantastic videos! Very easy to follow and actionable. Will absolutely share with everybody interested in this field. One quick note, when, doing anything in the medical field you have to understand the truth labels of the data.
@@pedrom677 Go back and start over;-) Not saying that to be mean, but sometimes you spend more "cycles" looking for a (:[{ or ., that you would with a clean notebook. The code above worked for me, so have hope.
I'm not an expert so I might be wrong, but I think based on the error percentage the network adjusts its weights for each element in every layer. So the next time you put in the same numbers you'll get a diffrent result. And it repeats that many many times and the error percentage gets smaler and smaler and the smaler it is the higher the possibility it'll calculate right the next time. I didn't watched the video entirely so I hope I didn't confused you with that.
My friends, search for your life purpose, why are we here?? I advise you to watch this series 👇 as a beginning to know the purpose of your existence in this life ua-cam.com/play/PLPqH38Ki1fy3EB-8xmShVqpbQw99Do2B-.html
I was having the same issue as everyone and fixed by using this settings on the 5th block of code, when importing tensorflow --------------------------------------------------------- import tensorflow as tf model = tf.keras.models.Sequential(tf.keras.layers.Dense(1))
Wow. Thank you for this video. I’m going to put this together. How can you make the AI work with other radiographs like musculoskeletal ultrasound, MRI and the like?
depends what you mean by "aware". You'll likely need different types of sensors, then a lot of programming to analyse the data collected and create awareness. If you provide more details I might be able to help :)
Since the AI is now trained, I would have liked to see how we could use it like entering the measured data and getting a "this patient is likely to have a malignant tumor with a $percent_value propability."
Thank you man this was an amazing tutorials , but i have got this error ( ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)) , can you fix this .
The avenues for making those recognized patterns useful are diminished by illiteracy concerning the source signals and the lack of care taken in organizing the structure of the machine. Similar to drawing constellations whereby connections are made between neighboring stars, yet those same celestial bodies are projected onto a two dimensional retina. One might call what the Greeks did image recognition.
I would recommend going through at least the first year or two of a traditional CS curriculum. Learn a programming language, and get some foundational math knowledge like calc and discrete math. Work on learning algorithms and data structures, and find projects at your level. Once you can do some relatively complex projects, try some "AI" problems - something very basic. Maybe start with like a MiniMax, or a simple Genetic Algorithm. From there you'll absolutely want Linear Algebra and probably some applied statistics. Working through integral and mv calc will help with more complex problems like backpropogation/feedforward. I know that's all really vague - but if you have any more specific questions I'd be happy to answer them
I could use this exact script to build a stock trading bot using a ton of indicators for each column and 5 minute candles for the rows. If the AI could hit 97% accuracy on the stock market I could own the world in a year. lol. Solid video my guy, absolutely going dig into writing some AI code in python!
Thank you for sharing this.. helps me get started.. But I get error when I run "model.fit(x_train, y_train, epochs=1000)" Error is pasted below. Is there any clue on what could be wrong? Thanks in advance! ----------------------- Epoch 1/1000 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) in () ----> 1 model.fit(x_train, y_train, epochs=1000) 1 frames /usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs) 65 except Exception as e: # pylint: disable=broad-except 66 filtered_tb = _process_traceback_frames(e.__traceback__) ---> 67 raise e.with_traceback(filtered_tb) from None 68 finally: 69 del filtered_tb /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in autograph_handler(*args, **kwargs) 1127 except Exception as e: # pylint:disable=broad-except 1128 if hasattr(e, "ag_error_metadata"): -> 1129 raise e.ag_error_metadata.to_exception(e) 1130 else: 1131 raise ValueError: in user code: File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 878, in train_function * return step_function(self, iterator) File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 867, in step_function ** outputs = model.distribute_strategy.run(run_step, args=(data,)) File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 860, in run_step ** outputs = model.train_step(data) File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 808, in train_step y_pred = self(x, training=True) File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler raise e.with_traceback(filtered_tb) from None File "/usr/local/lib/python3.7/dist-packages/keras/engine/input_spec.py", line 263, in assert_input_compatibility raise ValueError(f'Input {input_index} of layer "{layer_name}" is ' ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)
@@theadameubanks Hey Khanrad, great videos! Love them you are so talented! How do you fill in the formula to make a prediction? Tried without any success...Thank you for your help :)
Well done !! Thanks so much. Would you be able to advise on how to perform the AI Generation on our own computer? Running code on Google's computers is not cool AT ALL. Make you dependent, strictly no privacy, resources are limited, requires to be online . . . A great tool, but super limited
Hey! Thanks a lot for this tutorial man. I was able to follow-up with most of the things described here but got stuck at Block-6 : Line 9. I would really appreciate if you could explain the problem...it's showing {name 'x_train' is not defined} and {name 'model' is not defined}.
Oh it only works if you run all the code blocks before this code block, I got the same issue, I reloaded the website and ran every single cell from the start to finish and then it started working again.
Hi, nice video! clear explanation of building an AI in Python. Sadly I'm not really good at coding in python. I'm wondering if you could help me with something. I'm a tax law student engaged in compliance activities. For this job I have to read loads of annual accounts from companies in order to submit tax returns. I'm actually looking for someone who could help me develop an AI that could get specific data out of PDF files quickly and fill it in in the right colums on a tax return to speed up the process. If you know anything or anyone who would like to do this hit me up! (we could hit a jackpot)
I have a question. How to you make it actually identify the cancer? I am just a beginner, so this might be a stupid question. Btw, thank you @Saad Humayun for the comment, it saved me.
Wow, this is amazing. This is my first ever attempt at building something. Quick question though, if I increase my neurons to 512, and my epochs to 2000, why would my accuracy go down?
It was amazing thank you .. but can creat a model using more complex data set, i mean use some feature enginering and add more layers and use earky stopping method ...etc
Thanks. A great introduction to what this platform can do. However, what this does not do it provide useful information for using the created model. This has many layers, and so it's no use asking which input features are useful. But how can an individual case be tested with the model?
This was an amazing example of clear and concise education. You are nailing these tutorials better than some 60 year old professors. And with push-ups.🤯
Literally the first module given by coursera, sure it's nice to have something to put on 2x speed but it's not what I was looking to learn
Quantum computing could threaten humanity as we know it…
ua-cam.com/video/ip3FwAYWjkw/v-deo.html
In this Video you learn NOTHING about AI and you dont even do anything in general why im giving it a thumb down.
@@ElmoSeesYou so you're saying that Tensorflow he's using with neural network prediction isn't AI at all?
@@nan6849 I don't know what happens in the module, but I believe it actually is AI. But what I'm saying is, that you just don't get to know anything abiut AI. What even is a neural network? No clue because this video is explaining nothing
If you get an error at the end that is something like "ValueError: Input 0 of layer "sequential_1" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)" then replace the 1st line the segment "model.add" instead of "model.add(tf.keras.layers.Dense(256, input_shape=x_train.shape, activation='sigmoid'))" use "model.add(tf.keras.layers.Dense(256, input_shape=x_train.shape[1:], activation='sigmoid'))". Most importantly recompile all segments both from start to finish after making this change.
omg recompiling i did not do that thank you!
Thanks man, it worked!!
@@thehulk6866 your welcome 😀
Thanks for sharing! Can you explain why the error was happening in the first place? Is it because the x_train shape is still including the first column and hence this solution is just slicing the data set from to start from 1 instead of 0?
Hey gem! THANKS FOR SHARING 💎❤️
Great video. As someone who as taken a full AI course in College I can say that they should really use your example as lecture 1. Show the students what they can do, and then teach them each of the components that they simply used from the tf library.
As a college professor for years, a good approach (depending on the starting points of the class) would be to give the students this video and a few other bits of material before class, get them building themselves, and then help with errors and confusion during class time.
@@InconvenientxWhat would you say those other bits of material are?
College Protest Preparing
Yo i think OpenAI copied your tutorial
no
fr?
@@theadameubanksno dawg its a joke
@@CoolDude-mq8dh he knows its a joke he just played along with it
This video may become part of their training dataset, so eventually maybe yes.
Thanks! I liked the part where you opened the internet tab to show the parts of the neutrale net in reference to the code. When I see code I usually get flustered but that illustration helped make sense of the code. Please keep making more videos! 😀
If you got it to work could you tell me how? I couldnt get past the "model.fit(x_train, y_train, epochs=100)" Line. If you did it, please let me know how!
@@nik7069 read @Saad Humayun comment, it saved me
@@didyouknow19256 ab iska comment kaha khojne jaun 🙄
@@didyouknow19256 where is it
It's not visible
Could u pls tell me about it
Perfect video! BTW for those experiencing an error at the end with the input_shape giving ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30),
Just use this instead of the first line:
model.add(tf.keras.layers.Dense(256, input_shape=x_train.shape[1:], activation = 'sigmoid'))
Remember to run all code blocks from top to bottom again, to make sure it works perfectly fine! Do not try to just run this separate code block otherwise it will never work.
Thank you! I was stuck at the same spot.
What are differences between them?
@@國勳徐 no difference, its just a colab bug nowadays that most machines cant handle for some reason. the second line basically removes all bugs and when u run it all in a row it makes sure that the last line is executed properly
TYSM this is the comment I was searching for
You rock. I've been scouring the internet for this and it was right there x)
Thank you for this awesome video Kahnrad. This is wonderfully explained.
UPDATE: model.fit() will throw an error unless line 24:
model.add(tf…Dense(256, input_shape=x_train.shape, …)
is changed to: x_train.shape[1:]
Then recompile top down, should be solid
Ty! I was stuck on exactly this
Thank you!!
Thanks!
It would have been a frustrating way to spend time if I didn't see this...
the accuracy is 0.0000e+00 tho. Idk how to fix that
Make Your First AI in 15 Minutes with Python: Follow this quick and easy guide to create a simple AI application using Python. Perfect for beginners, this tutorial will help you understand the basics of AI development and get hands-on experience in just a quarter-hour.
For people getting the ERROR at the end use this line instead
model.add(tf.keras.layers.Dense(256, input_shape=x_train.shape[1:], activation='sigmoid'))
on the first line when adding models
i m still getting that error. can you help??
@@pratikbehera4770 did u know how to fix it? I’m also still getting it
@@fufusytb nah...tried some of the more comments still getting the same error
@@fufusytb i put this code on the last line and it worked, but the data doesn’t configure with the gpu for the testing of the AI machine we just created
For me it worked with:
model.add(tf.keras.layers.Dense(256, input_shape=(x_train.shape[1],), activation='sigmoid'))
Watch this video if you want to run your model on a set of data: ua-cam.com/video/A4K6D_gx2Iw/v-deo.html
This was great! I am a clinical psychology and am I'm helping with retention in the treatment program for at risk youth. Babe I've been looking for a way to do to do machine learning to predict which kids are at highest risk in order to throw more resources behind them. I think I've found it! Thank you! If this works the way that I hope it will then you will be impart responsible for adding to do the safety and securityOf hundreds of youth.
good luck !
Well? How'd it go? You've got to tell us 😅😂☺️
I would love to hear an update on this.
pretty crazy nail the kids just going into high school with AI predicted system.
I'm curious about this and maybe diagnosing cars and certain model issues. Or even install a system that helps tell what's causing issues.
Can you please upload more for AI tutorials? Great video btw
Yes same here
Same
Yes , more A.I. tutorials please 🥺
I am getting the below error
Epoch 1/1000
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in
----> 1 model.fit(x_train, y_train, epochs=1000)
btw if u get an error on the fit, replace the 3 layers (3 adds) with this:
model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Dense(256, input_shape=(30,), activation="sigmoid"))
model.add(tf.keras.layers.Dense(256, activation="sigmoid"))
model.add(tf.keras.layers.Dense(1, activation="sigmoid"))
Thanks it works now
Thanks for such a comprehensive and informative guide! I’m trying to make an AI that manages data from plants in my garden, and this has been such a great help.
if someone have error :
ValueError: Input 0 of layer "sequential_1" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)
Then clear whole block 6 and paste :
model.add(tf.keras.Input(shape=(x_train.shape[1],)))
model.add(tf.keras.layers.Dense(128, activation='sigmoid'))
model.add(tf.keras.layers.Dense(256, activation='sigmoid'))
model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
thanks
Here is the fix for the problem you are all having with the 'model.add' line . . add this to the block above it
import tensorflow as tf
model = tf.keras.models.Sequential(tf.keras.layers.Dense(1))
thank you sm
thank you buddy
Thank you
You are awesome, Finally, it's working .. Yay ! Thank You so much !
You are AWESOME! You are a prodigy at coding. Please continue what you do!
SOLUTION TO VALUE ERROR:
Just follow the vid and then in the section between model = tf.keras.models.Sequential() and model.compile, replace the code with:
model.add(tf.keras.layers.Dense(256, input_shape=x_train.shape[1:], activation='sigmoid'))
model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
in place of the previous model.add section code and then just train from the beginning.
solution courtesy of outplayed_1283
I got the same error
It helped to replace that section with:
model.add(tf.keras.layers.Dense(256, activation='sigmoid'))
model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
Not sure how or why I came across this video, but muhfkr you know what you're doing on a comp!!! Good job!!!
Hey! great video! I do keep getting an error even on your colab notebook in the line
"model.fit(x_train, y_train, epochs=1000)"
I get:
"ValueError Traceback (most recent call last)"
" ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)"
Any thoughts on what might be happening?
it maybe a stupid question but how do I then input values for the AI to look at?
This AI is great, and the video is perfect. For those experiencing errors in the last two blocks, here is what to do: Change the fifth block's code to this:
import tensorflow as tf
model = tf.keras.models.Sequential(tf.keras.layers.Dense(1))
Run the fifth block a few times, then try again- it should work
Thanks for this, this is the only code that worked with mine so you're a lifesaver
Thank you, that is very helpful indeed!
You are awesome!! it worked!!
thanks a lot man this helps a lot! may i know why do we need to code as you mentioned and how does this fix the error? im still new to machine learning and trying to get to the bottom of this.
Thanks, this made it work. Probably something has changed in the syntax in last 2 years.
I mean, I really don't understand much about advanced coding and algorithms like this, but it was interesting following along. Just wish I could understand more of whats going on...
Follow a yt channel called Siraj Raval. Search for his videos about activation function, loss function, etc. It taught me a lot about
AI / Machine Learning
Good stuff young man. Very easy to follow and straight to the point. Appreciate you
Breath of fresh air. Crystal clear and to the point. Thank you so much!
GOOD Job Man! Love how humble you are!! Good Job!!!!!
Bro said, "Imma set this up, knock out some pushups AND make some money showing you a commercial." That's hella inspirational.
Great video, very clear. Any ideas about the warning at the end of the program about incompatable shapes between the model and the input? Obviously it works, but is this something that needs fixed in a more advanced application?
absolute legend, im in uni and you explained it better than my lecturers aha
Great video... everything worked until i got to the model.fit(X_train, y_train,epochs=10) line.
Got a ValueError Traceback (most recent call last)
in ()
----> 1 model.fit(X_train, y_train,epochs=10)
I checked X_train and it was 455x30 and y-train was 455x1. So dimension wise everything was good. I used X_train instead of your x_train but I was consistent so that was not an issue. I am wondering if the model.fit function has an issue. Any ideas?
UPDATE:I changed the model.add(tf.keras.layers.Dense(256, input_shape=X_train.shape[1:], activation='sigmoid')) line and recompiled all code so it worked... THANKS
You saved me, I was getting pretty bitter and couldn't figure it out. Its running now but I admit as of the writing of this comment I don't 100% get the fix. Going to rebreak it and debug more. But thanks much for this. You saved my pc from a punch
Thx!
I tried your update and still having the same issue. Any thoughts?
"Epoch 1/10
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in ()
----> 1 model.fit(X_train, y_train, epochs=10)"
@@eCabreravideo did u fix it? im stuck
This is such a amazing tutorial im dumb with learning Coding i just started but i was able to understand this completely im definitely sticking around
Thanks for your comment! What types of tutorials would you like me to do next?
ur a legend u deserve all the love
Well the simp in your name isn't wrong lol
@@echotube3111 i simp for this guy
Thank you just learned programming or understood more and more the basics in c# and was looking to use ai in my job in a production company. Your video was a huge help considering I did python last I think 7 or 8 months or even longer but loved the simplicity of that kind of subject. I know it can go complexer but the basics are super easy to learn because of you! So thank you and keep up your work man! :)
Thank you!
this dude made this tutorial and did push ups lmao but still THANK YOU FOR TEACHING
Jesus Christ is God and is the only way. Hell is real whether you believe it or not. I used watch wicked anime, mastberate/porn, vape, beer, violent video games and now I don’t do that anymore; I didn’t even think changing how I am now. Hell is real whether you believe it or not. There isn’t multiple ways; catholic, muslim, etc will lead you to hell and I was a catholic before!
@@SquidBeatsYou're a bot. Whoever made you is an extremely sad human being. Attempting fear tactics to mold others to your religion goes against your religion. I'm sorry, but nobody cares. Liking your own comment is pointless. Quit attempting to force people to conform to your ideas just because you think enjoyable aspects of life are bad.
@@SquidBeats so what religion should i be to avoid hell ? protestant ? jedi ?
@@SquidBeats Some grandma died.and back from the dead.She described that hell/heaven is not real.Just a void and nothing.
I'm in ROS(robotic) religion btw.
@@deadyanothaikiropool1chait713 That's the Bible. Thank you for describing the death experience
This dude needs more subs he has the best content ever.
Great, great video. Using the Tensorflow & Keras with the scikit-learn was super cool, especially in knowing it will help doctors make important cancer diagnoses, makes it awesome. Great job!!
I got this: ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 398, 30), found shape=(None, 30)
why? how to fix it?
When I run;
model.fit(x_train, y_train, epochs=1000)
it gave an error with last line;
ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)
I'm getting this same error. Anyone know how to fix it?
Guys I get value error when I run the "model.fit(x_train,y_train, epochs= 1000) any help plzzzz
Very clear now I been looking for stuff about this for three hours and you made it nice and clear amazing video :)
Wow I don't know much about Machine Learning I'm only thinking about learning it for now and I understood most of what you just taught! Awesome video make more like these!
Hey, just a tip for you as you go about learning. I see videos like these as a cool introduction to the subject that's more just like "ooh cool, look what that does". The mistake I often see people make is they just watch lots of videos like these, thinking they're learning. You're not really learning anything, you just know the pure basics of how a NN works. If you really want to get into machine learning, it's a lot of math and theory - so be prepared for that. If you have any questions feel free to ask :p
@@colinbalfour1834 i am currently learning ml, i do come up with some doubt whenever i work with some datasets , may i know your discord or any other social media you have
@@muhammedjaabir2609 lo yt keeps deleting my comments, whats your discord
@@colinbalfour1834 just wanting a subsubject name, if you could go back in time right now and relearn some of these data science concepts, how would you start??
and for a more specific one, i learn by creating my own mental model of 'axioms' or rules in structure as opposed to studying rigorously, so in my benefit do you happen to know of any group of topics or problems that show the majority of general rules id see in the subject? maybe moreso for beginners
@@colinbalfour1834 hey, what do you think is the best way to learn the mathematics behind neural networks? I’ve tried to learn some math regarding linear algebra and stuff but i’m a bit lost on how to apply it directly to machine learning.
Hi @Khanrad ; can you make a video on how to mini-graph those outputs inside the IDE? So we can repeatedly visualize our output? Scrolling through the data is OK when the set it small. Ideally Colab-Jupyter would have a button to the right of the output to mini-graph upon completion. Further to that I'm aware output should be stored for CI/CD analysis later. It's a convivence request.
I use Low Code in Azure-ML, I can highlight output and it will show a mini-graph. or I can export it to PowerBI. Output in my environment is saved in the dataverse and ETL with Synapse.
I use the graph thingies with this code:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
import tensorflow as tf
def visualize_output(output):
if isinstance(output, pd.DataFrame):
for column in output.columns:
_plot_mini_graph(output[column], column)
elif isinstance(output, pd.Series):
_plot_mini_graph(output, output.name)
else:
print("Invalid input type. Please provide a DataFrame or Series.")
def _plot_mini_graph(data, column_name):
plt.figure(figsize=(8, 4))
if data.nunique()
good job. the best teaching is when you make it simple.
Help! I'm trying to learn how this works and completed this example. I was thinking that I could try doing a weather forecast and try to stuff whatever I can think of into the csv file - recent temperatures from various places, date, co2 readings, etc. Any hints on how I can expand the model to cover my example? Or perhaps another tutorial?
Great content! Could u make a part 2 predicting with new dataset? Dunno how to do it here!
Sure. What new dataset would you like me to use?
@@theadameubanks something like data collected in a week in cancer unit in some hospital, like ur cancer.csv, but diagnosis column is empty to AI fill it :) It'd be awesome, I'm studying how I can do it yet in a simple way hahah
@@gutardivo if you want to make predictions on new data points, use y_predictions = model.predict(x)
@@theadameubanks yeah, I tried it i.imgur.com/jblBhox.png , idk where I put the new dataset
@@gutardivo upload the dataset csv to colab and change the name of the dataset in the notebook to equal the name of the file you uploaded
Bro, I just finished watching this 2022 July... And I really appreciate your efforts so much.
thank you man, this seems so easy to understand. thanks again. great job.
Thank you for your contributions to society and the internet with your free information, Brother.
Hi Khanrad, great video.
When I try to run your code as wel as my own version i get the following error at the last step:
'ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)'
What do you think could be the issue?
same can't figure it out.
I got the same thing
Me too
me too
This seems to work. input_shape = [None, x_train.shape[0], x_train.shape[1]]
Broh you're legit. Keep going we are expecting more tech content with you.
Fantastic class, Bro!
Thank you Very much!
You got it to work?
This video is very good and you made the whole concept very easy to grasp beside that you have a strong good voice that keep me concentrating with you through the whole video, thank you.
Glad you liked it!
Can you do more AI or ML videos that could apply to daily life? Thanks man
ua-cam.com/video/CT6Zif1cLTM/v-deo.html
Fantastic videos! Very easy to follow and actionable. Will absolutely share with everybody interested in this field. One quick note, when, doing anything in the medical field you have to understand the truth labels of the data.
To make the code work just change Input_shape=x_train.shape to input_shape=x_train.shape[1:]
Thx;-)
It is still not working for me. Do you have any other option?
@@pedrom677 Go back and start over;-) Not saying that to be mean, but sometimes you spend more "cycles" looking for a (:[{ or ., that you would with a clean notebook. The code above worked for me, so have hope.
My dude, this was very helpful for my research! Thank you!
Nice video :) but how do you actually make the ai predict outcomes?
I'm not an expert so I might be wrong, but I think based on the error percentage the network adjusts its weights for each element in every layer. So the next time you put in the same numbers you'll get a diffrent result. And it repeats that many many times and the error percentage gets smaler and smaler and the smaler it is the higher the possibility it'll calculate right the next time. I didn't watched the video entirely so I hope I didn't confused you with that.
If statement is the answer
your teaching style is awesome
My friends, search for your life purpose, why are we here?? I advise you to watch this series 👇 as a beginning to know the purpose of your existence in this life
ua-cam.com/play/PLPqH38Ki1fy3EB-8xmShVqpbQw99Do2B-.html
I was having the same issue as everyone and fixed by using this settings on the 5th block of code, when importing tensorflow
---------------------------------------------------------
import tensorflow as tf
model = tf.keras.models.Sequential(tf.keras.layers.Dense(1))
Amazing! Thank you!
@@jessekauffman2760 TY!
Thank you!!
Wow. Thank you for this video. I’m going to put this together. How can you make the AI work with other radiographs like musculoskeletal ultrasound, MRI and the like?
Also would there be any benefit in running the AI on a quantum computer other than speed?
How to make A.I. Aware of it's Surrounds?
Guess it's gonna need a heck lot of sensors
depends what you mean by "aware". You'll likely need different types of sensors, then a lot of programming to analyse the data collected and create awareness. If you provide more details I might be able to help :)
Give it sensors and teach it to use python.
Since the AI is now trained, I would have liked to see how we could use it like entering the measured data and getting a "this patient is likely to have a malignant tumor with a $percent_value propability."
Thank you so much, this was very educational.
now that the model has been trained how can we actually use it?
thank you so much for this:))
question: how to run this then? like will it say 0 or 1 as diagnosis?
Thank you man this was an amazing tutorials , but i have got this error ( ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)) , can you fix this .
same
The avenues for making those recognized patterns useful are diminished by illiteracy concerning the source signals and the lack of care taken in organizing the structure of the machine.
Similar to drawing constellations whereby connections are made between neighboring stars, yet those same celestial bodies are projected onto a two dimensional retina.
One might call what the Greeks did image recognition.
ummm, its having trouble seeing the canser.csv file, can you help with that at all?
it's cancer and if that doesn't work, try '/cancer.csv' since that's the correct path
Very clear , easy and straight to the point. very good explanation
This something I really wanna do but don’t know how to actually teach myself
Is it harder than Hakai Lord berrus?
Yes , yes it is
Just put enough work into it and you'll be able to figure it out
I would recommend going through at least the first year or two of a traditional CS curriculum. Learn a programming language, and get some foundational math knowledge like calc and discrete math. Work on learning algorithms and data structures, and find projects at your level. Once you can do some relatively complex projects, try some "AI" problems - something very basic. Maybe start with like a MiniMax, or a simple Genetic Algorithm. From there you'll absolutely want Linear Algebra and probably some applied statistics. Working through integral and mv calc will help with more complex problems like backpropogation/feedforward. I know that's all really vague - but if you have any more specific questions I'd be happy to answer them
Wait for open ai codex
I could use this exact script to build a stock trading bot using a ton of indicators for each column and 5 minute candles for the rows. If the AI could hit 97% accuracy on the stock market I could own the world in a year. lol. Solid video my guy, absolutely going dig into writing some AI code in python!
Yeah, you should check out my AI stock prediction video as well:
ua-cam.com/video/5xvAtypnLC0/v-deo.html
Damn , i've misunderstood alot of Things from different tutorials , your explanation is so clear and i understand alot things , thanks
I wonder how did you get the codes you type to make ai, it's so AWESOME
Thank you for sharing this.. helps me get started..
But I get error when I run "model.fit(x_train, y_train, epochs=1000)"
Error is pasted below.
Is there any clue on what could be wrong?
Thanks in advance!
-----------------------
Epoch 1/1000
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in ()
----> 1 model.fit(x_train, y_train, epochs=1000)
1 frames
/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.__traceback__)
---> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in autograph_handler(*args, **kwargs)
1127 except Exception as e: # pylint:disable=broad-except
1128 if hasattr(e, "ag_error_metadata"):
-> 1129 raise e.ag_error_metadata.to_exception(e)
1130 else:
1131 raise
ValueError: in user code:
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 878, in train_function *
return step_function(self, iterator)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 867, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 860, in run_step **
outputs = model.train_step(data)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 808, in train_step
y_pred = self(x, training=True)
File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.7/dist-packages/keras/engine/input_spec.py", line 263, in assert_input_compatibility
raise ValueError(f'Input {input_index} of layer "{layer_name}" is '
ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 455, 30), found shape=(None, 30)
I am getting the same error
use model.add(tf.keras.layers.Dense(256, input_shape=x_train.shape[1:], activation='sigmoid'))
@@arthurlage5859 didnt work
Can't get your code or mine to run . Keep getting epoch 1/1000 value error. It also says layer 0 of Sequential is incompatible.
Me either.
how to we use this to predict cases? If I give it a csv with the x datasets, how can I make it fill out the diagnosis column?
Thanks :)
y_predictions = model.predict(x)
@@theadameubanks thanks for replying, I figured it out eventually aha. Great content :)
@@theadameubanks so wait do i just type that in or what cause im realy confused as to how to give it new data to predict
@@theadameubanks Hey Khanrad, great videos! Love them you are so talented!
How do you fill in the formula to make a prediction? Tried without any success...Thank you for your help :)
how do you feed the AI data? Do you just evaluate a random x_test matrix with it and it auto classify y values?
Ya ALLAH har insan kamyab ho har insan ko sehat izat or kamyabi ata farma tohi Malik hay meray ALLAH reham farma.
Well done !! Thanks so much. Would you be able to advise on how to perform the AI Generation on our own computer? Running code on Google's computers is not cool AT ALL. Make you dependent, strictly no privacy, resources are limited, requires to be online . . . A great tool, but super limited
Hey!
Thanks a lot for this tutorial man. I was able to follow-up with most of the things described here but got stuck at Block-6 : Line 9.
I would really appreciate if you could explain the problem...it's showing {name 'x_train' is not defined} and {name 'model' is not defined}.
Oh it only works if you run all the code blocks before this code block, I got the same issue, I reloaded the website and ran every single cell from the start to finish and then it started working again.
Every time I double click on the data set in collab it asks if I want to download load I says nothing about the diagnosis
Hi, nice video! clear explanation of building an AI in Python. Sadly I'm not really good at coding in python. I'm wondering if you could help me with something.
I'm a tax law student engaged in compliance activities. For this job I have to read loads of annual accounts from companies in order to submit tax returns.
I'm actually looking for someone who could help me develop an AI that could get specific data out of PDF files quickly and fill it in in the right colums on a tax return to speed up the process. If you know anything or anyone who would like to do this hit me up! (we could hit a jackpot)
I think OCR is what you’re looking for, but it’s probably not viable with sensitive data because it’s a new technology and prone to mistakes
what you're looking for probably won't need ai. share your email id and I can get this done
I have a question. How to you make it actually identify the cancer? I am just a beginner, so this might be a stupid question. Btw, thank you @Saad Humayun for the comment, it saved me.
I cant find his comment
What exactly was it about
idk, I posted this a year ago
I wanna make an AI and name it JARVIS and some god will hot his hammer on the AI and he'll come to life as Vision
MCU fans know who I'm talking about
Or, and this is just an idea; come up with something original
Wow, this is amazing. This is my first ever attempt at building something. Quick question though, if I increase my neurons to 512, and my epochs to 2000, why would my accuracy go down?
Garbage. code doesn't work... recommendations for fixing it do not work either...
That’s what we call an issue of skill
It was amazing thank you .. but can creat a model using more complex data set, i mean use some feature enginering and add more layers and use earky stopping method ...etc
This was good
x_train.shape didn't work had to modify code to:
model.add(tf.keras.layers.Dense(256, input_shape=(None, 455, 30), activation='sigmoid'))
Found the solution to the end, you have to put “ epochs = 1000” you have to separate everything
This was really helpful me! I understand they are supervised dataset and how do you train when you get some books or pdf?like notebookLLM?
thanks for the video... btw how can i make my own data sets? i mean how can i extract tumor features from images?
hi I want to create my own AI in Language and vocabulary learning. can you tell me how can I start?
I'm actually working on something very similar. Stay tuned in the coming months :)
It made me feel like a programmer for a moment, even though I've never programmed in my life
Hey, I'm learning machine learning for fun and was wondering how I would be able to input new x data for the AI to generate y data for
Great video!! I have a question if the to be predicted variable is not binary but say from 1-10 how would that change the code? Sigmoid for example?
You could just scale it down so instead of going from 0-10 make it go from 0-1. Or scale it up.
Thank you for the answer!!
Thanks. A great introduction to what this platform can do. However, what this does not do it provide useful information for using the created model. This has many layers, and so it's no use asking which input features are useful. But how can an individual case be tested with the model?
this is all fun and games and a very good tutorial, but how do i create my own example files and adapt it to my needs?