Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Building Data Science Applications with FastAPI

You're reading from  Building Data Science Applications with FastAPI

Product type Book
Published in Oct 2021
Publisher Packt
ISBN-13 9781801079211
Pages 426 pages
Edition 1st Edition
Languages
Author (1):
François Voron François Voron
Profile icon François Voron

Table of Contents (19) Chapters

Preface 1. Section 1: Introduction to Python and FastAPI
2. Chapter 1: Python Development Environment Setup 3. Chapter 2: Python Programming Specificities 4. Chapter 3: Developing a RESTful API with FastAPI 5. Chapter 4: Managing Pydantic Data Models in FastAPI 6. Chapter 5: Dependency Injections in FastAPI 7. Section 2: Build and Deploy a Complete Web Backend with FastAPI
8. Chapter 6: Databases and Asynchronous ORMs 9. Chapter 7: Managing Authentication and Security in FastAPI 10. Chapter 8: Defining WebSockets for Two-Way Interactive Communication in FastAPI 11. Chapter 9: Testing an API Asynchronously with pytest and HTTPX 12. Chapter 10: Deploying a FastAPI Project 13. Section 3: Build a Data Science API with Python and FastAPI
14. Chapter 11: Introduction to NumPy and pandas 15. Chapter 12: Training Machine Learning Models with scikit-learn 16. Chapter 13: Creating an Efficient Prediction API Endpoint with FastAPI 17. Chapter 14: Implement a Real-Time Face Detection System Using WebSockets with FastAPI and OpenCV 18. Other Books You May Enjoy

Basics of scikit-learn

Now, let's focus on scikit-learn, an essential ML library for Python. It implements dozens of classic ML models, but also numerous tools to help you while training them, such as pre-processing methods and cross-validation.

The first thing you must do to get started is install it in your Python environment:

$ pip install scikit-learn

We can now start our scikit-learn journey!

Training models and predicting

In scikit-learn, ML models and algorithms are called estimators. Each is a Python class that implements the same methods. In particular, we have fit, which is used to train a model, and predict, which is used to run the trained model on new data.

To try this, we'll load a sample dataset. scikit-learn comes with a few toy datasets that are very useful for performing experiments. You can find out more about them in the official documentation: https://scikit-learn.org/stable/datasets.html.

Here, we'll use the digits dataset,...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}