Training a model to recognize sentiment in text (NLP Zero to Hero - Part 3)

Поділитися
Вставка
  • Опубліковано 21 сер 2024
  • Welcome to Zero to Hero for Natural Language Processing using TensorFlow! If you’re not an expert on AI or ML, don’t worry -- we’re taking the concepts of NLP and teaching them from first principles with our host Laurence Moroney (@lmoroney).
    In the last couple of episodes you saw how to tokenize text into numeric values and how to use tools in TensorFlow to regularize and pad that text. Now that we’ve gotten the preprocessing out of the way, we can next look at how to build a classifier to recognize sentiment in text.
    Colab → goo.gle/tfw-sa...
    GitHub → goo.gle/2PH90ea
    NLP Zero to Hero playlist → goo.gle/nlp-z2h
    Subscribe to the TensorFlow channel → goo.gle/Tensor...

КОМЕНТАРІ • 178

  • @juliocardenas-rodriguez1986
    @juliocardenas-rodriguez1986 2 роки тому +14

    The JSON file has to be fixed as follows:
    import json
    with open('./Sarcasm_Headlines_Dataset.json','r') as f:
    lines = f.readlines()
    s = '['
    for line in lines:
    #each line already had a '
    ' so I had to strip it out, add a comma, and put the '
    ' back in
    s+= line[:-1] +',
    '
    #the last line will have an extra ',
    ' which we need to get rid of and cap with a ']'
    s= s[:-2]+']'
    with open('./sarcasm_fixed.json', 'w') as f:
    f.write(s)
    with open('sarcasm_fixed.json', 'r') as f:
    datastore = json.load(f)

    • @berkay8406
      @berkay8406 2 роки тому +1

      you are incredible. I'm looking a solution to this problem for hours in net. thank you so much

    • @thanhquachable
      @thanhquachable Рік тому +2

      you save the day my friend, thanks

    • @amirrafiq
      @amirrafiq 3 місяці тому +1

      Thanks, man. Kudos!

  • @thanhquachable
    @thanhquachable Рік тому +7

    for those who are looking for ways to fix the json file:
    data is equivalien to datastore in the video, which is a list of items (dictionary)
    import json
    data = []
    with open("sarcasm_fixed.json", 'r') as f:
    lines = f.readlines()
    for i in lines:
    print(i) # optional - just print it out to explain the next 2 lines
    i.replace("'","") # this is to replace " ' " with ""
    i.replace("/n","") # this is to replace "/n" with ""
    obj = json.loads(i)
    data.append(obj)

    • @aksharmodi8640
      @aksharmodi8640 Рік тому

      thanks broo

    • @Darklord-uk6yi
      @Darklord-uk6yi 11 місяців тому

      can you explain both of the i.replace() lines, what you are doing is trying to change a string, but string in python is immutable and that line basically returns a new modified line which we are not storing so basically its useless, so in order to bring the change, u have to write i = i.replace().
      also still not clear why we are doing it, kindly explain, thank you!

    • @nileshsawantmusic
      @nileshsawantmusic 10 місяців тому

      This is great, any idea why the input json file kaggle does not follow standard json array syntax such as [{},{}]

    • @raquelocasio9571
      @raquelocasio9571 4 місяці тому

      This worked for me. Thanks!

  • @aungzinpyae8606
    @aungzinpyae8606 4 роки тому +15

    SeqtoSeq and Transformers from scratch please! You're my hero, Laurence!
    You have this amazing gift to simplify such difficult concepts.
    Tons of love from Myanmar!

  • @HealthyFoodBae_
    @HealthyFoodBae_ 4 роки тому +17

    Time series please? You’re my favorite professor!!

  • @sharif47
    @sharif47 4 роки тому +26

    Is this the end of NLP Zero to Hero? I wanna see so much more.
    Edit: No, it isn't.

  • @Themojii
    @Themojii 3 роки тому +3

    Great, clear, short and right to the point explanation. It is also very helpful to learn the concept more in depth when you give a link to the code that we can practice it by our own. Thank you Laurence

  • @RajaSekharaReddyKaluri
    @RajaSekharaReddyKaluri 4 роки тому +3

    I opened UA-cam expecting to see part 3....and I find it on top.
    Thanks @ moroney

  • @GauravRawat14
    @GauravRawat14 4 роки тому +8

    Great tutorial for people just starting with NLP.. Now anyone can write a usable NLP system.. NLP for the masses 👍

  • @abhisheksharda2953
    @abhisheksharda2953 4 роки тому +2

    Amazing content! The shackles of complex NLP jargon has now been broken. You are doing a HUGE favor to soo many people (me included) out there by sharing NLP essence in such a simple way! Thank you!

  • @anuradhabalasubramanian9845
    @anuradhabalasubramanian9845 2 роки тому +1

    Your Explanation is Mindblowing Sir ! Your are the real NLP Hero :)

  • @SumayahAlsakiti
    @SumayahAlsakiti 6 місяців тому +1

    Links were very helpful, you explained everything clearly and simply. Thank you

  • @shreyaraj8515
    @shreyaraj8515 3 роки тому +2

    Love the short yet succinct explanation of concepts on this channel. PS. @lmoroney you remind me a lot of Philip Seymour Hoffman esp from his role in MI-3!

  • @_petrok
    @_petrok 4 роки тому +7

    Again a great tutorial and demonstration. Thank you very much!

  • @LIUJIANYING_
    @LIUJIANYING_ 2 місяці тому

    This is so clear and easy to understand. Thank you, now I have a better understanding about NLP.

  • @thananjayachakravarthys4092
    @thananjayachakravarthys4092 4 роки тому +5

    Awsome!! Waiting for this video from the last week

  • @enigmatouriste349
    @enigmatouriste349 3 роки тому +5

    Hi, I face this error when I tried to load json file : JSONDecodeError: Extra data: line 2 column 1 (char 217)
    What is the source of this error?
    Thanks

    • @darkmagic543
      @darkmagic543 2 роки тому +1

      The JSON file is not a valid JSON. Use some editor (such as Notepad++), open the .json file and replace
      with ,
      (this adds a comma at the end of every line) and then add [ at the beginning of the file and ] and the end of the file, also delete the last comma. This will make it a valid JSON.

  • @Drew0Ranger
    @Drew0Ranger 2 роки тому +3

    I am a professor myself, but my teaching quality is nowhere near yours. You are the best.

  • @rishabhagarwal3796
    @rishabhagarwal3796 Рік тому

    in a very easy way he gave us very clear understanding wit example , a huge salute

  • @PritishMishra
    @PritishMishra 4 роки тому +1

    I am loving Tensorflow more than me !!

  • @0xN1nja
    @0xN1nja 2 роки тому

    prolly the best explanation for embedding layer 🎉

  • @Algardraug
    @Algardraug Рік тому +1

    Not quite sure how the Y component of the bad-good vectors were playing a role. You said the vectors were two dimensional but it seemed that only the X axis made any impact on the sentiment

  • @rajgohil8775
    @rajgohil8775 4 роки тому +4

    Pekase do a short series on Automatic speech recognition or audio enhancement, etc etc

    • @LaurenceMoroney
      @LaurenceMoroney 4 роки тому +3

      Oh that would be nice. Not sure if it would be short though!

  • @jin8128
    @jin8128 4 роки тому +3

    Great tutorials! Can't wait for part 4!

  • @isakbiderre181
    @isakbiderre181 2 роки тому

    For those wondering, skillingsbolle is a type of norwegian pastry

  • @sagauer
    @sagauer 2 роки тому

    Very awesome series! Thank you!

  • @FINTHRTD
    @FINTHRTD 4 роки тому +3

    When i try to load the json file I get this error: line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
    json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 217)

    • @FINTHRTD
      @FINTHRTD 4 роки тому +3

      importing json did not work for me at all, therefore with a little research I found that we can do it using pandas as well.
      import pandas as pd
      data = pd.read_json("sarcasm.json", lines=True)
      headline = data['headline'].to_list()
      is_sarcastic = data['is_sarcastic'].to_list()

    • @piotrszostakiewicz7925
      @piotrszostakiewicz7925 4 роки тому

      @@FINTHRTD Got another solution
      dataset = []
      for line in open('data/sarcasm.json', 'r'):
      dataset.append(json.loads(line))
      for item in dataset:
      print(item['headline'])

    • @FINTHRTD
      @FINTHRTD 4 роки тому

      @@piotrszostakiewicz7925 json.loads is giving an error

    • @piotrszostakiewicz7925
      @piotrszostakiewicz7925 4 роки тому

      @@FINTHRTD What error? It's working for me

    • @FINTHRTD
      @FINTHRTD 4 роки тому

      @@piotrszostakiewicz7925 i am getting the same error as before.

  • @BrianBeanBag
    @BrianBeanBag 2 роки тому +1

    Can you explain, why you've chosen the embedding_dim to be 16? Is that an arbitrary number you've chosen, or do you base it on a factor from the dataset?

  • @SuperWiseacre
    @SuperWiseacre 4 роки тому

    My fav professor

  • @narendrapratapsinghparmar91
    @narendrapratapsinghparmar91 7 місяців тому

    Thanks for your efforts.

  • @azakifav
    @azakifav Рік тому

    Such a talent! Thanks.

  • @rohanmanchanda5250
    @rohanmanchanda5250 2 роки тому

    Mr. Moroney, do you not think that this is similar to giving a human a couple of dialogues to study from an alien language, and then asking them to categortize it in two? I mean, the task that you wanted to be performed by the model is indeed done well, but apropos of the scenario I just drew, the model (as the human) would not be able to UNDERSTAND the language. For that, we will need to be drawn again to the classical programming driven by the rules, where we would need to instruct the program to perform tasks based on the words detected and categorized by the model. The only advantage here seems that we will not have to write all possible words that will trigger the action.... or so I thought... If we are designing a model for a custom use-case, we would still need to create hundreds of sentences for the model to first train on and then manually train it for results, I believe that does slightly well than just "if(sentence.containsAnyOf("wordA", "wordB", ""....){ performTask() }".
    What are your thoughts?

  • @ronaldboodram8563
    @ronaldboodram8563 4 роки тому

    awesome series

  • @legion55able
    @legion55able 2 роки тому

    Amazing! Keep up the good work!

  • @juliocardenas4485
    @juliocardenas4485 2 роки тому

    You are the man !! 👨🏽‍🎓🧑🏽‍💻🤟🏾

  • @abdulwahabjatto5264
    @abdulwahabjatto5264 4 роки тому

    Short video but rich contents. Thanks

    • @laurencemoroney655
      @laurencemoroney655 4 роки тому

      Great! I try to keep them less than 6 minutes, but had to go a bit longer this time

  • @M_Zaroug
    @M_Zaroug 4 роки тому +2

    thank you for awesome tutorial, ^_^ Waiting for text generating video.

    • @LaurenceMoroney
      @LaurenceMoroney 4 роки тому +2

      Been delayed, unfortunately, because of events moving virtual in response to the Covid-19 outbreak. But there's lots of great content coming from TF Dev Summit, Cloud.NEXT and more...

  • @Dhruvbala
    @Dhruvbala Рік тому +1

    Love the videos.
    Quick doubt I had though, are the tokenizations of words in any way related to their meanings? Where words with similar meanings are close to each other numerically

    • @AdvancementsInTech
      @AdvancementsInTech 9 місяців тому

      No, I believe that the tokens are assigned randomly based on the order of the sentences and do not have any relation to the meanings of the words but however I may be wrong.

  • @raquelocasio8588
    @raquelocasio8588 4 місяці тому

    Thank you for this tutorial! Question: What is the best way to determine the number of epochs to use?

  • @BaskarDakshin
    @BaskarDakshin 4 роки тому

    Waiting for the next video on this awesome Nlp video series

    • @LaurenceMoroney
      @LaurenceMoroney 4 роки тому +3

      Thanks, preparing to shoot some "Coding TensorFlow: At Home" episodes while staying home to prevent the spread of Covid-19

  • @edsonkambeu6810
    @edsonkambeu6810 Рік тому +1

    How do you determine vocabulary size? Is it arbitrary figure or there is a way of determining it?

    • @narminr
      @narminr 9 місяців тому

      the same here, I still couldn t find an answer

  • @herbertnikolajewski3835
    @herbertnikolajewski3835 3 роки тому +1

    How do I decide how great the number of the embedding_dim should be? Why is it 16 in the example?

  • @franciscojaviermunoz252
    @franciscojaviermunoz252 2 роки тому

    amazing job!
    How you decide "Good-Bad": goodness and the other possibilities?
    P.D.: the other interesting part for me is that regarding communication the challenge is still up for all the body language, as important or more as the linguistics.

  • @abhishekpoojary6354
    @abhishekpoojary6354 4 роки тому +1

    Can someone explain what's happening at 6:35 ?

  • @johnvalgon5660
    @johnvalgon5660 2 роки тому

    Really thank you

  • @aiwithr
    @aiwithr 4 роки тому

    You did cover it well.

  • @Skhulile84
    @Skhulile84 4 роки тому +1

    Excellent explanation, especially the one of the "Embedding Layer". I have always struggled to understand it from other videos and articles. Thank you very much.
    Just a quick question. So from the explanation, the embedding layer seems to learn the relationship of the words to the dependent variable. In the case of a Recurrent Nueral Network, would it then learn how the features relate to the sequences that are learnt by an RNN? I ask this mainly because I have seen other people putting an embedding layer with an RNN when building a chatbot?
    I'm particularly interested in applying an RNN to some time series data, say for stock prices, I believe that making use of extra features like the company issuing the stock etc. then feeding the time series with the extra feature of company name through an embedding layer and then through an RNN might improve the model?
    Thank you!

    • @LaurenceMoroney
      @LaurenceMoroney 4 роки тому +2

      Kinda sorta. Consider the embedding to be a set of numbers that describe the word, including its semantics. RNNs are good at determining meaning in a sequence. So, the sentence "In Ireland I went to high school, so I had to learn how to speak " has the value of determined very early on in the sentence by the word 'Ireland', so maintaining meaning in a long sequence is important, and RNNs (and in particular LSTMs) are good at that.
      For the stock sequence thing...I'm not so sure. If the 'external' data can be shown to have an impact on the trend, then possibly. If it doesn't (for example, the name), then I would doubt it.

    • @Skhulile84
      @Skhulile84 4 роки тому +1

      @@LaurenceMoroney So well explained! Really appreciate it! Looking forward to more Machine Learning tutorials, really learning a lot!

  • @maxouloulou24
    @maxouloulou24 3 роки тому

    I have a problem when I load my data with the JSON library. When I do json.load(f), I get : "JSONDecodeError: Extra data: line 2 column 1 (char 208)" I've tried to correct my JSON but nothing works. Why ?

  • @taktouk17
    @taktouk17 3 роки тому +1

    I tested the code with sarcastic sentences but it did not give me good results...

    • @Briefklammer1
      @Briefklammer1 3 роки тому

      i have the same problem, i tried an lstm NN with 0.86 accuracy at top, but the "granny spider" example sentence results in a prediction near 0.

  • @trinity7710
    @trinity7710 3 роки тому

    Is there by any chance a Tutorial on how to use this with SVMs. This Series is really good for NLP beginners and I'm currently struggling with applying the Preprocessed Data to classification using SVMs. It should be simple but hasn't quite clicked yet. Appreciate the helpful insights.

    • @AbdulMeque
      @AbdulMeque 2 роки тому

      I assume you have managed to do it by now..?!

  • @yesubabusrungavruksham1577
    @yesubabusrungavruksham1577 3 роки тому

    Nice video. Have few doubts
    How does it know that a word should be plotted on some coordinates and what is the relation of padded Sequence with embedding process

  • @RajaSekharaReddyKaluri
    @RajaSekharaReddyKaluri 4 роки тому +1

    Is this the end of NLP zero to hero series @laurence moroney

    • @SamuraiDexter
      @SamuraiDexter 4 роки тому

      he said there is more on the way. means no.

    • @laurencemoroney655
      @laurencemoroney655 4 роки тому

      @@SamuraiDexter It's the end of the classification one. I'm working on a Text Generation one, but that's been delayed because we had to move TFDS and NEXT away from in-person events to digital ones, so getting studio time is hard. Likely will also have changes for IO, which will again constrain my time getting into the studio to film it. So...it's delayed. Sorry!

  • @DrJanpha
    @DrJanpha 3 роки тому

    Thanks. Can you make the final two indexes easier to interpret? (Humans
    numbers)

  • @abhiraameranti8498
    @abhiraameranti8498 3 роки тому

    what do you think of adding a Conv1D after the embedding layer to extract features from the embeddings? would that help?

  • @anushka.narsima
    @anushka.narsima Рік тому

    for the json.load(f), I'm getting TypeError: the JSON object must be str, bytes or bytearray, not TextIOWrapper. What do I do?

  • @ankitbrijwasi9902
    @ankitbrijwasi9902 4 роки тому

    can we get a series on abstractive text summarization??

  • @krishnachauhan2822
    @krishnachauhan2822 4 роки тому +1

    Thank you sir plz explain this Vocab Size. is it a dictionary ?
    Is it building while training?

    • @ArchanaTikayatRay19
      @ArchanaTikayatRay19 4 роки тому

      I just chose values of my own and will change it to see if the results improve:
      vocab_size = 10000
      embedding_dim = 16
      max_length = 100
      trunc_type='post'
      padding_type='post'
      oov_tok = ""
      training_size = 20000

  • @stevenlawson9553
    @stevenlawson9553 4 роки тому

    how many filters are used in the Sequentail model?? I think we must have filters for pooling to use .

  • @MaxDolotboy
    @MaxDolotboy 8 місяців тому

    I was following in the part 2. But now i'm not sure to understand the relation between the tokenized word and the json with the article, header and sarcasm thing... I don't understand how this can help me detected what do to in a sentence, for example "Play the movie Titanic", "Can you play a movie which will be Titanic". How with that can I isolate the word titanic, same thing for a music title or an application name... I'm kinda lost, is there a way to take private lessons with you ?

  • @jacobdavidcunningham1440
    @jacobdavidcunningham1440 4 роки тому

    If I'm trying to read more on "common or garden deep neural network" what do I search for? I didn't get immediate hits for the latter

  • @putrinadia4708
    @putrinadia4708 4 роки тому +1

    what algorithm used in this tutorial ?

  • @kidstabate7191
    @kidstabate7191 3 роки тому

    do you have a video tutorial about coreference resolution using tensorflow and keras?

  • @paulyoo7479
    @paulyoo7479 2 роки тому

    Could someone please explain what I should put for the output and input dimensions for the embedding layer?

  • @Raghugrdr
    @Raghugrdr 4 роки тому

    Very useful

  • @thanhquachable
    @thanhquachable Рік тому

    why do we need to split the data into training and testing, can it be all training? then we can test it with real testing sentences which are presented at the end of this video.

  • @stevenlawson9553
    @stevenlawson9553 4 роки тому

    What is the output dimention of the GlobalAveragePooling layer ? (1, )??

  • @praskatti
    @praskatti 3 роки тому

    @Laurence, thank you for the insightful content. is it possible to determine the time spent in training a model from the perspective of planning ML activities? are there any guide lines around this?

    • @rohanmanchanda5250
      @rohanmanchanda5250 2 роки тому +1

      Depending on your dataset, the time will vary. For example, if your dataset is a set of audio consisting of total data of 300MBs, the first epoch takes around 10-15 seconds, and thereafter all the epochs take ~1s to complete. So, ideally, your dataset will be in GBs and you would require a lot of training, thousands of epochs, maybe, so expect a couple of hours of training-only phase in your project. Now, if your project is for a fairly general purpose, you may get away with minimal training, ranging from a couple of seconds to an hour, because if you notice, when you create something like a face recognition lock in your phone, it asks for training data by asking you too look at the device, while it captures photos. Now, that takes only about half a minute to train and test and finally store the model, but as you know, still performs in a fairly robust manner. The use-case I described above was for huge production-ready critical application softwares, for example, a suicide-prevention software that may provide Machine-Learned AI Counsellors. There exists a similar platform, as far as I know, and was even featured on the tensorflow channel. Now that had a training time (total, over a period of time) of around 5000 hours, because they could not afford mistakes in their execution, so... completely depends on your use-case buddy don't let anything hinder you. Go on and build something great. By the way, if you haven't heard of it, a website called "Teachable Machine", created by Google helps you train models impressively fast, and it also allows you to export your model to use in your apps, along with all the required stuff (well basically other than the tflite model, only the labels file is required, which it ships to you along the model itself in a zipped format). Now, as long as you do not want something like on-device training, teachable machine is a great way to get started, even in production apps (although I would recommend testing with self-made models before deploying). Good luck,

    • @praskatti
      @praskatti 2 роки тому

      @@rohanmanchanda5250 thanks for taking time respond and in a very detailed manner. Quick follow up. you mentioned the use case of face recognition, is the model present/updated on the device at all times or takes the help of a remote service ? also how do we account for long training cycles? can this activity be run in parallel by leveraging multiple GPUs? Another question is, do we always need GPUs for training, testing and execution? or for any of phases we can get by by using commodity hardware?

    • @rohanmanchanda5250
      @rohanmanchanda5250 2 роки тому

      @@praskatti whenever the model is present on-device or is fetched remotely is entirely up to the developer, in the case of system software like the face recognition service, it is up to the OEM. There are a couple of possibilities...
      1.) You can store the model on-device and train on-device - simple enough, everything is stored in the apps assets and no network connectivity is required.
      2.) You can store the model on-device but train in the cloud - some training procedures may require powerful machines to complete fast and so you may wanna upload the training data to a server and train the model in-cloud.
      3.) Model in Cloud and training on-device : again, fairly simple, the model is in the cloud. You upload the training data and train the model in the cloud.
      4.) Model on-cloud, training on-device: This is somewhat rare since it's not exactly much useful, but may be preferable if model size is large and you do not wish to bloat the app size with it. However, keep in mind that users will still need to download the model which will cost them data. So, it is usually better to ship the model along with the app itself.
      Generally, you do not require on-device training for simple models, like object detection. You can pre-train your model and just apply it to use.
      If you do wish to train the model based on the user-specific parameters, consider using on-device training instead of training-in-cloud, since the latter would require uploading the users' data to a server, which many users who value privacy would not appreciate.
      Apart from training, the model, if stored in cloud, should be deployed wisely. If you download the model from the cloud, cache it while your app is being used, and then discard it, this will cost the users a lot of data every time the model is downloaded, i.e., every time your app is used. Your app would become data-heavy. On the other hand, if you include the model within the app, this is not a problem, but your model must be reasonably sized.
      If your model is heavy and you must store it on a server, consider creating a mechanism for model storage. Like download the model once, and store it in the app's storage. Then re-use it from there every other time.
      Most of this would not be something you'll have to deal with since you most of the ml projects are dealing with simple small-sized models which are pre-trained and shipped as is, not requiring further processing.
      If you are developing for mobile, make sure you quantize your modles to integer format, it drastically reduces model size, and also dramatically increases the inference speed, with minimal loss in accuracy.
      Try out teachable machine, and if you're comfortable with a little coding in python, check out the Tflite Model Maker API. You can create models with just four lines of code with those, using them is super easy, barely an inconvenience.

  • @ZagreusCastilho
    @ZagreusCastilho 3 роки тому

    python makes it super easy, barely an inconvenience

  • @jasong3972
    @jasong3972 3 роки тому

    Anyone encounter this error as training starts?
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
    tensorflow.python.framework.errors_impl.UnimplementedError: Cast string to float is not supported

  • @noahkreyenhagen8937
    @noahkreyenhagen8937 2 роки тому

    I'm a little confused on how they assigned vectors to each words sentement. I get the training data are the words themselves, but where is the list of correctly assigned vectors that they used to train the network on sentement?

    • @noahkreyenhagen8937
      @noahkreyenhagen8937 2 роки тому

      I understand the concept, it's the code I'm having trouble with

  • @nepalsudip1
    @nepalsudip1 4 роки тому

    awesome videos! subscribed. What IDE you used to get such colorful outputs?

  • @AnAN-bn1ol
    @AnAN-bn1ol 3 роки тому

    how do run these predictions over a csv file : in one column rows of sentences and second columns appended results

  • @shanmugks
    @shanmugks 4 роки тому

    Is this language dependant? I guess by the structure this will work for Spanish or German ?

  • @moodiali7324
    @moodiali7324 4 роки тому

    while working on your colab example, reaching Epoch 5 makes the val_loss increase exponentially while val_accuracy drops, i tried adding more neurons, drop out layer but nothing worked, any idea why is this happening?

    • @LaurenceMoroney
      @LaurenceMoroney 4 роки тому

      Weird. Did you follow it completely? Did you change any of the data?

    • @moodiali7324
      @moodiali7324 4 роки тому

      @@LaurenceMoroney no I didnt change anything

    • @LaurenceMoroney
      @LaurenceMoroney 4 роки тому

      @@moodiali7324 Is the colab set for GPU ?

  • @VibhootiKishor
    @VibhootiKishor 4 роки тому

    Nice!!!

  • @priyanshupatel885
    @priyanshupatel885 Рік тому

    when i am importing json file it is giving me error (Extra data: line 2 column 1 (char 208)) can you please help me with this??

  • @Munna0421
    @Munna0421 4 роки тому

    I am getting an error using the sarcasm dataset while opening and reading the file. The error is "JSONDecodeError: Extra data: line 2 column 1 (char 217)".

    • @elliotrutherfoord8007
      @elliotrutherfoord8007 4 роки тому

      I am getting the same thing
      could someone please advise
      thanks

    • @jasong3972
      @jasong3972 3 роки тому

      Not sure how, but this cleared the error
      dataset = []
      sentences = []
      labels = []
      urls = []
      for line in open('path/data.json ', 'r'):
      dataset.append(json.loads(line))

      for item in dataset:
      sentences.append(item['headline'])
      labels.append(item['is_sarcastic'])
      urls.append(item['article_link'])

  • @Debugerr
    @Debugerr 4 роки тому

    @lmoroney small bug in colab notebook plot_graphs(history, "accuracy") gives key error it should be plot_graphs(history, "acc")

    • @laurencemoroney655
      @laurencemoroney655 4 роки тому

      Thanks..in 2.0, it's 'accuracy', and I've fixed and updated the colab for this. Please give it a try :)

    • @Debugerr
      @Debugerr 4 роки тому

      @@laurencemoroney655 thanks for update

    • @ankurkum93
      @ankurkum93 4 роки тому +1

      @@Debugerr When you pass the strings 'accuracy' or 'acc', we convert this to
      one of `tf.keras.metrics.BinaryAccuracy`,. I saw this when I typed help(model.compile)

  • @juliocardenas4485
    @juliocardenas4485 2 роки тому

    I’ll try to apply this to medical claims 🧑🏽‍💻

  • @farsiteguide2735
    @farsiteguide2735 4 місяці тому +1

    Code is completely messed up in video, people can only guess what code goes where, and it is like 40% shorter than colab posted in video. I still remember promise that this lessons can be easy even if you do not know Python. Instead of writing code, video just shows part of code assuming you will know where to put it. It is not just add code to end, it can go anywhere.

    • @xv3ei
      @xv3ei 2 місяці тому

      Like lol 😂

  • @rasoulnorouzi3657
    @rasoulnorouzi3657 4 роки тому

    is there anyone to explain what are these layers and why we use 'relu' as activation function:
    tf.keras.layers.GlobalAveragePooling1D(),
    tf.keras.layers.Dense(24, activation='relu'),

    • @laurencemoroney655
      @laurencemoroney655 4 роки тому

      Global average pooling is effectively summing up the n-dimensional vectors to simplify.
      'relu' ignores everything that's

  • @RajaSekharaReddyKaluri
    @RajaSekharaReddyKaluri 4 роки тому

    Can anyone stress more on globalaveragepooling2D layer?

  • @auwalali7006
    @auwalali7006 4 роки тому

    Hello, get this error!
    FileNotFoundError Traceback (most recent call last)
    in ()
    1 import json
    ----> 2 with open("sarcasm.json", 'r') as f:

  • @thatchipmunksings
    @thatchipmunksings 4 роки тому

    This is keras for babies.
    I am a baby.
    I love keras.
    And most importantly, I love your tutorials!

  • @ilhamsurya8587
    @ilhamsurya8587 2 роки тому

    help, anyone know what algorithm used in this tutorial ?

  • @defetya
    @defetya Рік тому

    isn't the model overfitted? I mean, the accuracy on validation data seems to be noticably lowerer than on training data

    • @yutersteam
      @yutersteam 10 місяців тому

      I noticed that, too. The validation accuracy peaks around Epoch 2 or 3, then keeps decreasing until the training is over.

  • @jeetshah8513
    @jeetshah8513 4 роки тому

    I was working with numbers and i feel that my test data was leaked what to know how to avoid it
    Please reply!!!

    • @jeetshah8513
      @jeetshah8513 4 роки тому

      @@LaurenceMoroney ''?'' what do i understand by it

  • @CardioCareWellness
    @CardioCareWellness 2 роки тому

    Technical or billing issue

  • @sahiluppal3093
    @sahiluppal3093 4 роки тому

    Is there any alternative way rather than tokenizing the words. I don't think this is the most optimal solution in NLP industry..

    • @laurencemoroney655
      @laurencemoroney655 4 роки тому

      It's really up to you. Could do letters, words, sub-words, or if you can slice a sentence into phrases...but when using LSTMs and RNNs, the context of words can be maintained, so for simple scenarios like this one, I like it :)

  • @muskansanghai5685
    @muskansanghai5685 4 роки тому

    where can i get sentiment.json file ?

  • @marshallmcluhan33
    @marshallmcluhan33 4 роки тому

    Comic Book Guy, sarcastically, says, "Oh, a sarcasm detector. Oh, that's a real useful invention." which causes it to overload with sarcastic data and explode.

    • @LaurenceMoroney
      @LaurenceMoroney 4 роки тому +1

      The very definition of recursion.

    • @marshallmcluhan33
      @marshallmcluhan33 4 роки тому

      Laurence Moroney The medium is the message

    • @LaurenceMoroney
      @LaurenceMoroney 4 роки тому +2

      @@marshallmcluhan33 And the bottom line is that the bottom line is the bottom line :)

  • @pempheromkuka7874
    @pempheromkuka7874 Рік тому

    i still dont get embeddings 😁

  • @aninditachavan6056
    @aninditachavan6056 4 роки тому

    Will this work for multi-class classification? If I have 4 labels.

    • @ramasai1475
      @ramasai1475 3 роки тому

      Add a softmax layer at the end

    • @luis96xd
      @luis96xd 3 роки тому

      @@ramasai1475 Yeah, instead of 'sigmoid' 😁

  • @rasoulnorouzi3657
    @rasoulnorouzi3657 4 роки тому

    I get this error in colab:
    ---------------------------------------------------------------------------
    KeyError Traceback (most recent call last)
    in ()
    10 plt.show()
    11
    ---> 12 plot_graphs(history, "accuracy")
    13 plot_graphs(history, "loss")
    in plot_graphs(history, string)
    3
    4 def plot_graphs(history, string):
    ----> 5 plt.plot(history.history[string])
    6 plt.plot(history.history['val_'+string])
    7 plt.xlabel("Epochs")
    KeyError: 'accuracy'
    ------------------------------------------------------------------------------------------
    for this block of codes:
    import matplotlib.pyplot as plt
    def plot_graphs(history, string):
    plt.plot(history.history[string])
    plt.plot(history.history['val_'+string])
    plt.xlabel("Epochs")
    plt.ylabel(string)
    plt.legend([string, 'val_'+string])
    plt.show()

    plot_graphs(history, "accuracy")
    plot_graphs(history, "loss")

  • @chriscockrell9495
    @chriscockrell9495 4 роки тому

    Embedding meaning in words.

    • @saidmanam4199
      @saidmanam4199 3 роки тому

      it is to represent each word with a vector

  • @codderrrr606
    @codderrrr606 Рік тому

    I was expecting Rishabh Misra in the comment section

  • @MattiaCeccopieri
    @MattiaCeccopieri 4 роки тому

    *SARCASM SIGN*

  • @deepakdakhore
    @deepakdakhore 4 роки тому

    Cool

  • @DDavissi
    @DDavissi 4 роки тому

    Entity detection please!

  • @notandymarty
    @notandymarty 4 роки тому +1

    it's almost as if Google owns both Tensorflow and UA-cam. imagine that.

    • @smarty20two
      @smarty20two 4 роки тому

      You might be a few years late to the party. UA-cam and Google have been under the same umbrella for like forever.

  • @Otonium
    @Otonium 4 роки тому

    Can you please add a link to the playlist, thanks!

    • @laurencemoroney655
      @laurencemoroney655 4 роки тому

      Entire 'Coding TensorFlow' playlist is here: ua-cam.com/play/PLQY2H8rRoyvwLbzbnKJ59NkZvQAW9wLbx.html