<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Machine Learning on Simplestory</title><link>https://simplestory.github.io/en/tags/machine-learning/</link><description>Recent content in Machine Learning on Simplestory</description><generator>Hugo</generator><language>en-us</language><copyright>Simplestory</copyright><lastBuildDate>Sun, 24 Mar 2019 00:00:00 +0000</lastBuildDate><atom:link href="https://simplestory.github.io/en/tags/machine-learning/index.xml" rel="self" type="application/rss+xml"/><item><title>LightGBM Model</title><link>https://simplestory.github.io/en/posts/20190324_161af8745042398050ad585874c3eec3/</link><pubDate>Sun, 24 Mar 2019 00:00:00 +0000</pubDate><guid>https://simplestory.github.io/en/posts/20190324_161af8745042398050ad585874c3eec3/</guid><description>A Highly Efficient Gradient Boosting Decision Tree</description></item><item><title>Xgboost Model</title><link>https://simplestory.github.io/en/posts/20190317_8fc39e31f30337e40756914df1f8b607/</link><pubDate>Sun, 17 Mar 2019 00:00:00 +0000</pubDate><guid>https://simplestory.github.io/en/posts/20190317_8fc39e31f30337e40756914df1f8b607/</guid><description>A Scalabe Tree Boosting Systeam</description></item><item><title>How the FFM Model Works</title><link>https://simplestory.github.io/en/posts/20181028_fa81994273e28bed9a6b443a7af7f69e/</link><pubDate>Sun, 28 Oct 2018 00:00:00 +0000</pubDate><guid>https://simplestory.github.io/en/posts/20181028_fa81994273e28bed9a6b443a7af7f69e/</guid><description>&lt;blockquote&gt;
&lt;p&gt;CTR (click-through rate) prediction plays an important role in content recommendation and delivery, and the FFM model is good at handling this kind of data. The FFM model is a variant of the FM model, or rather the FM model is a special case of the FFM model&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="rough-pipeline"&gt;Rough pipeline&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Convert the dataset format (using the LIBSVM or FFMs style)&lt;/li&gt;
&lt;li&gt;Compute the loss function (using the exponential loss function)&lt;/li&gt;
&lt;li&gt;Optimize the parameters (using the AdaGrad + SG strategy)&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="converting-the-data-format"&gt;Converting the data format&lt;/h2&gt;
&lt;p&gt;LIBSVM format (does not store zero-valued features):&lt;/p&gt;</description></item><item><title>Decision Tree</title><link>https://simplestory.github.io/en/posts/20180829_3cb42cd7fd688b586f483bd682fc8209/</link><pubDate>Wed, 29 Aug 2018 00:00:00 +0000</pubDate><guid>https://simplestory.github.io/en/posts/20180829_3cb42cd7fd688b586f483bd682fc8209/</guid><description>&lt;blockquote&gt;
&lt;p&gt;Decision tree, a common machine learning method, is somewhat like a flowchart. A sample is divided into a set according to the value it takes on some feature, and this is done recursively&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="basic-algorithm"&gt;Basic algorithm&lt;/h1&gt;
&lt;p&gt;Input: training set $D=\\{(\mathbf{x_1},y_1),(\mathbf{x_2},y_2),...,(\mathbf{x_m},y_m)\\}$;
attribute set $A=\\{a_1,a_2,...,a_d\\}$&lt;/p&gt;
&lt;p&gt;Output: a decision tree with node as the root node&lt;/p&gt;
&lt;p&gt;Simple process:&lt;/p&gt;
&lt;p&gt;Using some splitting criterion, the optimal feature is selected to split the samples, and this is done recursively, finally yielding the branch nodes of the decision tree&lt;/p&gt;</description></item><item><title>A Scikit-learn Cheat Sheet Collection</title><link>https://simplestory.github.io/en/posts/20180826_8cb44c1627565d8ede47d43e49e9c8ae/</link><pubDate>Sun, 26 Aug 2018 00:00:00 +0000</pubDate><guid>https://simplestory.github.io/en/posts/20180826_8cb44c1627565d8ede47d43e49e9c8ae/</guid><description>&lt;blockquote&gt;
&lt;p&gt;This time I am putting together the commonly used scikit-learn packages as a memo&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;K-nearest neighbors:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html"&gt;from sklearn.neighbors import KNeighborsClassifier&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Linear regression:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html"&gt;from sklearn.linear_model import LinearRegression&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Logistic regression:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html"&gt;from sklearn.linear_model import LogisticRgression&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Decision tree:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html"&gt;from sklearn.tree import DecisionTreeClassifier&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Naive Bayes:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Gaussian distribution: &lt;a href="http://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.GaussianNB.html"&gt;from sklearn.neive_bayes import GaussianNB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Multinomial distribution: &lt;a href="http://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.MultinomialNB.html#sklearn.naive_bayes.MultinomialNB"&gt;from sklearn.neive_baybes import MultinomnalNB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Bernoulli distribution: &lt;a href="http://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.BernoulliNB.html#sklearn.naive_bayes.BernoulliNB"&gt;from sklearn.neive_baybes import BernoulliNB&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Support vector machine:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Classification: &lt;a href="http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html"&gt;from sklearn.svm import SVC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Regression: &lt;a href="http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVR.html"&gt;from sklearn.svm import SVR&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Ensemble algorithms (sklearn.ensemble):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;bagging:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Classification: &lt;a href="http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.BaggingClassifier.html"&gt;from sklearn.ensemble import BaggingClassifier&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Bayesian Classification</title><link>https://simplestory.github.io/en/posts/20180819_72c962ee57eaf5ebe2b4645dd6827ce3/</link><pubDate>Sun, 19 Aug 2018 00:00:00 +0000</pubDate><guid>https://simplestory.github.io/en/posts/20180819_72c962ee57eaf5ebe2b4645dd6827ce3/</guid><description>&lt;blockquote&gt;
&lt;p&gt;Bayesian decision theory considers how to choose the optimal class label based on the relevant probabilities and misclassification losses&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Suppose there are N possible class labels, that is $\mathbf{y}=\\{c_1,c_2,...,c_N\\}$, and $\lambda_{ij}$ is the loss incurred by misclassifying a sample whose true label is $c_j$ as $c_i$. Based on the posterior probability $P(c_i\vert\mathbf{x})$, we can obtain the expected loss incurred by classifying sample $\mathbf{x}$ as $c_i$, that is, the &amp;ldquo;conditional risk&amp;rdquo; on sample $\mathbf{x}$:&lt;/p&gt;</description></item><item><title>SVM Support Vector Machine</title><link>https://simplestory.github.io/en/posts/20180816_7ed73172fd758adf99c76ebc108ea063/</link><pubDate>Thu, 16 Aug 2018 00:00:00 +0000</pubDate><guid>https://simplestory.github.io/en/posts/20180816_7ed73172fd758adf99c76ebc108ea063/</guid><description>&lt;blockquote&gt;
&lt;p&gt;SVM is a very important model in machine learning, proposed by Vladimir Vapnik, the father of statistical learning theory&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;This post takes binary classification with SVM as the example&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="derivation"&gt;Derivation&lt;/h2&gt;
&lt;p&gt;Given the training dataset $D=\\{(\mathbf{x_1},y_1),(\mathbf{x_2},y_2),...,(\mathbf{x_m},y_m)\\}, y_i \in \\{-1, +1\\}$, the most basic idea of a classifier is to find in the sample space a dividing space based on the training set D that separates the samples of different classes. The dividing hyperplane can be described by the following linear equation:&lt;/p&gt;</description></item><item><title>Linear Regression and Logistic Regression</title><link>https://simplestory.github.io/en/posts/20180813_135c495c1e86bceb067f1bc3135c278b/</link><pubDate>Mon, 13 Aug 2018 00:00:00 +0000</pubDate><guid>https://simplestory.github.io/en/posts/20180813_135c495c1e86bceb067f1bc3135c278b/</guid><description>&lt;blockquote&gt;
&lt;p&gt;I have not updated the blog for a long time, having paused for about half a year, and I have also read half a year&amp;rsquo;s worth of books on machine learning and deep learning; now it is time to write some output&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="linear-regression"&gt;Linear regression&lt;/h1&gt;
&lt;p&gt;Given a dataset $D=\\{(\mathbf{x_1},y_1),(\mathbf{x_2},y_2),...,(\mathbf{x_m},y_m)\\}$, where $\mathbf{x_i}=(x_{i1};x_{i2};...;x_{id}), \ y_{i} \in R$. Linear regression tries to learn a linear model&lt;/p&gt;
$$f(x_i)=wx_i+b$$&lt;p&gt;such that $f(x_i)\simeq y_i$.&lt;/p&gt;
&lt;h2 id="derivation"&gt;Derivation&lt;/h2&gt;
&lt;p&gt;Consider using MSE (mean squared error) to measure how good the model is; then the loss function $L(w,b)$ is:&lt;/p&gt;</description></item><item><title>Detecting Traffic Violations with Opencv</title><link>https://simplestory.github.io/en/posts/20171104_bb6e9cb8623b3bf044c62bbbca472d53/</link><pubDate>Sun, 05 Nov 2017 00:00:00 +0000</pubDate><guid>https://simplestory.github.io/en/posts/20171104_bb6e9cb8623b3bf044c62bbbca472d53/</guid><description>&lt;blockquote&gt;
&lt;p&gt;Opencv contains more than 2500 functions, and almost any mature algorithm you can think of can be implemented by calling Opencv&amp;rsquo;s functions, which is super convenient. This post combines Python and Opencv to detect cars in surveillance video and check whether they commit a violation (crossing the double yellow line).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;System environment: Ubuntu16.04LTS+OpenCV3.3.0+Python2.7.12&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="background-extraction"&gt;Background extraction&lt;/h2&gt;
&lt;p&gt;For surveillance the position is relatively fixed, so the background will not change considerably over a long period of time. We can therefore consider using background subtraction to roughly extract the background.&lt;/p&gt;</description></item></channel></rss>