Question: Problem 6 : Applying the Model to New Data In the last problem, we will apply our model to a new set of observations. Suppose

Problem 6: Applying the Model to New Data
In the last problem, we will apply our model to a new set of observations. Suppose that this new set of data
consists of four patients with the characteristics shown below. Note that many of the column names have been
abbreviated for the purposes of fitting all of the columns within the instructions.
Create a DataFrame named new_data containing the information shown above. Use the original names for
the columns. Set the column data types to be consistent with the original stroke_df DataFrame. Display the
contents of this new DataFrame.
We will now use our model to generate predictions for the observations in this DataFrame.
Apply the processing pipeline to new_data, storing the resulting DataFrame in a variable. Then apply your
model to the processed data, again storing the results in a variable. Display the probability and
prediction columns of this final DataFrame. Set truncate=False.Problem 6: Applying the Model to New Data
In the last problem, we will apply our model to a new set of observations. Suppose that this new set of data
consists of four patients with the characteristics shown below. Note that many of the column names have been
abbreviated for the purposes of fitting all of the columns within the instructions.
+------+----+---+-----+-------+-------------+--------+--------+----+---------------+
|gender| age|hyp|heart|married| work_type|res_type|avg_gluc| bmi| smoking_status|
+------+----+---+-----+-------+-------------+--------+--------+----+---------------+
|Female|42.0|1|0| No| Private| Urban|182.1|26.8| smokes|
|Female|64.0|1|1| Yes|Self-employed| Rural|171.5|32.5|formerly smoked|
| Male|37.0|0|0| Yes| Private| Rural|79.2|18.4| Unknown|
| Male|72.0|0|1| No| Govt_job| Urban|125.7|19.4| never smoked|
+------+----+---+-----+-------+-------------+--------+--------+----+---------------+
Create a DataFrame named new_data containing the information shown above. Use the original names for
the columns. Set the column data types to be consistent with the original stroke_df DataFrame. Display the
contents of this new DataFrame.
We will now use our model to generate predictions for the observations in this DataFrame.
Apply the processing pipeline to new_data, storing the resulting DataFrame in a variable. Then apply your
model to the processed data, again storing the results in a variable. Display the probability and
prediction columns of this final DataFrame. Set truncate=False.
Problem 6 : Applying the Model to New Data In the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!