There are three files in ucidata\iris:
index
iris.data
Iris. Name
Index is a folder directory, which lists all files in the folder. For example, the content of index in iris is as follows:
Iris index
18 March 1996 105 index
March 200819934551iris.data
May 30 1989 2604 iris
Iris.data is an Iris data file, which contains the following contents:
Iris 5. 1.3.5,1.4,0.2
4.9,3.0,1.4,0.2, iris
4.7,3.2,1.3,0.2, iris
……
7.0, 3.2, 4.7, 1.4, rainbow color
6.9, 3. 1, 4.9, 1.5, iris-variegated
……
6.3, 3.3, 6.0, 2.5, Iris-Iris littoral
6.4, 3.2, 4.5, 1.5, iris-variegated
5.8, 2.7, 5. 1. 1.9, iris-iris seashore
7. 1,3.0,5.9,2. 1
……
As above, the attributes are separated by commas without spaces (5. 1, 3.5, 1.4, 0.2), and the last column is the corresponding value of the attribute in this row, that is, the decision attribute Iris-setosa.
Iris.names introduces some related information of irir data, such as data title, data source, previous usage, recent information, number of instances, instance attributes, etc. , as shown in the figure below:
……
7. Attribute information:
1. Sepal length, in centimeters.
2. Sepal width, in centimeters
3. Petal length (cm)
4. Petal width (cm)
5. Category:
-Iris
-Iris discoloration
-Iris littoralis
……
9. Stratum distribution: Three strata each account for 33.3%.
Please refer to other papers or the content at the back of this website for examples of using these data.
We import wine data into matlab as an example, and do the test with the libsvm mentioned above.
& gt& gtuiimport('wine.data ')
Import data, and the wine array 178* 14 appears in the workspace.
Extract tags and data attributes under matlab platform and save them in the data.
& gt& gtwine_label = wine(:, 1);
& gt& gtwine_data = wine(:,2:end);
& gt& gt save winedat.mat
(Next time, you can load wine directly with >>.
Svm trained the model to get the wine model.
& gt& gtmodelw = svmtrain(wine_data,wine _ label);
. *
Optimization completed, #iter = 239
nu = 0.892 184
obj = -6 1. 125695,rho = 0. 13 1965
nSV = 130,nBSV = 53
. *
Optimization completed, #iter = 193
nu = 0.882853
obj = -50.42 1538,rho = -0. 166754
nSV = 107,nBSV = 42
. *
Optimization completed, #iter = 2 14.
nu = 0.800233
obj = -53.4 1 1663,rho = -0.28693 1
nSV = 1 19,nBSV = 44
Total nSV = 178
Classification result
& gt& gt[plabelw,accuracy w]= SVM predict(wine _ label,wine_data,modelw);
Accuracy =100% (178/178) (classification)