Most viewed recipes tagged "machine_learning"http://code.activestate.com/recipes/tags/machine_learning/views/2014-07-31T15:55:15-07:00ActiveState Code RecipesExpectation-Maximization (Python) 2011-06-04T11:02:18-07:00Gabriel Synnaevehttp://code.activestate.com/recipes/users/4178198/http://code.activestate.com/recipes/577735-expectation-maximization/ <p style="color: grey"> Python recipe 577735 by <a href="/recipes/users/4178198/">Gabriel Synnaeve</a> (<a href="/recipes/tags/data_mining/">data_mining</a>, <a href="/recipes/tags/machine_learning/">machine_learning</a>). Revision 3. </p> <p>Quick and simple implementation of Gaussian mixture model (with same covariance shapes) based expectation-maximization algorithm.</p> Simple Linear Regression with Pure Python (Python) 2014-07-31T15:55:15-07:00Chaobin Tang (唐超斌)http://code.activestate.com/recipes/users/4174076/http://code.activestate.com/recipes/578914-simple-linear-regression-with-pure-python/ <p style="color: grey"> Python recipe 578914 by <a href="/recipes/users/4174076/">Chaobin Tang (唐超斌)</a> (<a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/machine_learning/">machine_learning</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/regression/">regression</a>). </p> <p>Linear regression is a very useful and simple to understand way for predicting values, given a set of training data. The outcome of the regression is a best fitting line function, which, by definition, is the line that minimizes the sum of the squared errors (When plotted on a 2 dimensional coordination system, the errors are the distance between the actual Y' and predicted Y' on the line.) In machine learning, this line equation Y' = b*x + A is solved using Gradient Descent to gradually approach to it. Also, there is a statistical approach that directly solves this line equation without using an iterative algorithm.</p> <p>This recipe is a pure Python implementation of this statistical algorithm. It has no dependencies.</p> <p>If you have pandas and numpy, you can test its result by uncommenting the assert lines.</p> K-means (Python) 2011-06-04T10:58:09-07:00Gabriel Synnaevehttp://code.activestate.com/recipes/users/4178198/http://code.activestate.com/recipes/577734-k-means/ <p style="color: grey"> Python recipe 577734 by <a href="/recipes/users/4178198/">Gabriel Synnaeve</a> (<a href="/recipes/tags/data_mining/">data_mining</a>, <a href="/recipes/tags/machine_learning/">machine_learning</a>). Revision 2. </p> <p>Hard and soft k-means implemented simply in python (with numpy). Quick and dirty, tested and works on large (10k+ observations, 2-10 features) real-world data.</p>