Question: Using Python in Rstudio! We will reproduce the example given in the ebook here fitting a simple machine learnig model. Exactly follow the example from
Using Python in Rstudio!
We will reproduce the example given in the ebook here fitting a simple machine learnig model. Exactly follow the example from the notes to do this part of the project using the data aircraft from robustbase R package.
Aircraft Data, deals with singleengine aircraft built over the years from Office of Naval Research. The dependent variable is cost in units of $ and the explanatory variables are aspect ratio, lifttodrag ratio, weight of plane in pounds and maximal thrust. A data frame with observations on the following variables:
X is Aspect Ratio,
X is LifttoDrag Ratio,
X is Weight,
X is Thrust, and
Y is Cost.
We shall build a predictive model for the Cost Y given X X X and X
# Load the data
import statsmodels.api as stat
aircraft stat.datasets.getrdatasetaircraft "robustbase"data # load data "aircraft" from the R package 'robustbase'
Plot histogram of the Cost see examples from notes
#Code here
Split data to training and testing data sets
#Code here
Create outcome Cost and features Xi from training data and testing data see examples from notes
#Code here
fit a linear regression on training data set
#Code here
Predict using the fit and testing data set
#Code here
Calculate MAPE
#Code here
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
