Python machine learning Kind

Source: Internet
Author: User

Reference: http://my.oschina.net/u/175377/blog/84420

First: Use Sklearn to import very simple famous flower data--Anderson Iris Floral Data set.

We have some measurements of the size of 150 irises: sepals length, width, petal length and width. There are also their sub-genus: The iris setosa, the Iris versicolor, and the Iris virginica Virginia. The data is stored in the. Data entry and is an array (N_samples, n_features). The type of each observation object is stored in the. Target property of the dataset. This is an integer one-dimensional array of length n_samples.

Then the data is trained and predicted by SVM.

#-*-coding:utf-8-*-"""Created on Sat 10:38:57 2015@author:lin"""Print(__doc__) fromSklearnImportDatasetsiris=Datasets.load_iris ()#Print Iris.data #注释掉的几行代码都是用来看iris数据一些相关的属性的#iris.target[[10,25,50]]#print=list (iris.target_names)if __name__=="__main__":     fromSklearnImportSVM CLF=SVM. Linearsvc () Clf.fit (iris.data,iris.target) result=clf.predict ([[6,4,5,1]])    PrintresultPrintClf.coef_

Python machine learning Kind

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.