Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# For this assignment, we are going to construct a KNN model to predict the stock market price # movement. We are using Smarket dataset

image text in transcribed
\# For this assignment, we are going to construct a KNN model to predict the stock market price \# movement. We are using Smarket dataset which is part of ISLR package. For more information about \# the variables in the data, please look up the help page for Smaket data (it is alwayse \# a good idea to inspect the dataset structure and explore the variables before running any * analytic model. \# 1. Prepare the variables of the model for the analysis (Normalize predictores). \# Remove the variable Today from the data \# 2. Set seed to 300 \# 3. Create an index for test and train instances ( 80/20split ) (observations) \# [direction is the Target feature] \# 4. Split the data into test and train \# 5. Build a KNN model with Direction as the target and all other variables as \# the predictors. Let the model try 30 different values for k. \# 6. plot the trained model. Approximately, at value of k the model has the highest Accuracy? \#7. Calculate the model performance measures (Accuracy, Sensitivity, and Specificity)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Accounting And Finance

Authors: Geoff Black

2nd Edition

0273711628, 978-0273711629

More Books

Students also viewed these Accounting questions

Question

2.1 Discuss what ethics means and the sources of ethical guidance.

Answered: 1 week ago

Question

8 What personal development is elearning good at providing?

Answered: 1 week ago

Question

7 What are the principles of action learning?

Answered: 1 week ago