Reader small image

You're reading from  Building Data Science Solutions with Anaconda

Product typeBook
Published inMay 2022
PublisherPackt
ISBN-139781800568785
Edition1st Edition
Concepts
Right arrow
Author (1)
Dan Meador
Dan Meador
author image
Dan Meador

Dan Meador is an Engineering Manager at Anaconda and is the creator of Conda as well as a champion of open source at Anaconda. With a history of engineering and client facing roles, he has the ability to jump into any position. He has a track record of delivering as a leader and a follower in companies from the Fortune 10 to startups.
Read more about Dan Meador

Right arrow

Evaluating potential models using MSE and R2 scores

There will always be a large number of potential models that you can attempt to train, and you can spend a large amount of time tweaking each of them to optimize them. It's valuable to understand which ones could give you the best outcome before you spend a large amount of time on any option. We're going to use k-fold validation to check how we trained the model. This will take our training data and create k sections. You can think of this as folding a piece of paper k times, and then taking turns using one of the k sections as the testing data, and the rest as the training data:

  1. First, we want to import what we need for this exercise. The next bit of code will do the training so we can see which model would be a nice fit. We'll start as usual by importing what we need:
    from sklearn.model_selection import cross_val_score
    from sklearn.model_selection import StratifiedKFold
    from sklearn.linear_model import ...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Building Data Science Solutions with Anaconda
Published in: May 2022Publisher: PacktISBN-13: 9781800568785

Author (1)

author image
Dan Meador

Dan Meador is an Engineering Manager at Anaconda and is the creator of Conda as well as a champion of open source at Anaconda. With a history of engineering and client facing roles, he has the ability to jump into any position. He has a track record of delivering as a leader and a follower in companies from the Fortune 10 to startups.
Read more about Dan Meador