Python Machine Learning

Python Machine Learning

Sebastian Raschka

Language: English

Pages: 454

ISBN: 1783555130

Format: PDF / Kindle (mobi) / ePub

Unlock deeper insights into Machine Leaning with this vital guide to cutting-edge predictive analytics

About This Book

  • Leverage Python's most powerful open-source libraries for deep learning, data wrangling, and data visualization
  • Learn effective strategies and best practices to improve and optimize machine learning systems and algorithms
  • Ask – and answer – tough questions of your data with robust statistical models, built for a range of datasets

Who This Book Is For

If you want to find out how to use Python to start answering critical questions of your data, pick up Python Machine Learning – whether you want to get started from scratch or want to extend your data science knowledge, this is an essential and unmissable resource.

What You Will Learn

  • Explore how to use different machine learning models to ask different questions of your data
  • Learn how to build neural networks using Pylearn 2 and Theano
  • Find out how to write clean and elegant Python code that will optimize the strength of your algorithms
  • Discover how to embed your machine learning model in a web application for increased accessibility
  • Predict continuous target outcomes using regression analysis
  • Uncover hidden patterns and structures in data with clustering
  • Organize data using effective pre-processing techniques
  • Get to grips with sentiment analysis to delve deeper into textual and social media data

In Detail

Machine learning and predictive analytics are transforming the way businesses and other organizations operate. Being able to understand trends and patterns in complex data is critical to success, becoming one of the key strategies for unlocking growth in a challenging contemporary marketplace. Python can help you deliver key insights into your data – its unique capabilities as a language let you build sophisticated algorithms and statistical models that can reveal new perspectives and answer key questions that are vital for success.

Python Machine Learning gives you access to the world of predictive analytics and demonstrates why Python is one of the world's leading data science languages. If you want to ask better questions of data, or need to improve and extend the capabilities of your machine learning systems, this practical data science book is invaluable. Covering a wide range of powerful Python libraries, including scikit-learn, Theano, and Pylearn2, and featuring guidance and tips on everything from sentiment analysis to neural networks, you'll soon be able to answer some of the most important questions facing you and your organization.

Style and approach

Python Machine Learning connects the fundamental theoretical principles behind machine learning to their practical application in a way that focuses you on asking and answering the right questions. It walks you through the key elements of Python and its powerful machine learning libraries, while demonstrating how to get to grips with a range of statistical models.

Language and Computers

Measuring the User Experience: Collecting, Analyzing, and Presenting Usability Metrics (2nd Edition) (Interactive Technologies)

Writing Solid Code (Microsoft Programming Series)

Introduction to the Theory of Computation (2nd Edition)

ASP.NET MVC 4 in Action




















The triangle class label based on majority voting among its five nearest neighbors. Based on the chosen distance metric, the KNN algorithm finds the k samples in the training dataset that are closest (most similar) to the point that we want to classify. The class label of the new data point is then determined by a majority vote among its k nearest neighbors. The main advantage of such a memory-based approach is that the classifier immediately adapts as we collect new training data. However,.

Stacked generalization. Neural networks, 5(2):241–259, 1992. Bagging – building an ensemble of classifiers from bootstrap samples Bagging is an ensemble learning technique that is closely related to the MajorityVoteClassifier that we implemented in the previous section, as illustrated in the following diagram: However, instead of using the same training set to fit the individual classifiers in the ensemble, we draw bootstrap samples (random samples with replacement) from the.

Overfitting the training data. Sometimes it may be more useful to report the coefficient of determination (), which can be understood as a standardized version of the MSE, for better interpretability of the model performance. In other words, is the fraction of response variance that is captured by the model. The value is defined as follows: Here, SSE is the sum of squared errors and SST is the total sum of squares , or in other words, it is simply the variance of the response. Let's.

Quickly show that is indeed just a rescaled version of the MSE: For the training dataset, is bounded between 0 and 1, but it can become negative for the test set. If , the model fits the data perfectly with a corresponding . Evaluated on the training data, the of our model is 0.765, which doesn't sound too bad. However, the on the test dataset is only 0.673, which we can compute by executing the following code: >>> from sklearn.metrics import r2_score >>> print('R^2 train: %.3f, test:.

To the data in the Housing Dataset. By executing the following code, we will model the relationship between house prices and LSTAT (percent lower status of the population) using second degree (quadratic) and third degree (cubic) polynomials and compare it to a linear fit. The code is as follows: >>> X = df[['LSTAT']].values >>> y = df['MEDV'].values >>> regr = LinearRegression() # create polynomial features >>> quadratic = PolynomialFeatures(degree=2) >>> cubic = PolynomialFeatures(degree=3).

Download sample