

{"id":101005,"date":"2021-10-20T09:00:16","date_gmt":"2021-10-20T03:30:16","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=101005"},"modified":"2026-06-01T14:41:41","modified_gmt":"2026-06-01T09:11:41","slug":"iris-flower-classification","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/","title":{"rendered":"Iris Flower Classification Project using Machine Learning"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:2648,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1rc-6A0e19efVzwMs1--esA6ZMLfjRe8G\\\/view?usp=drive_link&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p>Machine learning is almost everywhere nowadays. It\u2019s become more and more necessary day by day. From the recommendation of what to buy to recognizing a person, robotics, everywhere is machine learning. So in this project, we\u2019ll create the \u201cHello World\u201d of machine learning which means Iris flower classification.<\/p>\n<p><strong>Iris flower classification<\/strong> is a very popular machine learning project. The iris dataset contains three classes of flowers, <strong>Versicolor, Setosa, Virginica,<\/strong> and each class contains 4 features, &#8216;Sepal length&#8217;, &#8216;Sepal width&#8217;, &#8216;Petal length&#8217;, &#8216;Petal width&#8217;. The aim of the iris flower classification is to predict flowers based on their specific features.<\/p>\n<h3>What is machine learning?<\/h3>\n<p>Machine learning is about learning to predict something or extracting knowledge from data. ML is a part of artificial intelligence. ML algorithms build a model based on sample data or known as training data and based upon the training data the algorithm can predict something on new data.<\/p>\n<h3>Categories of Machine Learning<\/h3>\n<ul>\n<li><strong>Supervised machine learning:<\/strong> Supervised machine learning are types of machine learning that are trained on well-labeled training data. Labeled data means the training data is already tagged with the correct output.<\/li>\n<li><strong>Unsupervised machine learning:<\/strong> Unlike supervised learning, unsupervised learning doesn\u2019t have any tagged data. It learned patterns from untagged data. Basically, it creates a group of objects based on the input data\/features.<\/li>\n<li><strong>Semi-supervised machine learning:<\/strong> Semi-supervised learning falls between supervised and unsupervised learning. It has a small amount of tagged data and a large amount of untagged data.<\/li>\n<\/ul>\n<h3>Applications of Machine Learning<\/h3>\n<p><strong>1. Speech Recognition:<\/strong> Speech recognition uses NLP (Natural Language Processing) to process human speech into written format and vice versa. Some examples are &#8211; Google Assistant, Alexa, Siri.<\/p>\n<p><strong>2. Recommendation Engine:<\/strong> Using the past behavior of a human\u2019s search data the recommendation engine can produce new data to cross-sell products to customers. For example &#8211; Amazon product recommendations, Spotify music recommendations.<\/p>\n<p><strong>3. Chatbot:<\/strong> Chatbots are used to give customer services without any human agent. It takes questions from users and based on the question it gives an answer as a response.<\/p>\n<p>In this project, we\u2019ll solve the problem using a supervised learning approach. We\u2019ll use an algorithm called \u201cSupport vector machine\u201d.<\/p>\n<p><strong>Support vector machine:<\/strong> A support vector machine (also known as a support vector network) is a supervised machine learning algorithm that analyzes data for classification and regression. SVMs are one of the most robust classifications methods.<\/p>\n<p>SVM approximates a separate line (Hyperplane) between two classes.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/iris-flower-classification-svm.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103793\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/iris-flower-classification-svm.webp\" alt=\"iris flower classification svm\" width=\"756\" height=\"527\" \/><\/a><\/p>\n<p>SVM algorithm finds the points closest to the line from both classes. These points are known as support vectors. Then it computes the distance between the line and support vectors. This distance is called the margin. The main goal is to maximize the margin. The hyperplane which has the maximum margin is known as the optimal hyperplane.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/optimal-hyperplane.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103794\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/optimal-hyperplane.webp\" alt=\"optimal hyperplane\" width=\"1080\" height=\"565\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/optimal-hyperplane.webp 1080w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/optimal-hyperplane-768x402.webp 768w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/a><\/p>\n<p>SVM mainly supports binary classification natively. For multiclass classification, It separates the data for binary classification and utilizes the same principle by breaking down multi-classification problems into multiple binary classification problems.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/iris-flower-classification-svm-multi.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103795\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/iris-flower-classification-svm-multi.webp\" alt=\"iris flower classification svm multi\" width=\"734\" height=\"440\" \/><\/a><\/p>\n<h3>Prerequisites:<\/h3>\n<p>1. Numpy- 1.19.3<br \/>\n2. Matplotlib- 3.3.2<br \/>\n3. Seaborn &#8211; 0.11.1<br \/>\n4. Pandas &#8211; 1.2.4<br \/>\n5. Scikit-learn &#8211; 0.24.2<\/p>\n<h3>Download Iris Flower Classification Project Code<\/h3>\n<p>Please download the source code of iris flower classification with opencv: <a href=\"https:\/\/drive.google.com\/file\/d\/1rc-6A0e19efVzwMs1--esA6ZMLfjRe8G\/view?usp=drive_link\"><strong>Iris Flower Classification Project Code<\/strong><\/a><\/p>\n<h3>Steps to Classify Iris Flower:<\/h3>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/iris-flower.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103801\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/iris-flower.webp\" alt=\"iris-flower\" width=\"1020\" height=\"352\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/iris-flower.webp 1020w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/iris-flower-768x265.webp 768w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/a><\/p>\n<p>1. Load the data<br \/>\n2. Analyze and visualize the dataset<br \/>\n3. Model training.<br \/>\n4. Model Evaluation.<br \/>\n5. Testing the model.<\/p>\n<h4>Step 1 &#8211; Load the data:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># DataFlair Iris Flower Classification\r\n# Import Packages\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nimport seaborn as sns\r\nimport pandas as pd\r\n%matplotlib inline\r\n<\/pre>\n<p>First, we\u2019ve imported some necessary packages for the project.<\/p>\n<ul>\n<li>Numpy will be used for any computational operations.<\/li>\n<li>We\u2019ll use Matplotlib and seaborn for data visualization.<\/li>\n<li>Pandas help to load data from various sources like local storage, database, excel file, CSV file, etc.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"> columns = ['Sepal length', 'Sepal width', 'Petal length', 'Petal width', 'Class_labels'] \r\n# Load the data\r\ndf = pd.read_csv('iris.data', names=columns)\r\ndf.head()\r\n<\/pre>\n<ul>\n<li>Next, we load the data using pd.read_csv() and set the column name as per the iris data information.<\/li>\n<li>Pd.read_csv reads CSV files. CSV stands for comma separated value.<\/li>\n<li>df.head() only shows the first 5 rows from the data set table.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/data-head.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103796\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/data-head.webp\" alt=\"data head\" width=\"557\" height=\"222\" \/><\/a><\/p>\n<ul>\n<li>All the numerical values are in centimeters.<\/li>\n<\/ul>\n<h4>Step 2 &#8211; Analyze and visualize the dataset:<\/h4>\n<p>Let\u2019s see some information about the dataset.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Some basic statistical analysis about the data\r\ndf.describe()\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/describe.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103797\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/describe.webp\" alt=\"describe\" width=\"519\" height=\"312\" \/><\/a><\/p>\n<p>From this description, we can see all the descriptions about the data, like average length and width, minimum value, maximum value, the 25%, 50%, and 75% distribution value, etc.<\/p>\n<p>Let\u2019s visualize the dataset.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Visualize the whole dataset\r\nsns.pairplot(df, hue='Class_labels')\r\n<\/pre>\n<ul>\n<li>To visualize the whole dataset we used the seaborn pair plot method. It plots the whole dataset\u2019s information.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/visualize.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103798\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/visualize.webp\" alt=\"visualize\" width=\"1104\" height=\"801\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/visualize.webp 1104w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/visualize-768x557.webp 768w\" sizes=\"auto, (max-width: 1104px) 100vw, 1104px\" \/><\/a><\/p>\n<ul>\n<li>From this visualization, we can tell that iris-setosa is well separated from the other two flowers.<\/li>\n<li>And iris virginica is the longest flower and iris setosa is the shortest.<\/li>\n<\/ul>\n<p>Now let\u2019s plot the average of each feature of each class.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Separate features and target  \r\ndata = df.values\r\nX = data[:,0:4]\r\nY = data[:,4]\r\n<\/pre>\n<ul>\n<li>Here we separated the features from the target value.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Calculate average of each features for all classes\r\nY_Data = np.array([np.average(X[:, i][Y==j].astype('float32')) for i in range (X.shape[1])\r\n for j in (np.unique(Y))])\r\nY_Data_reshaped = Y_Data.reshape(4, 3)\r\nY_Data_reshaped = np.swapaxes(Y_Data_reshaped, 0, 1)\r\nX_axis = np.arange(len(columns)-1)\r\nwidth = 0.25\r\n<\/pre>\n<ul>\n<li>Np.average calculates the average from an array.<\/li>\n<li>Here we used two for loops inside a list. This is known as list comprehension.<\/li>\n<li>List comprehension helps to reduce the number of lines of code.<\/li>\n<li>The Y_Data is a 1D array, but we have 4 features for every 3 classes. So we reshaped Y_Data to a (4, 3) shaped array.<\/li>\n<li>Then we change the axis of the reshaped matrix.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Plot the average\r\nplt.bar(X_axis, Y_Data_reshaped[0], width, label = 'Setosa')\r\nplt.bar(X_axis+width, Y_Data_reshaped[1], width, label = 'Versicolour')\r\nplt.bar(X_axis+width*2, Y_Data_reshaped[2], width, label = 'Virginica')\r\nplt.xticks(X_axis, columns[:4])\r\nplt.xlabel(\"Features\")\r\nplt.ylabel(\"Value in cm.\")\r\nplt.legend(bbox_to_anchor=(1.3,1))\r\nplt.show()\r\n<\/pre>\n<ul>\n<li>We used matplotlib to show the averages in a bar plot.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/bar-plot.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-103799\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/bar-plot.webp\" alt=\"bar plot\" width=\"495\" height=\"270\" \/><\/a><\/p>\n<ul>\n<li>Here we can clearly see the verginica is the longest and setosa is the shortest flower.<\/li>\n<\/ul>\n<h4>Step 3 &#8211; Model training:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Split the data to train and test dataset.\r\nfrom sklearn.model_selection import train_test_split\r\nX_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=0.2)\r\n<\/pre>\n<ul>\n<li>Using train_test_split we split the whole data into training and testing datasets. Later we\u2019ll use the testing dataset to check the accuracy of the model.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Support vector machine algorithm\r\nfrom sklearn.svm import SVC\r\nsvn = SVC()\r\nsvn.fit(X_train, y_train)\r\n<\/pre>\n<ul>\n<li>Here we imported a support vector classifier from the scikit-learn support vector machine.<\/li>\n<li>Then, we created an object and named it svn.<\/li>\n<li>After that, we feed the training dataset into the algorithm by using the svn.fit() method.<\/li>\n<\/ul>\n<h4>Step 4 &#8211; Model Evaluation:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Predict from the test dataset\r\npredictions = svn.predict(X_test)\r\n\r\n# Calculate the accuracy\r\nfrom sklearn.metrics import accuracy_score\r\naccuracy_score(y_test, predictions)\r\n<\/pre>\n<ul>\n<li>Now we predict the classes from the test dataset using our trained model.<\/li>\n<li>Then we check the accuracy score of the predicted classes.<\/li>\n<li>accuracy_score() takes true values and predicted values and returns the percentage of accuracy.<\/li>\n<\/ul>\n<p><strong>Output:<\/strong><br \/>\n0.9666666666666667<\/p>\n<p>The accuracy is above 96%.<\/p>\n<p>Now let\u2019s see the detailed classification report based on the test dataset.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># A detailed classification report\r\nfrom sklearn.metrics import classification_report\r\nprint(classification_report(y_test, predictions))\r\n\r\n                \t\tprecision    recall  f1-score   support\r\n\r\n    Iris-setosa       \t1.00      1.00      1.00         9\r\nIris-versicolor       \t1.00      0.83      0.91        12\r\n Iris-virginica       \t0.82      1.00      0.90         9\r\n\r\n       accuracy                          \t     0.93        30\r\n      macro avg       \t0.94      0.94      0.94        30\r\n   weighted avg       \t0.95      0.93      0.93        30\r\n\r\n<\/pre>\n<ul>\n<li>The classification report gives a detailed report of the prediction.<\/li>\n<li>Precision defines the ratio of true positives to the sum of true positive and false positives.<\/li>\n<li>Recall defines the ratio of true positive to the sum of true positive and false negative.<\/li>\n<li>F1-score is the mean of precision and recall value.<\/li>\n<li>Support is the number of actual occurrences of the class in the specified dataset.<\/li>\n<\/ul>\n<h3>Step 5 &#8211; Testing the model:<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">X_new = np.array([[3, 2, 1, 0.2], [  4.9, 2.2, 3.8, 1.1 ], [  5.3, 2.5, 4.6, 1.9 ]])\r\n#Prediction of the species from the input vector\r\nprediction = svn.predict(X_new)\r\nprint(\"Prediction of Species: {}\".format(prediction))\r\n<\/pre>\n<ul>\n<li>Here we take some random values based on the average plot to see if the model can predict accurately.<\/li>\n<\/ul>\n<p><strong>Output:<\/strong><\/p>\n<p>Prediction of Species: [&#8216;Iris-setosa&#8217; &#8216;Iris-versicolor&#8217; &#8216;Iris-virginica&#8217;]<\/p>\n<p>It looks like the model is predicting correctly because the setosa is shortest and virginica is the longest and versicolor is in between these two.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Save the model\r\nimport pickle\r\nwith open('SVM.pickle', 'wb') as f:\r\n    pickle.dump(svn, f)\r\n\r\n# Load the model\r\nwith open('SVM.pickle', 'rb') as f:\r\n    model = pickle.load(f)\r\nmodel.predict(X_new)\r\n<\/pre>\n<ul>\n<li>We can save the model using pickle format.<\/li>\n<li>And again we can load the model in any other program using pickle and use it using model.predict to predict the iris data.<\/li>\n<\/ul>\n<h3>Summary<\/h3>\n<p>Iris Flower Classification is one of the simplest and most famous beginner-level ML projects. It uses the Iris dataset, which includes measurements of flower parts like petal and sepal length\/width. The goal is to classify the flower into one of three species: Setosa, Versicolor, or Virginica. This project helps you understand data visualization, classification, and model evaluation using a clean, easy dataset.<\/p>\n<p>In this project, we learned to train our own supervised machine learning model using Iris Flower Classification Project with Machine Learning. Through this project, we learned about machine learning, data analysis, data visualization, model creation, etc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Machine learning is almost everywhere nowadays. It\u2019s become more and more necessary day by day. From the recommendation of what to buy to recognizing a person, robotics, everywhere is machine learning. So in this&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":103802,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[25557,25556,25555,20697],"class_list":["post-101005","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-iris-flower-classification-project","tag-iris-flower-classification-project-using-machine-learning","tag-iris-flowers-classification-project","tag-machine-learning-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Iris Flower Classification Project using Machine Learning - DataFlair<\/title>\n<meta name=\"description\" content=\"Iris flower classification is a very popular machine learning project. Create this project in easy steps. Source Code is provided for help.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Iris Flower Classification Project using Machine Learning - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Iris flower classification is a very popular machine learning project. Create this project in easy steps. Source Code is provided for help.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-20T03:30:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-01T09:11:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/machine-learning-project-iris-flower-classification.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Iris Flower Classification Project using Machine Learning - DataFlair","description":"Iris flower classification is a very popular machine learning project. Create this project in easy steps. Source Code is provided for help.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/","og_locale":"en_US","og_type":"article","og_title":"Iris Flower Classification Project using Machine Learning - DataFlair","og_description":"Iris flower classification is a very popular machine learning project. Create this project in easy steps. Source Code is provided for help.","og_url":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-10-20T03:30:16+00:00","article_modified_time":"2026-06-01T09:11:41+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/machine-learning-project-iris-flower-classification.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Iris Flower Classification Project using Machine Learning","datePublished":"2021-10-20T03:30:16+00:00","dateModified":"2026-06-01T09:11:41+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/"},"wordCount":1243,"commentCount":8,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/machine-learning-project-iris-flower-classification.webp","keywords":["Iris Flower Classification Project","Iris Flower Classification Project using Machine Learning","Iris Flowers Classification Project","machine learning project"],"articleSection":["Machine Learning Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/iris-flower-classification\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/","url":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/","name":"Iris Flower Classification Project using Machine Learning - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/machine-learning-project-iris-flower-classification.webp","datePublished":"2021-10-20T03:30:16+00:00","dateModified":"2026-06-01T09:11:41+00:00","description":"Iris flower classification is a very popular machine learning project. Create this project in easy steps. Source Code is provided for help.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/iris-flower-classification\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/machine-learning-project-iris-flower-classification.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/10\/machine-learning-project-iris-flower-classification.webp","width":1200,"height":628,"caption":"machine learning project iris flower classification"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/iris-flower-classification\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Machine Learning Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/machine-learning\/"},{"@type":"ListItem","position":3,"name":"Iris Flower Classification Project using Machine Learning"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/101005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=101005"}],"version-history":[{"count":10,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/101005\/revisions"}],"predecessor-version":[{"id":148744,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/101005\/revisions\/148744"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/103802"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=101005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=101005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=101005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}