Django Machine Learning Project - Iris Prediction

Поделиться
HTML-код
  • Опубликовано: 14 окт 2024
  • Here we build a Django machine learning app to predict Iris flower species from a user input
    Project files:
    github.com/ver...

Комментарии • 86

  • @johngou
    @johngou 3 года назад +3

    Of course I stumble upon this just AFTER I struggled with Flask to implement all the stuff Django apparently has built-in. Will try this on the next project, this looks neater.

  • @neuron8186
    @neuron8186 3 года назад +3

    why the heck you don't have million subs i am following you from 6 month and you are the best teacher i have

    • @veryacademy
      @veryacademy  3 года назад

      Hi Neuron, thank you kindly, hey the truth of it is, this is really niche and doesn't include funny cats 👍

  • @tjdud2651
    @tjdud2651 3 года назад

    this tutorial saved my life. What a great centry that I could take this tutorial in my room

  • @indiajackson5959
    @indiajackson5959 2 года назад +1

    Your voice is amazing!

  • @shashikumarn.s859
    @shashikumarn.s859 4 года назад +1

    The video was helpful since learnt calling ML model from Django ...thanks a lot for the video

    • @veryacademy
      @veryacademy  4 года назад

      Glad you found something useful, good luck with your develop!

  • @ritvikdayal5970
    @ritvikdayal5970 3 года назад +1

    Thanks a lot sir for such videos
    These are far more imp. To many of us than we can say. 😊

  • @ghezalahmad
    @ghezalahmad 2 года назад

    I like your voice and the way you explain

  • @MohammadMahadiHassain
    @MohammadMahadiHassain 4 года назад +1

    Thank you so much for such an amazing tutorial. It was very helpful

    • @veryacademy
      @veryacademy  4 года назад +1

      You're very welcome Mohammad! Have a great day! Any questions, please just ask.

    • @MohammadMahadiHassain
      @MohammadMahadiHassain 4 года назад

      @@veryacademy subscribed to your channel ❤️

  • @casterlyrock4398
    @casterlyrock4398 3 года назад +1

    Nice tutorial, thanks for sharing. 👍

  • @henry12794
    @henry12794 3 года назад

    So you are using the prediction from a Jupiter lab that loads a CSV what about if you want to upload online? and how would you do it?

  • @devihalawa2909
    @devihalawa2909 2 года назад

    I have try this, but Its not working in prediction input. I have to insert number and submit but not get dataa, why I do ,help

  • @ejanshrestha9504
    @ejanshrestha9504 2 года назад

    can you please create a stock forecast wep app using lstm in django full tutorial using csv data ???

  • @danianiazi8229
    @danianiazi8229 3 года назад +1

    Can you please make a tutorial for video capturing web app using Django just like live face detection

    • @veryacademy
      @veryacademy  3 года назад +1

      Hi Dania, I really want to get back to ML apps as soon as possible. I will make this I do this, but it wont be until I get the ecommerce tutorials finished.

  • @kragaswarupa7679
    @kragaswarupa7679 2 года назад +1

    Hi sir can you make a django based ml project on loan prediction

  • @alphonseinbaraj7602
    @alphonseinbaraj7602 4 года назад +1

    Sir ,i am preparing the project is language translation (english to chinese only) using django. i have .h5 model(keras) for that. I dont know how to use that model in django. help me . Initially i practiced only through googletrans and deployed in heroku also. worked well. But now i need to use through .h5 model. guide me please . i would like to show the coding.

    • @veryacademy
      @veryacademy  4 года назад +1

      Hey Alphonse, what you ask is a big long essay answer. Sorry I cant help on this one. Wish you all the best on your project - sounds interesting.

    • @alphonseinbaraj7602
      @alphonseinbaraj7602 4 года назад

      @@veryacademy sir, thank you . ..because after watch your video of model, got some ideas and some hope that model for language translation. Thanks again

  • @elyesachour6333
    @elyesachour6333 2 года назад

    How can we change the use of html in the frontend into react please

  • @sandrafitri4973
    @sandrafitri4973 4 года назад +1

    Hi sir i want to make prediction data by myself but i have problem. How to pickle data i have no idea about wht pickle is..sorry but if you knw pickle's tutorial please let me knw cause i try search on youtube still i dnt understand

    • @veryacademy
      @veryacademy  4 года назад

      Thank you for the comment. Sorry you are finding it hard to get resources on this. It is really simple once you have built a model - making a pickle is just one line of code. Do you know how to make a ML model from data?

    • @veryacademy
      @veryacademy  4 года назад

      You can see the line of code at 02:57 on line 28 that pickles the model

    • @sandrafitri4973
      @sandrafitri4973 4 года назад

      @@veryacademy sir im sorry late responding. I know how to make ML at my jupyter notebook and the file is being pickle but i have problem sir the data couldn't predict the user input i have in that sir and at my cmd error it says "sklearn.tree._tree.Tree.__cinit__ value error :buffer dtype mismatch,expected 'size_t' but got long

    • @sandrafitri4973
      @sandrafitri4973 4 года назад

      I got stuck sir :( please help me also thanks a lot for answering my questions

  • @neiveinkhalil1290
    @neiveinkhalil1290 4 года назад +1

    Hi sir, I have machine learning model deployed it with django. İ want to save the result of prediction. How can I handle that?!

    • @veryacademy
      @veryacademy  4 года назад

      I presume you mean a database? I think I did a tutorial showing how to save to database. You need to capture the data in the view and save to database. Have a look here ruclips.net/p/PLOLrQ9Pn6caxVPGZj0uU0e1jAg2DWOm7B

  • @vandana1145
    @vandana1145 3 года назад +1

    Hi Sir, if I want to put a boolean attribute in the input field (to get value from user), what can I use. I used checkbox, but by default it is passing always 'on' in the DB even if the checkbox is unchecked. Please advice.

    • @veryacademy
      @veryacademy  3 года назад +1

      Hi Vandana,
      Have a look at BooleanField
      ####
      docs.djangoproject.com/en/3.2/ref/forms/fields/
      Set the initial booleanField to False
      ####
      forms.BooleanField(label="x", initial=False)
      After you validate/clean_data in the view it should return True or 1 and False which can be also 0

    • @vandana1145
      @vandana1145 3 года назад

      @@veryacademy Thanks for your reply Sir, I will implement this.

  • @harshitdhiman6748
    @harshitdhiman6748 3 года назад +1

    which machine learning algorithm is used here. kindly someone reply to it

    • @veryacademy
      @veryacademy  3 года назад

      This is just a simple example

  • @ashar_naveed
    @ashar_naveed 4 года назад +1

    Hello! Could you help me out with this error?
    KeyError: "None of [Index(['sepal_length', 'sepal_width', 'petal_length', 'petal_width'], dtype='object')] are in the [columns]"

    • @veryacademy
      @veryacademy  4 года назад

      Could be a number of issues. Just from that error I cant really say too much for a solution.
      stackoverflow.com/questions/51976930/keyerror-none-of-are-in-the-columns-pandas-python

    • @ashar_naveed
      @ashar_naveed 4 года назад +1

      @@veryacademy Can i send you a screenshot of the code along where the error has taken place. Somewhere other than here?

    • @veryacademy
      @veryacademy  4 года назад

      Screenshots are not useful I am afraid. Best to use services such as stackoverflow - your have potentially hundreds of people look at it

    • @bogdancarutasiu8918
      @bogdancarutasiu8918 3 года назад +1

      The columns are named different. Read what the columns are named in your file, it could differ

  • @timorsulimani1906
    @timorsulimani1906 4 года назад +1

    thanks!
    i am running into a little problem tho,
    'SVC' object has no attribute 'break_ties'

    • @veryacademy
      @veryacademy  4 года назад

      Hello! Sorry for the delay in getting back to you! I have the comments on notification, but still its not coming through straight away. In my rush, I didn't include a requirement.txt file, that may help you. I will test the code today and update the files with a req file. If that isn't working I will try and assist you further.

    • @veryacademy
      @veryacademy  4 года назад

      I was able to replicate your problem. Okay, to solve your project we needed to re-create the pickle file and you are good to go. Problem with a lot of code online is that the tools/packages are updating so quickly. I have updated everything, tested the code - all should be working once more. If you have any tutorial requests or ideas please I would be happy to assist your learning.

    • @timorsulimani1906
      @timorsulimani1906 4 года назад

      @@veryacademy yes it works now, thanks for the requirements.txt file!!

    • @timorsulimani1906
      @timorsulimani1906 4 года назад

      # Split into training data and test data
      X = df[['sepal_length','sepal_width','petal_length','petal_width']]
      y = df['classification']
      when you wrote this,
      I don't think this is the right explanation:
      "Split into training data and test data
      "
      am i wrong?
      because you split it to data to check by it, and the result,
      And train_test_split split the data into training data and test data
      .

    • @ziadtarek4382
      @ziadtarek4382 4 года назад

      @@timorsulimani1906 i'm having the same problem when submitting the form could please tell me how you solved this error? i tried re-making the pickle file as said and that didn't help

  • @sswyman05
    @sswyman05 4 года назад

    Hi Veryacademy. Nice and clear tutorial. I am not getting anything out of the pickle file, though. I get a "ValueError: unsupported pickle protocol: 5". I am using Python 3.6, all other library versions are the same as the requirements.txt file. I have run a migration. Any ideas?

    • @veryacademy
      @veryacademy  4 года назад

      Hi - you can link to me a GitHub repo if you like in Facebook or here. Either way I will check the repo tonight for you. Its a new one for me that's for sure, but I think an easy one to solve. Here is something that might help
      community.platformio.org/t/valueerror-unsupported-pickle-protocol-5/10022

    • @veryacademy
      @veryacademy  4 года назад

      Hi Scott did you get it sorted. I couldn’t replicate your error. Only problem I sometimes get is if I use the pickle file that’s included in the repository. Did you build your own pickle file?

    • @sswyman05
      @sswyman05 4 года назад

      thanks @@veryacademy. Let me try to re-create the pickle file.

    • @sswyman05
      @sswyman05 4 года назад +1

      @@veryacademy All good now, thanks! (didnt build the picklte file properly)

    • @veryacademy
      @veryacademy  4 года назад +1

      Nice one, enjoy!

  • @bijeshrajkunwar115
    @bijeshrajkunwar115 4 года назад

    In 20:31 line 21 result = model.predict([[sepal_length, sepal_width, petal_length, petal_width]])
    is the predict refrencing to sklearns predict or the predict in line 4?
    This is the first time I'm working with picked file so a bit confused

    • @veryacademy
      @veryacademy  4 года назад +1

      Hi Bijesh, Line 21 using predict is referencing to sklearn predict. Line 4 will be a view function name for a URL path. It is likely that the predict view is for the landing page of the website

  • @melikeyildiz1841
    @melikeyildiz1841 2 года назад

    After clicking the submit button , i am not getting the entered values in modal. Can you help mee.

  • @aadarshyadav6650
    @aadarshyadav6650 8 месяцев назад

    how i uploading image in forms how can i pass it to other views .
    pls help im building documentaion text extraction

    • @veryacademy
      @veryacademy  8 месяцев назад

      To upload an image in Django forms and pass it to other views, you can follow these steps:
      Create a Model for Your Image:
      If you don't have a model for handling images, create one in your models.py file. For example:
      python
      Copy code
      # models.py
      from django.db import models
      class Document(models.Model):
      image = models.ImageField(upload_to='documents/')
      Create a Form for Image Upload:
      Build a form in forms.py that includes an ImageField for image uploads. Make sure to set enctype="multipart/form-data" in the HTML form to handle file uploads.
      python
      Copy code
      # forms.py
      from django import forms
      from .models import Document
      class DocumentForm(forms.ModelForm):
      class Meta:
      model = Document
      fields = ['image']
      Create a View for Image Upload:
      In your views, create a view that handles the form submission and saves the uploaded image.
      python
      Copy code
      # views.py
      from django.shortcuts import render, redirect
      from .forms import DocumentForm
      def upload_image(request):
      if request.method == 'POST':
      form = DocumentForm(request.POST, request.FILES)
      if form.is_valid():
      form.save()
      return redirect('success_page') # Redirect to a success page or another view
      else:
      form = DocumentForm()
      return render(request, 'upload_image.html', {'form': form})
      Create a Template for Image Upload:
      Build an HTML template (upload_image.html) that renders the form.
      html
      Copy code
      {% csrf_token %}
      {{ form.as_p }}
      Upload Image
      Create a Success View:
      Create a view that will be redirected to upon successful image upload.
      python
      Copy code
      # views.py
      from django.shortcuts import render
      def success_page(request):
      return render(request, 'success_page.html')
      Pass Uploaded Image to Other Views:
      Once the image is uploaded, you can pass it to other views as needed. For example, you might pass the image URL or other relevant information to another view.
      python
      Copy code
      # views.py
      from django.shortcuts import render
      def another_view(request):
      # Get the uploaded image from the database or session
      image = Document.objects.last() # Adjust this based on your model structure
      return render(request, 'another_view.html', {'image': image})
      You can then render the image in the another_view.html template as needed.
      Remember to configure your urls.py to route requests to the appropriate views. Adjust the code snippets based on your project's structure and requirements.

  • @user-kr8ir6tx9c
    @user-kr8ir6tx9c 4 года назад +1

    Prediction is not working.
    Means when displaying result page output is not shown

    • @veryacademy
      @veryacademy  4 года назад

      Hello! Sorry for the delay in getting back to you! I have the comments on notification, but still its not coming through straight away. In my rush, I didnt include a requirement.txt file, that may help you. I will test the code today and update the files with a req file. If that isn't working I will try and assist you further.

    • @veryacademy
      @veryacademy  4 года назад

      I was able to replicate your problem. Okay, to solve your project we needed to re-create the pickle file and you are good to go. Problem with a lot of code online is that the tools/packages are updating so quickly. I have updated everything, tested the code - all should be working once more. If you have any tutorial requests or ideas please I would be happy to assist your learning.

  • @ravinayak2785
    @ravinayak2785 Год назад +1

    I need project on prediction of astroid orbit path using random forest algorithm video please can you send it

    • @veryacademy
      @veryacademy  Год назад

      Yeah I just happen to have made it today! 😂

    • @ravinayak2785
      @ravinayak2785 Год назад

      ​@@veryacademyplease can you send me the tutorial please 🙏🏻🙏🏻🙏🏻....

    • @ravinayak2785
      @ravinayak2785 Год назад

      Sir can I send the particular dataset for prediction of astroid orbit path using random forest can make the tutorial please do it it is very useful and interesting project sir please you can made it today sir please 🙏🏻🙏🏻...

  • @fadwahsissou1673
    @fadwahsissou1673 3 года назад

    amazing

  • @amruthap6334
    @amruthap6334 4 года назад

    hey.. than you very much for this.... if i have a one hot encoded model, how should i approach to the prediction.?? Obviously it does not take the input as usual, then how do i onehot encode my user input...? pleaseeeeeeeeeeeee helpppppp

    • @veryacademy
      @veryacademy  4 года назад

      Hey, I don't have a direct answer for you. But you should be reading through the use of OneHotEncoder, LabelBinarizer and LabelEncoder. This could be useful www.ritchieng.com/machinelearning-one-hot-encoding/ and scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html

    • @amruthap6334
      @amruthap6334 4 года назад

      @@veryacademy actually i had. i think i have to handle the request to convert but it is such a long process. Anyways thank you for the suggestion 💚🌺

    • @veryacademy
      @veryacademy  4 года назад

      How about stackoverflow.com/questions/41496248/predicting-from-scikitlearn-randomforestclassification-with-categorical-data

    • @veryacademy
      @veryacademy  4 года назад

      When I get a moment I will see if I can do an example for you.

    • @amruthap6334
      @amruthap6334 4 года назад

      @@veryacademy that will be really greatful.. thankyou sooo much💚🌺💚🌺

  • @kritamdangol5349
    @kritamdangol5349 4 года назад

    After clicking the submit button , i am not getting the entered values in modal. Please provide a solution.

    • @veryacademy
      @veryacademy  4 года назад +1

      Hey Kritam, thank you for your message. I have recently updated the repository and tested the code as there was a few issues with a recent API update. See the comments. I have just tested the code again (from a fresh download of the repo) for you and everything is working fine. It is incredibly difficult to answer your question and support you as I would need some context to help understand what it is you have done and how you have done it, your environment details etc. Even then, still difficult. Simple things I guess is, have you run a migration? Change the values in the view.py to static values to see if anything is returning back (this tests to see if the ajax function is working) knowing that you might just need to remake the pickle file again. Think of the process in steps you type something into the form and it is then sent to the view in Django via AJAX - so in the view capture that and test it - so maybe simply add some lines of code in the view to print out what was sent from the form - is that isnt working - now you know where to look for the fault. The next task is the ML part - the data is then tested against the model (using the pickle) file - make sure that the pickle file is in the right path on your computer as it is stated in the view.py file. You could also just then make just print what is returned from the new prediction.

    • @melikeyildiz1841
      @melikeyildiz1841 2 года назад

      Hey did you find a solution about it? I really need help

  • @dharmaputra7394
    @dharmaputra7394 4 года назад +1

    Request classification with Flask

    • @veryacademy
      @veryacademy  4 года назад +1

      Ok, I will do the same project with flask - is that what you are asking?

    • @dharmaputra7394
      @dharmaputra7394 4 года назад

      @@veryacademy yes sir but i want to use naive bayes multiclass algorithm

    • @dharmaputra7394
      @dharmaputra7394 4 года назад

      @@veryacademy good luck your channel 👍

    • @veryacademy
      @veryacademy  4 года назад +2

      Okay, so to confirm a flask api with naive bayes classification example

  • @adityahpatel
    @adityahpatel 3 года назад

    Without explaining anything you are doing the work. Pretty ridiculous. The commentary should include Why you do something when u do something