TODO 12 Complete the TODO by getting our data, training the OrdinaryLeastSquares class and making predictions for our training and validation data. Call the data_prep() function to get our cleaned and transformed data. Store the output into data. Make sure to pass forestfire_df and the arguments corresponding to the following descriptions: Return all data as NumPy arrays. Drop the features 'day', 'ISI', 'DC', 'RH', and 'FFMC' from the data using the drop_features keyword argument. Create an instance of the OrdinaryLeastSquares and pass the ?=10 to the model using the lamb keyword argument. Store the output into ols. # TODO 12.1 data = X_trn, y_trn, X_vld, y_vld, _, _, feature_names = data # TODO 12.2 ols = ols.fit(X_trn, y_trn) y_hat_trn = ols.predict(X_trn) _, trn_sse, trn_mse, trn_rmse = analyze( y=y_trn, y_hat=y_hat_trn, title="Training Predictions Log Transform", dataset="Training", xlabel="Data Sample Index", ylabel="Predicted Log Area" ) todo_check([     (isinstance(X_trn, np.ndarray), 'X_trn is not of type np.ndarray'),     (np.isclose(trn_rmse, 1.34096, rtol=.01), "trn_rmse value is possibly incorrect!"),     (np.all(np.isclose(ols.w[:3].flatten(), [ 1.1418, -0.03522, -0.0148 ], rtol=0.01)), 'ols.w weights possibly contain incorrect values!') ])

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

TODO 12

Complete the TODO by getting our data, training the OrdinaryLeastSquares class and making predictions for our training and validation data.

  1. Call the data_prep() function to get our cleaned and transformed data. Store the output into data. Make sure to pass forestfire_df and the arguments corresponding to the following descriptions:
    1. Return all data as NumPy arrays.
    2. Drop the features 'day', 'ISI', 'DC', 'RH', and 'FFMC' from the data using the drop_features keyword argument.
  2. Create an instance of the OrdinaryLeastSquares and pass the ?=10 to the model using the lamb keyword argument. Store the output into ols.

# TODO 12.1
data =
X_trn, y_trn, X_vld, y_vld, _, _, feature_names = data

# TODO 12.2
ols =

ols.fit(X_trn, y_trn)

y_hat_trn = ols.predict(X_trn)

_, trn_sse, trn_mse, trn_rmse = analyze(
y=y_trn,
y_hat=y_hat_trn,
title="Training Predictions Log Transform",
dataset="Training",
xlabel="Data Sample Index",
ylabel="Predicted Log Area"
)

todo_check([
    (isinstance(X_trn, np.ndarray), 'X_trn is not of type np.ndarray'),
    (np.isclose(trn_rmse, 1.34096, rtol=.01), "trn_rmse value is possibly incorrect!"),
    (np.all(np.isclose(ols.w[:3].flatten(), [ 1.1418, -0.03522, -0.0148 ], rtol=0.01)), 'ols.w weights possibly contain incorrect values!')
])

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education