Book Image

Python Automation Cookbook - Second Edition

By : Jaime Buelta
Book Image

Python Automation Cookbook - Second Edition

By: Jaime Buelta

Overview of this book

In this updated and extended version of Python Automation Cookbook, each chapter now comprises the newest recipes and is revised to align with Python 3.8 and higher. The book includes three new chapters that focus on using Python for test automation, machine learning projects, and for working with messy data. This edition will enable you to develop a sharp understanding of the fundamentals required to automate business processes through real-world tasks, such as developing your first web scraping application, analyzing information to generate spreadsheet reports with graphs, and communicating with automatically generated emails. Once you grasp the basics, you will acquire the practical knowledge to create stunning graphs and charts using Matplotlib, generate rich graphics with relevant information, automate marketing campaigns, build machine learning projects, and execute debugging techniques. By the end of this book, you will be proficient in identifying monotonous tasks and resolving process inefficiencies to produce superior and reliable systems.
Table of Contents (16 chapters)
14
Other Books You May Enjoy
15
Index

Creating your own custom machine learning model to classify text

Using the default interface to classify text based on sentiment or general categories is very powerful but doesn't allow us to classify different texts based on our own rules. Being able to create our own model is where the full power of machine learning lies.

Fortunately, Google offers the power to create and train our own models based on our own set of training data. This allows us to generate a collection of texts and classify them using our own labels. With this data, we will prepare our own model that can be matched against new texts.

We will see in this recipe an example of classifying emails sent to a shop that has two sections, "appliances" and "furniture." We will create a third category of "others" that should capture emails that don't fit neatly into either category.

The process is highly dependent on the quality of the data that is provided to the model...