Book Image

Python Machine Learning Workbook for Beginners

By : AI Sciences
Book Image

Python Machine Learning Workbook for Beginners

By: AI Sciences

Overview of this book

<p>Machine Learning (ML) is the lifeblood of businesses worldwide. ML tools empower organizations to identify profitable opportunities fast and help them to better understand potential risks. The ever-expanding data, cost-effective data storage, and competitively priced powerful processing continue to drive the growth of ML. </p><p> </p><p>This is the best time you could enter the exciting machine learning universe. Industries are reinventing themselves constantly by developing more advanced data analysis models. These models analyze larger and more complex data than ever while delivering instantaneous and more accurate results on enormous scales. </p><p>In this backdrop, it is evident that hands-on practice is everything in machine learning. Tons of theory will amount to nothing if you don’t have enough hands-on practice. Textbooks and online classes mislead you into a false sense of mastery. The easy availability of learning resources tricks you and you become overconfident. But when you try to apply the theoretical concepts you have learned, you realize it’s not that simple. </p><p> </p><p>This is where projects play a crucial role in your learning journey. Projects are doubtless the best investment of your time. You’ll not only enjoy learning but you’ll also make quick progress. And unlike studying boring theoretical concepts, you’ll find that working on projects is easier to stay motivated. </p><p> </p><p>The projects in this book cover ten different interesting topics. Each project will help you refine your ML skills and apply them in the real world. These projects also present you with an opportunity to enrich your portfolio, making it simpler to find a great job, explore interesting career paths, and even negotiate a higher pay package. Overall, this learning-by-doing book will help you accomplish your machine learning career goals faster. </p><p> </p><p>The code bundle for this course is available at https://www.aispublishing.net/ai-sciences-book</p>
Table of Contents (15 chapters)
1
About the Author

2.5. Iteration Statements

Iteration statements, also known as loops, are used to iteratively execute a certain piece of code. There are two main types of iteration statements in Python.

a.For loop

b.While Loop

For Loop

The for loop is used to iteratively execute a piece of code for a certain number of times. You should use for loop when you exactly know the number of iterations or repetitions for which you want to run your code. A for loop iterates over a collection of items. In the following example, we create a collection of five integers using the range() method. Next, a for loop iterates five times and prints each integer in the collection.

Script 12:

1. items = range(5)

2. for item in items:

3.imgae print(item)

Output:

0

1

2

3

4

While Loop

The while loop keeps executing a certain piece of code unless the evaluation condition becomes false. For instance, the while loop in the following script keeps executing unless variable c becomes greater than 10.

Script 13:

1. c = 0

2. while c...