Machine learning - Study on Classification of Iris Bloom Images Using Sci-Kit Learn’s Support Vector Machine (SVM) Model. - Khorgist.com

Breaking

Post Top Ad

Advertise Here

Post Top Ad

STAY SAFE




Saturday, 29 June 2019

Machine learning - Study on Classification of Iris Bloom Images Using Sci-Kit Learn’s Support Vector Machine (SVM) Model.


Source: RCMolokwu
Original blog article
Image classification is an AI strategy used to foresee bunch participation for information cases. A classification issue manages associating an information test design with one of the particular classes. There are different classification strategies for plant classification going from K-Nearest Neighbor classifier, Support Vector Machines (SVM) Nueral Networks and so forth. This paper centers around IRIS plant arrangement utilizing the Support Vector Machine (SVM). The issue considerations the identifying proof of IRIS plant species supported plant property estimations.. classification of IRIS informational index would find designs from looking at petal and sepal size of the IRIS plant and how the forecast was produced using investigating the example to frame the class of IRIS plant. Plant classification has wide applications in different fields, for example, Botany, Ayurveda, Agriculture, Floriculture and so on.
Plant recognition has an expansive scope of utilizations in farming and gardening, and is critical to the science decent variety look into. Blooms are indispensable for the assurance and beautification of our condition. In any case, it is a significant and troublesome errand to perceive the diverse types of plant.
The Iris bloom informational collection or Fisher’s Iris informational index is a multivariate informational index presented by the British analyst and researcher Ronald Fisher in his 1936 paper “The utilization of different estimations in ordered issues for instance of straight discriminant examination.” It is now and then called Anderson’s Iris informational collection since Edgar Anderson gathered the information to evaluate the morphologic variety of Iris blossoms of three related species. Two of the three species were gathered in the Gaspé Peninsula “all from a similar field, and singled out that day and estimated in the meantime by a similar individual with a similar device”
The IRIS dataset contains fifty tests from all three varieties of (Iris setosa, Iris virginica and Iris versicolor). Four highlights were estimated from each example: the length and the width of the sepals and petals, in centimeters. In view of the blend of these four highlights, Fisher built up a direct discriminant model to separate the species from one another.
In AI, support-vector machines (SVMs, likewise support – vector systems) are regulated learning model with related learning calculations that dissect information utilized for order and relapse investigation. a help vector machine builds a hyperplane or set of hyperplanes in a high-or inconclusive dimensional space, which can be utilized for order, relapse and so on. Naturally, a great partition is accomplished by the hyperplane that has the biggest separation to the closest preparing information purpose of any class (alleged utilitarian edge), since when all is said in done the larger the edge, the lower the speculation mistake of the classifier.
I have employed the use of Support vector machines in order to classify the iris data set. The Iris data set is one of the benchmark data sets used to demonstrate the approach for classification problems. I have taken this dataset from the UCI machine learning repository. Firstly I used the Google’s open source tool, Sci-kit learn library for python to get the dataset, the I used the matplotlib tool for python for visualization and finally again the googles Sci-kit learn tool was used to  train my model and make some predictions.
A picture of the 3 different classes of the flower is shown below:
Iris Satosa
Iris Satosa
Iris Veriscolor
Iris Veriscolor
Iris Virginica
The iris dataset contains measurements for 150 iris flowers from three different species.
The three classes in the Iris dataset:
Iris-setosa (n=50)
Iris-versicolor (n=50)
Iris-virginica (n=50)
The four features of the Iris dataset:
sepal length in cm
sepal width in cm
petal length in cm
petal width in cmA pair plot of the dataset was done to determine which specie of the flower set was most separable using matplot library for python.
Pairplot of features
Created a kde plot of sepal length versus sepal width for setosa species of flower
KDE plot of features
Having done some data analysis, I sliced my dataset using the sci kit learn tool for train test split “from sklearn.model_selection import train_test_split”.
The model was fitted and trained upon 80 percent of the initial dataset comprising of 150 entries. The fitting parameters which gave me my results are as follows:
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
  decision_function_shape=None, degree=3, gamma=’auto’, kernel=’rbf’,
  max_iter=-1, probability=False, random_state=None, shrinking=True,
  tol=0.001, verbose=False)
where:
“C = Penalty parameter of the error term
degree = degree of the polynomial kernel function
gamma = kernel coefficient for “rbf”, “poly” and “sigmoid”
tol= Tolerance for stopping criterion.
cache_size = the size of the kernel cache in (MB).
class_weight = Set the parameter C of class i to class_weight[i]*C for SVC. If not given, all classes are supposed to have weight one. The “balanced” mode uses the values of y to automatically adjust weights inversely proportional to class frequencies in the input data as 
verbose = Enable verbose output. Note that this setting takes advantage of a per-process runtime setting in libsvm that, if enabled, may not work properly in a multithreaded context.
max_iter = Hard limit on iterations within solver, or -1 for no limit.
decision_function = Whether to return a one-vs-rest (‘ovr’) decision function of shape (n_samples, n_classes) as all other classifiers, or the original one-vs-one (‘ovo’) decision function of libsvm which has shape. However, one-vs-one (‘ovo’) is always used as multi-class strategy.
random_state = The seed of the pseudo random number generator used when shuffling the data for probability estimates. If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.”
(cited from the official documentation of Sci-kit learn https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html).
After the fit, predictions were made on the rest 20 percent of the initial data set.
Results
The IRIS dataset (downloaded from the UCI repository, www.ics.uci.edu, which is a 150×4 matrix, is taken as the input data. Out of these 150 samples, 80% sample were used for training, and 20% for testing. Under supervised learning, the result was as follows:
Confusion matrix of result
A confusion matrix of the predictions from the dataset
Classification report of the results
A classification report.
From the classification report, we could see that our model seems to be working perfect with a 100% precision for the Iris Setosa and Iris Veriscolor and a 94% for the Iris virginica. And on an average, our model is on a confidence level of 98%.  This could also be seen in the confusion matrix above where the model predicted 15 out of 15 true for the Iris Setosa and 13 out of 13 true for the Iris Veriscolor but predicted 16 out of 17 true for the Iris Virginicsa. With a total prediction of n = 45.
Conclusions
From the study of above classification techniques we have come up with a set of conclusions. SVM being relatively a new machine learning tool, seems to be predicting fine on the Google’s Sci-kit tool for Image recognition with a high amount of learning rate that makes it faster to make accurate predictions under the supervised learning technique, In SVM computational complexity is reduced to quadratic optimization problem and it is easy to control complexity of decision rule and frequency of errors. Drawback of SVM is that it is difficult to determine optimal parameters when training data is not linearly separable. Also SVM is more complex to understand and implement, although, because we were working on a small scale dataset, our model was able to overcome such challenges and worked perfect, however in the future, the use of Sci-kit learn GridSerarchCV may be employed to further drive the predictions to a very high comfortable level of confidence.
Please if you find this article interesting, clap for me by clicking the below and don’t forget to drop me a comment!
click here to get the codes for this post https://github.com/rcmolokwu/Image-classification-using-SVM

No comments:

Read Comment Policy ▼
PLEASE NOTE:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.

Post a comment

Post Top Ad




Do you ever witness news or have a story that should be featured on Khorgist ?
Submit your stories, pictures and videos to us now via WhatsApp: +2347064258615, Social Media @khorgist_com: Email: [email protected] More information here.