Question
Referral link for the previous question with supplemental code: https://www.chegg.com/homework-help/questions-and-answers/code-include-include-include-mathh-using-namespace-std-typedef-double-mattype-define-myfab-q24983322 What if we want to remove some points from our existing data sets? The question
Referral link for the previous question with supplemental code: https://www.chegg.com/homework-help/questions-and-answers/code-include-include-include-mathh-using-namespace-std-typedef-double-mattype-define-myfab-q24983322
What if we want to remove some points from our existing data sets? The question to ask is which points to we remove and what is the best way to remove them? We know that for regression to work we need a set of x,y points. Since we are approximating a function, our points cannot include multiple x,y points with the same value of x. So we will limit our removal code to only remove a single point, one specified by the value of x which is just a double. We will therefore create an operator overload for - which will delete a single point specified by a double; it too is located just above the main function. The template is again provided for you. In this case the object t is created but we set the size to n initially and allocate n points. There is the possibility that the point you want to erase simply doesnt exist, so this essentially just becomes a copy function. Your code should copy the contents of the current object to object t while skipping (hint: use continue) any value of x which matches rhs. rhs in this case is just a double and not another Regression object. Also remember to adjust the number of points after in the new object as it may have changed. Write the newly added code for the operator- function below.
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