Home / Expert Answers / Computer Science / data-science-jupyter-notebooks-details-the-purpose-of-this-assignment-is-expose-you-to-a-second-pa278

(Solved): Data Science - Jupyter Notebooks Details The purpose of this assignment is expose you to a (second) ...



Data Science - Jupyter Notebooks

Details

The purpose of this assignment is expose you to a (second) polynomial regression problem. Your goal is to:

  1. Create the following figure using matplotlib, which plots the data from the file called PolynomialRegressionData_II.csv. This figure is generated using the same code that you developed in Assignment 3 of Module 2 - you should reuse that same code.
  2. Perform a PolynomialFeatures transformation, then perform linear regression to calculate the optimal ordinary least squares regression model parameters.
  3. Recreate the first figure by adding the best fit curve to all subplots.
  4. Infer the true model parameters.

Below is the first figure you must emulate:

Below is the second figure you must emulate:

Below is the second figure you must emulate:
 

Each of the two figures has four subplots. Note the various viewing angles that each subplot presents - you can achieve this with the view_init() method. Use the same color scheme for the datapoints shown here, which is called jet. Be sure to label your axes as shown.

# Common imports
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib import cm
import numpy as np
import pandas as pd
import os
%matplotlib inline
mpl.rc('axes', labelsize=14)
mpl.rc('xtick', labelsize=12)
mpl.rc('ytick', labelsize=12)

# Where to save the figures
PROJECT_ROOT_DIR = "."
FOLDER = "figures"
IMAGES_PATH = os.path.join(PROJECT_ROOT_DIR, FOLDER)
os.makedirs(IMAGES_PATH, exist_ok=True)

def save_fig(fig_id, tight_layout=True, fig_extension="png", resolution=300):
    path = os.path.join(IMAGES_PATH, fig_id + "." + fig_extension)
    print("Saving figure", fig_id)
    if tight_layout:
        plt.tight_layout()
    plt.savefig(path, format=fig_extension, dpi=resolution)

 

Create First Image
Use the scatter3D to plot in three dimensions. Create four subplots with the appropriate viewing angles usPerform Polynomial Features Transformation
Perform a polynomial transformation on your features

 

Below is the second figure you must emulate: Create First Image Use the scatter3D to plot in three dimensions. Create four subplots with the appropriate viewing angles using the view in from mpl_toolkits.mplot3d import Axes3D \#\# ENTER CODE HERE \#\# Perform Polynomial Features Transformation Perform a polynomial transformation on your features


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe