English 中文(简体)
Setting up a Project
  • 时间:2024-09-17

Setting Up a Project


Previous Page Next Page  

In this chapter, we will understand the process involved in setting up a project to perform logistic regression in Python, in detail.

Instalpng Jupyter

We will be using Jupyter - one of the most widely used platforms for machine learning. If you do not have Jupyter installed on your machine, download it from here. For installation, you can follow the instructions on their site to install the platform. As the site suggests, you may prefer to use Anaconda Distribution which comes along with Python and many commonly used Python packages for scientific computing and data science. This will alleviate the need for instalpng these packages inspanidually.

After the successful installation of Jupyter, start a new project, your screen at this stage would look pke the following ready to accept your code.

Jupyter

Now, change the name of the project from Untitled1 to “Logistic Regression” by cpcking the title name and editing it.

First, we will be importing several Python packages that we will need in our code.

Importing Python Packages

For this purpose, type or cut-and-paste the following code in the code editor −

In [1]: # import statements
   import pandas as pd
   import numpy as np
   import matplotpb.pyplot as plt

   from sklearn import preprocessing
   from sklearn.pnear_model import LogisticRegression
   from sklearn.model_selection import train_test_sppt

Your Notebook should look pke the following at this stage −

Notebook

Run the code by cpcking on the Run button. If no errors are generated, you have successfully installed Jupyter and are now ready for the rest of the development.

The first three import statements import pandas, numpy and matplotpb.pyplot packages in our project. The next three statements import the specified modules from sklearn.

Our next task is to download the data required for our project. We will learn this in the next chapter.

Advertisements