Orange, an open-source data mining software that supports Python programming interfaces

Source: Internet
Author: User

From: http://www.how2dns.com/blog? P = 352

If you are familiar with Java, we often think of WEKA when thinking about data mining, and the data mining: Practical machine learning tools and techniques written by Ian H. Witten has a Chinese version, so there are many users. Recently, I want to use python to process data and find a data mining software that can be programmed with python. In the previous article "five open source data mining software", we mentioned the open source data mining software orange, @ idmer describes and compares several open source software in this open source data mining tool. Orange is user-friendly and easy to use. It provides a large number of visualization methods and Python programming interfaces, so I decided to try it out.

There are not many Chinese orange documents available on the Internet. This article "mining association rules using Orange" provides an example of using python to call the Apriori algorithm in orange for association analysis, for more details about how to call orange through python, refer to beginning with orange on the official website. the graphic interface does not see the document, but the interface is easy to understand. You can also guess the screenshots in features. Refer to the Classification Section in beginning with orange. Take the example of using naive Bayesian classifer to process the voting. Tab dataset that comes with orange as an example and make a few modifications to the Code:

#-*-Encoding: UTF-8-*-# import the orange package import Orange # import the test data voting. tabdata = Orange. exampletable ("voting") # use naive Bayesian classiferclassifier = Orange. bayeslearner (data) # output all_data = Len (data) Bingo = 0 for D in data: # classifier output class cc = classifier (d) # category OC = d in the original file. getclass () If OC = Cc: Print 'bingo! ', Bingo + = 1 else: print' Oh, no! ', Print "original", OC, "classified as", CC # output classification accuracyprint "CA: %. 4f" % (float (bingo)/all_data)

Run the above code to get the following output:
Bingo! Original Republican classified as Republican
......
Bingo! Original Republican classified as Republican
Bingo! Original Republican classified as Republican
CA: 0.9034
The classification accuracy is ca 0.9034.
Python is very easy to call and only uses a dozen lines of code. However, if you use a graphical interface, you only need to select data-> file for this simple classification, classify-> Naive Bayes and evaluate-> test learners, as shown in. In the file window, set data file to voting. tab to connect the widget with simple drag. Double-click test learners and you can see that the CA is 0.9011.

Comparing the output of Python code with the graphic interface results, we will find that the two results are inconsistent because the graphic interface uses 5-fold Cross verification, and the training data used in the code, if "Test on train data" is selected, the two are the same.

This is simple to use, and further exploration is needed for more complex use.

Related Article

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.