Question
I need help in python without using sklearn, only using pandas, numpy and matplotlib You need to use 5-fold cross-validation to pick out the best
I need help in python without using sklearn, only using pandas, numpy and matplotlib
You need to use 5-fold cross-validation to pick out the best model for the prediction. You should present a chart of the error function J, similar to the one in the lecture (see below). You may need to use a package like "tabulate" to print out the table.
Ex.
You need to plot your training and testing J with respect to the polynomial degree, similar to the one in the lecture. ######################################################################
# TODO: 5-fold cross-validation #
######################################################################
pass
######################################################################
# END OF YOUR CODE #
######################################################################
######################################################################
# TODO: Print out the table chart #
######################################################################
pass ######################################################################
# END OF YOUR CODE #
######################################################################
######################################################################
# TODO: Plot the J curve #
######################################################################
pass
######################################################################
# END OF YOUR CODE #
######################################################################
\begin{tabular}{lrrrr} & Linear & Quadratic & Cubic & Fourth \\ \hline 1234 & 10.25 & 24.25 & 12.25 & 23.25 \\ 5 & 10.25 & 19.25 & 14.25 & 23.25 \\ 1235 & 10.25 & 15.25 & 19.25 & 23.25 \\ 4 & 10.25 & 10.25 & 20.25 & 23.25 \\ 1245 & 10.25 & 24.25 & 12.25 & 23.25 \\ 3 & 10.25 & 19.25 & 14.25 & 23.25 \\ 1345 & 10.25 & 24.25 & 12.25 & 23.25 \\ 2 & 10.25 & 19.25 & 14.25 & 23.25 \\ 2345 & 10.25 & 24.25 & 12.25 & 23.25 \\ 1 & 10.25 & 19.25 & 14.25 & 23.25 \\ Mean for Training & 0 & 0 & 0 & 0 \\ Mean for Testing & 0 & 0 & 0 & 0 \end{tabular}Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started