Support Vector Machine (With Python) Tutorial 3 Yang

Total Page:16

File Type:pdf, Size:1020Kb

Support Vector Machine (With Python) Tutorial 3 Yang Support Vector Machine (with Python) Tutorial 3 Yang 1 Outlines Through this tutorial, you will better know: What is Support Vector Machine The SVM in Scikit-learn – C-Support Vector Classification The method to train the SVM – SMO algorithm The parameters in SVC How to use the Sickit-learn.SVM Other SVMs in Scikit-learn 2 Linear model Support vector machine: Margin: the smallest distance between the decision boundary and any of the samples maximizing the margin ⇒ a particular decision boundary Location of boundary is determined by support vectors H1 H Linear separable - Canonical representation: H2 1 1 2 푤 arg min 푤 , Class B 2 푠. 푡. 푡푛 푤 ∗ 푥푖 + 푏 ≥ 1, 푛 = 1,2, … , 푁 Support vectors 1 푇 - By Lagrangian, its dual form (QP problem) 푤 푤 푥 + 푏 = 1 푁 푁 푁 1 2 min 휓 푎 = min 푡푛푡푚(푥푛 ∙ 푥푚) 푎푛푎푚 − 푎푛 , 훼 훼 2 Class A 푤 푛=1 푚=1 푛=1 푠. 푡. 푎 ≥ 0, 푛 = 1,2, … , 푁, 푇 푛 푇 푤 푥 + 푏 = 0 푁 푤 푥 + 푏 = −1 푛=1 푎푛푡푛 = 0. 3 Nonlinear model Soft margin: H H1 Slack variables 휉푛 ≥ 0, 푛 = 1, … , 푁 Class B Maximize the margin while softly ퟎ < 흃 < ퟏ 흃 > ퟏ penalizing incorrect points 흃 = ퟎ 1 2 푁 arg min 푤 + 퐶 휉 , 2 푛=1 푛 푤푇푥 + 푏 = 1 Class A 푠. 푡. 푡푛 푤 ∗ 푥푖 + 푏 ≥ 1 − 휉푛, 푛 = 1, … , 푁. 푇 푇 The corresponding dual form by 푤 푥 + 푏 = −1 푤 푥 + 푏 = 0 Lagrangian: 1 푁 푁 푁 min 휓 푎 = min 푛=1 푚=1 푡푛푡푚푘(푥푛, 푥푚) 푎푛푎푚 − 푛=1 푎푛 , 훼 훼 2 푠. 푡. 0 ≤ 푎푛 ≤ 퐶, 푛 = 1,2, … , 푁, 퐶 controls Trade-off between the 푁 slack variable penalty and the margin 푎 푡 = 0. 푛=1 푛 푛 4 Kernel Method The kernel trick (kernel substitution) map the inputs into high-dimensional feature spaces properly solve the problems of high complexity and computation caused by inner product Example: kernel function-- 푘 푋푖, 푋푗 = 휙(푋푖) ∙ 휙(푋푗) Defined two vectors: 푥 = (푥1, 푥2, 푥3); 푦 = 푦1, 푦2, 푦3 Defined the equations: 푓 푥 = (푥1푥1, 푥1푥2, 푥1푥3, 푥2푥1, 푥2푥2, 푥2푥3, 푥3푥1, 푥3푥2, 푥3푥3), 퐾 푥, 푦 = < 푥, 푦 > 2, Assume 푥 = 1, 2, 3 , 푦 = (4, 5, 6) 푓 푥 = 1, 2, 3, 2, 4, 6, 3, 6, 9 , 푓 푦 = 16, 20, 24, 20, 25, 36, 24, 30, 36 , < 푓 푥 , 푓 푦 >= 16 + 40 + 72 + 40 + 100 + 180 + 72 + 180 + 324 = 1024, 퐾 푥, 푦 = 4 + 10 + 18 2 = 1024. Kernel is much simpler 5 sklearn.svm.SVC C-Support Vector Classification: ̶ The implementation is based on libsvm. The fit time complexity is more than quadratic with the number of samples which makes it hard to scale to dataset with more than a couple of 10000 samples. ̶ The multiclass support is handled according to a one-vs-one scheme LibSVM: ̶ LIBSVM implements the SMO algorithm for kernelized support vector machines (SVMs), supporting classification and regression.[1] [1] Chang, Chih-Chung; Lin, Chih-Jen (2011). "LIBSVM: A library for support vector machines". ACM Transactions on Intelligent Systems and Technology. 2 (3). 6 SMO Algorithm Sequential Minimal Optimization[2]: • A Fast Algorithm for Training Support Vector Machines • Quickly solve the SVM quadratic programming (QP) problem • The main steps: Repeat till convergence { 1. Select some pair 푎푖 and 푎푗 to update next (using a heuristic that tries to pick the two that will allow us to make the biggest progress towards the global maximum). 2. Reoptimize Ψ(푎 ) with respect to 푎푖 and 푎푗, while holding all the other 푎푘’s (푘 ≠ 푖, 푗) fixed. } [2] Platt, John. "Sequential minimal optimization: A fast algorithm for training support vector machines." (1998). 7 Parameters of SVC 푪: Penalty parameter 퐶 of the error term, tol: Tolerance for stopping criterion controls trade-off between the penalty and the Cache_size: Specify the size of the kernel cache margin, default=1.0 class_weight: set different penalty for different Kernel: ‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, data classes by the class weight values ‘precomputed’, default= ‘rbf’ verbose:Enable verbose output, if enabled, may degree: Degree of the polynomial kernel function not work properly in a multithreaded context gamma: Kernel coefficient(‘rbf’, ‘poly’ and max_iter: Hard limit on iterations within solver, or ‘sigmoid’), gamma=auto means 1/n_features -1 for no limit coef0: Independent term in kernel function. It is decision_function_shape: for multiple only significant in ‘poly’ and ‘sigmoid’. classifications, ovo for one-vs-one, ovr for one-vs- probability: whether to enable probability rest estimates (true or false) random_state: The seed of the pseudo random shrinking: Whether to use the shrinking heuristic number generator to use when shuffling the data http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html 8 Kernel selection Linear kernel: Choose based on the accuracy ′ ̶ Linear: 푢 ∗ 푣 Mainly for linear classification, it has fewer parameters, computing fast Nonlinear kernel ′ 푑푒푔푟푒푒 ̶ Polynomial: 훾 ∗ 푢 ∗ 푣 + 푐표푒푓0 More parameters so take more 2 time for computing, however, ̶ rbf: exp −훾 ∗ 푢 − 푣 better performance with properly- ′ ̶ Sigmoid: tanh(훾 ∗ 푢 ∗ 푣 + 푐표푒푓0) tuned parameters 퐶: the penalty coefficient, low 퐶 makes the decision surface smooth, high 퐶 aims at classifying all training examples correctly 훾(푔푎푚푚푎): defines how far the influence of a single training example reaches, low values mean ‘far’ and high values mean ‘close’. 9 Example-SVC import matplotlib.pyplot as plt from sklearn.svm import SVC y1=y.copy() import numpy as np a=np.hstack((X,y1.reshape(4,1))) X=np.array([[-1,-1],[-2,-1],[1,1],[2,1]]) for i in range(len(a)): y=np.array([1,1,2,2]) if a[i,2]==1: plt.plot(a[i,0],a[i,1], 'b*') clf=SVC(kernel='linear') else: clf.fit(X,y) plt.plot(a[i,0],a[i,1], 'rx') print(clf.fit(X,y)) plt.plot(-0.8, -1,'bo') print(clf.predict([[-0.8,-1]])) w=clf.coef_[0] #Only for linear kernel xx=np.linspace(-2,2) yy=-(w[0]*xx+clf.intercept_[0])/w[1] plt.plot(xx, yy, ‘k-’, label=‘$hyperplane$’) plt.legend() plt.savefig(path+’¥¥SVM.png’) plt.show() 10 Exercise1-Linear model-Tasks First load the training data and testing data of a linear example Create a SVM by SVC Train the SVM model by the data in training file Classify the data in test file Plot the figure of data points and the hyperplane Pls change the parameter C and observe 11 Exercise 1-Linear model(1) import numpy as np # introduce the SVC import pandas as pd clf=SVC(C=10, kernel='linear') from sklearn.svm import SVC clf.fit(train_x, train_y) from sklearn import metrics Test_y=pd.Series(clf.predict(test_x), name='Y') import matplotlib.pyplot as plt import os print('Classification report for classifier %s:¥n%s¥n' % (clf, metrics.classification_report(test_y, # load data Test_y))) path=os.getcwd() print("Confusion matrix:¥n%s" % traindata=pd.read_csv(path+'¥¥traindata.csv') metrics.confusion_matrix(test_y, Test_y)) train_x=traindata.iloc[:, :-1] train_y=traindata.iloc[:, -1] testdata=pd.read_csv(path+'¥¥testdata.csv') test_x=testdata.iloc[:, :-1] test_y=testdata.iloc[:, -1] 12 Exercise 1-Linear model(2) #plot the training data #plot the hyperplane label=train_y.copy() w=clf.coef_[0] label[label<0]=0 xx=np.linspace(-2, 2) label=label.astype(int) yy=-(w[0]*xx+clf.intercept_[0])/w[1] label=label.values plt.axis([-2, 2, -2, 2]) colormap=np.array(['r','b']) plt.plot(xx, yy, 'k-', label='$hyperplane$') plt.scatter(train_x.iloc[:,0], train_x.iloc[:,1], zorder=3, marker='o', c=colormap[label], #calculate the bias of margins label='traindata') margin=1/np.sqrt(np.sum(clf.coef_**2)) yy_down=yy-np.sqrt(1+(w[0]/w[1])**2)*margin #plot the support vectors yy_up=yy+np.sqrt(1+(w[0]/w[1])**2)*margin plt.scatter(clf.support_vectors_[:,0], #plot margins clf.support_vectors_[:,1],zorder=2,facecolors plt.plot(xx, yy_down, 'k--') ='none', s=80, edgecolors='k', label='Support plt.plot(xx, yy_up, 'k--') Vectors') 13 Exercise 1-Linear model(3) #plot the test data set labelt=test_y.copy() labelt[labelt<0]=0 labelt=labelt.astype(int) labelt=labelt.values plt.scatter(test_x.iloc[:,0], test_x.iloc[:,1], zorder=3, marker='+', c=colormap[labelt], label='testdata') plt.legend(loc=[0.26,0.01]) plt.savefig(path+'¥¥svc-linear.png') plt.show() 14 Exercise 2-nonlinear model-Tasks First load the training data and testing data of a nonlinear example Create a SVM by SVC with three kernels Train the SVM model by the data in training file Classify the data in test file Plot the figure of data points and the hyperplane Pls change the parameter Change parameter C and observe Change parameter 훾 and observe 15 Exercise 2-nonlinear model(1) import numpy as np # introduce the SVC and fit the model import pandas as pd for fig_n, kernel in enumerate(('linear', 'rbf', 'poly')): from sklearn.svm import SVC clf=SVC(C=1.0, kernel=kernel, gamma=10) import matplotlib.pyplot as plt clf.fit(train_x, train_y) import os print('Classification report: %s¥nAccuracy rate:%s¥n' # load data % (clf, clf.score(test_x, test_y))) path=os.getcwd() traindata=pd.read_csv(path+'¥¥traindata.csv') #plot new window for figure train_x=traindata.iloc[:, :-1] plt.figure(fig_n) train_y=traindata.iloc[:, -1] #clear the current figure testdata=pd.read_csv(path+'¥¥testdata.csv') plt.clf() test_x=testdata.iloc[:, :-1] test_y=testdata.iloc[:, -1] 16 Exercise 2-nonlinear model(2) #plot the train data plt.scatter(train_x.iloc[:,0], train_x.iloc[:,1], c=train_y.iloc[:], cmap=plt.cm.Paired, edgecolor='k', zorder=10, s=20) #plot the support vectors plt.scatter(clf.support_vectors_[:,0], clf.support_vectors_[:,1], s=80, facecolors='none', zorder=10, edgecolors='k') plt.axis('tight') x_min, x_max = train_x.iloc[:,0].min()-1, train_x.iloc[:,0].max()+1 y_min, y_max= train_x.iloc[:,1].min()-1, train_x.iloc[:,1].max()+1 # create a mesh to plot in XX, YY = np.mgrid[x_min:x_max:200j, y_min:y_max:200j] Z = clf.decision_function(np.c_[XX.ravel(), YY.ravel()]) 17 Exercise 2-nonlinear model(3) # Put the
Recommended publications
  • Quick Tour of Machine Learning (機器 )
    Quick Tour of Machine Learning (_hx習速遊) Hsuan-Tien Lin (林軒0) [email protected] Department of Computer Science & Information Engineering National Taiwan University (國Ë台c'xÇ訊工程û) Ç料科x愛}者t會û列;動, 2015/12/12 Hsuan-Tien Lin (NTU CSIE) Quick Tour of Machine Learning 0/128 Learning from Data Disclaimer just super-condensed and shuffled version of • • my co-authored textbook “Learning from Data: A Short Course” • my two NTU-Coursera Mandarin-teaching ML Massive Open Online Courses • “Machine Learning Foundations”: www.coursera.org/course/ntumlone • “Machine Learning Techniques”: www.coursera.org/course/ntumltwo —impossible to be complete, with most math details removed live interaction is important • goal: help you begin your journey with ML Hsuan-Tien Lin (NTU CSIE) Quick Tour of Machine Learning 1/128 Learning from Data Roadmap Learning from Data What is Machine Learning Components of Machine Learning Types of Machine Learning Step-by-step Machine Learning Hsuan-Tien Lin (NTU CSIE) Quick Tour of Machine Learning 2/128 Learning from Data What is Machine Learning Learning from Data :: What is Machine Learning Hsuan-Tien Lin (NTU CSIE) Quick Tour of Machine Learning 3/128 learning: machine learning: Learning from Data What is Machine Learning From Learning to Machine Learning learning: acquiring skill with experience accumulated from observations observations learning skill machine learning: acquiring skill with experience accumulated/computed from data data ML skill What is skill? Hsuan-Tien Lin (NTU CSIE) Quick Tour of Machine Learning 4/128 , machine learning: Learning from Data What is Machine Learning A More Concrete Definition skill improve some performance measure (e.g.
    [Show full text]
  • Understanding Support Vector Machines
    Chapter 7 Applying the same steps to compare the predicted values to the true values, we now obtain a correlation around 0.80, which is a considerable improvement over the previous result: > model_results2 <- compute(concrete_model2, concrete_test[1:8]) > predicted_strength2 <- model_results2$net.result > cor(predicted_strength2, concrete_test$strength) [,1] [1,] 0.801444583 Interestingly, in the original publication, I-Cheng Yeh reported a mean correlation of 0.885 using a very similar neural network. For some reason, we fell a bit short. In our defense, he is a civil engineering professor; therefore, he may have applied some subject matter expertise to the data preparation. If you'd like more practice with neural networks, you might try applying the principles learned earlier in this chapter to beat his result, perhaps by using different numbers of hidden nodes, applying different activation functions, and so on. The ?neuralnet help page provides more information on the various parameters that can be adjusted. Understanding Support Vector Machines A Support Vector Machine (SVM) can be imagined as a surface that defnes a boundary between various points of data which represent examples plotted in multidimensional space according to their feature values. The goal of an SVM is to create a fat boundary, called a hyperplane, which leads to fairly homogeneous partitions of data on either side. In this way, SVM learning combines aspects of both the instance-based nearest neighbor learning presented in Chapter 3, Lazy Learning – Classifcation Using Nearest Neighbors, and the linear regression modeling described in Chapter 6, Forecasting Numeric Data – Regression Methods. The combination is extremely powerful, allowing SVMs to model highly complex relationships.
    [Show full text]
  • Using a Support Vector Machine to Analyze a DNA Microarray∗
    Using a Support Vector Machine to Analyze a DNA Microarray∗ R. Morelli Department of Computer Science, Trinity College Hartford, CT 06106, USA [email protected] January 15, 2008 1 Introduction A DNA microarray is a small silicon chip that is covered with thousands of spots of DNA of known sequence. Biologists use microarrays to study gene expression patterns in a wide range of medical and scientific applications. Analysis of microarrays has led to discovery of genomic patterns that distinguish cancerous from non-cancerous cells. Other researchers have used microarrays to identify the genes in the brains of fish that are associated with certain kinds of mating behavior. Microarray data sets are very large and can only be analyzed with the help of computers. A support vector machine (SVM) is a powerful machine learning technique that is used in a variety of data mining applications, including the analysis of DNA microarrays. 2 Project Overview In this project we will learn how to use an SVM to recognize patterns in microarray data. Using an open source software package named libsvm and downloaded data from a cancer research project, we will to train an SVM to distinguish between gene expression patterns that are associated with two different forms of leukemia. Although this project will focus on SVMs and machine learning techniques, we will cover basic concepts in biology and genetics that underlie DNA analysis. We will gain experience using SVM software and emerge from this project with an improved understanding of how machine learning can be used to recognize important patterns in vast amounts of data.
    [Show full text]
  • Arxiv:1612.07993V1 [Stat.ML] 23 Dec 2016 Until Recently, No Package Providing Multiple Semi-Supervised Learning Meth- Ods Was Available in R
    RSSL: Semi-supervised Learning in R Jesse H. Krijthe1,2 1 Pattern Recognition Laboratory, Delft University of Technology 2 Department of Molecular Epidemiology, Leiden University Medical Center [email protected] Abstract. In this paper, we introduce a package for semi-supervised learning research in the R programming language called RSSL. We cover the purpose of the package, the methods it includes and comment on their use and implementation. We then show, using several code examples, how the package can be used to replicate well-known results from the semi-supervised learning literature. Keywords: Semi-supervised Learning, Reproducibility, Pattern Recog- nition, R Introduction Semi-supervised learning is concerned with using unlabeled examples, that is, examples for which we know the values for the input features but not the corre- sponding outcome, to improve the performance of supervised learning methods that only use labeled examples to train a model. An important motivation for investigations into these types of algorithms is that in some applications, gath- ering labels is relatively expensive or time-consuming, compared to the cost of obtaining an unlabeled example. Consider, for instance, building a web-page classifier. Downloading millions of unlabeled web-pages is easy. Reading them to assign a label is time-consuming. Effectively using unlabeled examples to improve supervised classifiers can therefore greatly reduce the cost of building a decently performing prediction model, or make it feasible in cases where labeling many examples is not a viable option. While the R programming language [] offers a rich set of implementations of a plethora of supervised learning methods, brought together by machine learning packages such as caret and mlr there are fewer implementations of methods that can deal with the semi-supervised learning setting.
    [Show full text]
  • Xgboost: a Scalable Tree Boosting System
    XGBoost: A Scalable Tree Boosting System Tianqi Chen Carlos Guestrin University of Washington University of Washington [email protected] [email protected] ABSTRACT problems. Besides being used as a stand-alone predictor, it Tree boosting is a highly effective and widely used machine is also incorporated into real-world production pipelines for learning method. In this paper, we describe a scalable end- ad click through rate prediction [15]. Finally, it is the de- to-end tree boosting system called XGBoost, which is used facto choice of ensemble method and is used in challenges widely by data scientists to achieve state-of-the-art results such as the Netflix prize [3]. on many machine learning challenges. We propose a novel In this paper, we describe XGBoost, a scalable machine learning system for tree boosting. The system is available sparsity-aware algorithm for sparse data and weighted quan- 2 tile sketch for approximate tree learning. More importantly, as an open source package . The impact of the system has we provide insights on cache access patterns, data compres- been widely recognized in a number of machine learning and sion and sharding to build a scalable tree boosting system. data mining challenges. Take the challenges hosted by the machine learning competition site Kaggle for example. A- By combining these insights, XGBoost scales beyond billions 3 of examples using far fewer resources than existing systems. mong the 29 challenge winning solutions published at Kag- gle's blog during 2015, 17 solutions used XGBoost. Among these solutions, eight solely used XGBoost to train the mod- Keywords el, while most others combined XGBoost with neural net- Large-scale Machine Learning s in ensembles.
    [Show full text]
  • LIBSVM: a Library for Support Vector Machines
    LIBSVM: A Library for Support Vector Machines Chih-Chung Chang and Chih-Jen Lin Department of Computer Science National Taiwan University, Taipei, Taiwan Email: [email protected] Initial version: 2001 Last updated: January 20, 2021 Abstract LIBSVM is a library for Support Vector Machines (SVMs). We have been actively developing this package since the year 2000. The goal is to help users to easily apply SVM to their applications. LIBSVM has gained wide popu- larity in machine learning and many other areas. In this article, we present all implementation details of LIBSVM. Issues such as solving SVM optimiza- tion problems, theoretical convergence, multi-class classification, probability estimates, and parameter selection are discussed in detail. Keywords: Classification, LIBSVM, optimization, regression, support vector ma- chines, SVM 1 Introduction Support Vector Machines (SVMs) are a popular machine learning method for classifi- cation, regression, and other learning tasks. Since the year 2000, we have been devel- oping the package LIBSVM as a library for support vector machines. The Web address of the package is at http://www.csie.ntu.edu.tw/~cjlin/libsvm. LIBSVM is cur- rently one of the most widely used SVM software. In this article,1 we present all implementation details of LIBSVM. However, this article does not intend to teach the practical use of LIBSVM. For instructions of using LIBSVM, see the README file included in the package, the LIBSVM FAQ,2 and the practical guide by Hsu et al. (2003). An earlier version of this article was published in Chang and Lin (2011). LIBSVM supports the following learning tasks.
    [Show full text]
  • Scikit-Learn
    Scikit-Learn i Scikit-Learn About the Tutorial Scikit-learn (Sklearn) is the most useful and robust library for machine learning in Python. It provides a selection of efficient tools for machine learning and statistical modeling including classification, regression, clustering and dimensionality reduction via a consistence interface in Python. This library, which is largely written in Python, is built upon NumPy, SciPy and Matplotlib. Audience This tutorial will be useful for graduates, postgraduates, and research students who either have an interest in this Machine Learning subject or have this subject as a part of their curriculum. The reader can be a beginner or an advanced learner. Prerequisites The reader must have basic knowledge about Machine Learning. He/she should also be aware about Python, NumPy, Scipy, Matplotlib. If you are new to any of these concepts, we recommend you take up tutorials concerning these topics, before you dig further into this tutorial. Copyright & Disclaimer Copyright 2019 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial.
    [Show full text]
  • Liblinear: a Library for Large Linear Classification
    Journal of Machine Learning Research 9 (2008) 1871-1874 Submitted 5/08; Published 8/08 LIBLINEAR: A Library for Large Linear Classification Rong-En Fan [email protected] Kai-Wei Chang [email protected] Cho-Jui Hsieh [email protected] Xiang-Rui Wang [email protected] Chih-Jen Lin [email protected] Department of Computer Science National Taiwan University Taipei 106, Taiwan Editor: Soeren Sonnenburg Abstract LIBLINEAR is an open source library for large-scale linear classification. It supports logistic regres- sion and linear support vector machines. We provide easy-to-use command-line tools and library calls for users and developers. Comprehensive documents are available for both beginners and advanced users. Experiments demonstrate that LIBLINEAR is very efficient on large sparse data sets. Keywords: large-scale linear classification, logistic regression, support vector machines, open source, machine learning 1. Introduction Solving large-scale classification problems is crucial in many applications such as text classification. Linear classification has become one of the most promising learning techniques for large sparse data with a huge number of instances and features. We develop LIBLINEAR as an easy-to-use tool to deal with such data. It supports L2-regularized logistic regression (LR), L2-loss and L1-loss linear support vector machines (SVMs) (Boser et al., 1992). It inherits many features of the popular SVM library LIBSVM (Chang and Lin, 2001) such as simple usage, rich documentation, and open source license (the BSD license1). LIBLINEAR is very efficient for training large-scale problems. For example, it takes only several seconds to train a text classification problem from the Reuters Corpus Volume 1 (rcv1) that has more than 600,000 examples.
    [Show full text]
  • Release 0.80 Xgboost Developers
    xgboost Release 0.80 xgboost developers Sep 28, 2018 Contents 1 Contents 3 1.1 Installation Guide............................................3 1.2 Get Started with XGBoost........................................ 10 1.3 XGBoost Tutorials............................................ 12 1.4 Frequently Asked Questions....................................... 30 1.5 XGBoost GPU Support......................................... 32 1.6 XGBoost Parameters........................................... 34 1.7 XGBoost Python Package........................................ 42 1.8 XGBoost R Package........................................... 64 1.9 XGBoost JVM Package......................................... 81 1.10 XGBoost.jl................................................ 96 1.11 XGBoost Command Line version.................................... 96 1.12 Contribute to XGBoost.......................................... 96 Python Module Index 101 i ii xgboost, Release 0.80 XGBoost is an optimized distributed gradient boosting library designed to be highly efficient, flexible and portable. It implements machine learning algorithms under the Gradient Boosting framework. XGBoost provides a parallel tree boosting (also known as GBDT, GBM) that solve many data science problems in a fast and accurate way. The same code runs on major distributed environment (Hadoop, SGE, MPI) and can solve problems beyond billions of examples. Contents 1 xgboost, Release 0.80 2 Contents CHAPTER 1 Contents 1.1 Installation Guide Note: Pre-built binary wheel for Python If you are planning to use Python, consider installing XGBoost from a pre-built binary wheel, available from Python Package Index (PyPI). You may download and install it by running # Ensure that you are downloading one of the following: # * xgboost-{version}-py2.py3-none-manylinux1_x86_64.whl # * xgboost-{version}-py2.py3-none-win_amd64.whl pip3 install xgboost • The binary wheel will support GPU algorithms (gpu_exact, gpu_hist) on machines with NVIDIA GPUs. How- ever, it will not support multi-GPU training; only single GPU will be used.
    [Show full text]
  • How Machine Learning Has Been Applied in Software Engineering?
    How Machine Learning Has Been Applied in Software Engineering? Olimar Teixeira Borges a, Julia Colleoni Couto b, Duncan Dubugras A. Ruiz c and Rafael Prikladnicki1 d School of Technology, PUCRS, Porto Alegre, Brazil Keywords: Software Engineering, Machine Learning, Mapping Study. Abstract: Machine Learning (ML) environments are composed of a set of techniques and tools, which can help in solving problems in a diversity of areas, including Software Engineering (SE). However, due to a large number of possible configurations, it is a challenge to select the ML environment to be used for a specific SE domain issue. Helping software engineers choose the most suitable ML environment according to their needs would be very helpful. For instance, it is possible to automate software tests using ML models, where the model learns software behavior and predicts possible problems in the code. In this paper, we present a mapping study that categorizes the ML techniques and tools reported as useful to solve SE domain issues. We found that the most used algorithm is Na¨ıve Bayes and that WEKA is the tool most SE researchers use to perform ML experiments related to SE. We also identified that most papers use ML to solve problems related to SE quality. We propose a categorization of the ML techniques and tools that are applied in SE problem solving, linking with the Software Engineering Body of Knowledge (SWEBOK) knowledge areas. 1 INTRODUCTION automated to reduce human effort and project cost. However, to automate these tasks using ML, we need Machine Learning (ML) is an Artificial Intelligence to have the SE project’s data to explore.
    [Show full text]
  • Implementation of Machine Learning Algorithms for Different Datasets Using Python Programming Language
    International Journal of Scientific & Engineering Research Volume 10, Issue 1, January-2019 1318 ISSN 2229-5518 Implementation of machine learning algorithms for different datasets using python programming language. Renuka sagar, Dr U Eranna Abstract— WSNs have tremendous potential for building powerful applications, each with its own individual characteristics and requirements. Developing efficient algorithms that are suitable for many different application scenarios is a challenging task. .sensor network designers characterize machine learning as a collection of tools and algorithms that are used to create prediction models. However, machine learning experts recognize it as a rich field with very large themes and patterns. machine learning algorithms provide tremendous flexibility benefits. machine learning algorithms can be categorized by the intended structure of the model. Most machine learning algorithms fall into the categories of supervised, unsupervised and reinforcement learning. In the first category, machine learning algorithms are provided with a labeled training data set. This set is used to build the system model representing the learned relation between the input, output and system parameters. In contrast to supervised learning, unsupervised learning algorithms are not provided with labels (i.e., there is no output vector). Basically, the goal of an unsupervised learning algorithm is to classify the sample sets Index Terms—accuracy, datasets, kmeans, logistic regression, knn algorithm, supervised, unsupervised. INTRODUCTION: learning, unsupervised learning algorithms are not provided with labels (i.e., there is no output vector). Basically, the goal of Wireless sensor network (WSN) is composed typically of an unsupervised learning algorithm is to classify the sample multiple autonomous, tiny, low cost and low power sensor sets to different groups (i.e., clusters) by investigating the nodes.
    [Show full text]
  • High Performance Implementation of Support Vector Machines Using Opencl
    Rochester Institute of Technology RIT Scholar Works Theses 5-2014 High Performance Implementation of Support Vector Machines Using OpenCL Ethan Peters Follow this and additional works at: https://scholarworks.rit.edu/theses Recommended Citation Peters, Ethan, "High Performance Implementation of Support Vector Machines Using OpenCL" (2014). Thesis. Rochester Institute of Technology. Accessed from This Thesis is brought to you for free and open access by RIT Scholar Works. It has been accepted for inclusion in Theses by an authorized administrator of RIT Scholar Works. For more information, please contact [email protected]. High Performance Implementation of Support Vector Machines Using OpenCL by Ethan Peters A Thesis Submitted in Partial Fulfillment of the Requirements for the Degree of Master of Science in Computer Engineering Supervised by Professor Dr. Andreas Savakis Department of Computer Engineering Kate Gleason College of Engineering Rochester Institute of Technology Rochester, New York May 2014 Approved by: Dr. Andreas Savakis, Professor Thesis Advisor, Department of Computer Engineering Dr. Muhammad Shaaban, Associate Professor Committee Member, Department of Computer Engineering Dr. Sonia Lopez Alarcon, Assistant Professor Committee Member, Department of Computer Science Thesis Release Permission Form Rochester Institute of Technology Kate Gleason College of Engineering Title: High Performance Implementations of Support Vector Machines Using OpenCL on Heterogeneous Systems I, Ethan Peters, hereby grant permission to the Wallace Memorial Library to reproduce my thesis in whole or part. Ethan Peters Date iii Dedication This thesis is dedicated to my wife Cassandra Madison-Peters, without whose encouragement this work would not have been possible. I would also like to dedicate this work to my family, who have supported me throughout my academic career.
    [Show full text]