Question 3 The objective of this question is to give practice with using attributes and connecting their use and behavio

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Question 3 The objective of this question is to give practice with using attributes and connecting their use and behavio

Post by answerhappygod »

Question 3 The Objective Of This Question Is To Give Practice With Using Attributes And Connecting Their Use And Behavio 1
Question 3 The Objective Of This Question Is To Give Practice With Using Attributes And Connecting Their Use And Behavio 1 (118.07 KiB) Viewed 102 times
Question 3 The objective of this question is to give practice with using attributes and connecting their use and behavior with lists. In statistics and machine learning, it is often useful/necessary to rescale (or normalize) the range of data values to a standard interval. The simplest method of rescaling is min-max scaling (or min-max normalization), which rescales the range of the data values to the interval [0, 1]. Formally, if x = (21, 22, ..., Zn) is a sample of data values, then the min-max scaling to [0, 1] is Xi – min(x) for i=1,2,...,n. max(x) – min(x)' The scaled values z= (21, 22, ..., Zn) would have a range of (0, 1). More generally, the min-max scaling to an interval [a,b], with a <b, is given by [xi – min(x)](b − a) 2i = a + for i = 1,2,...,n. max(x) – min (2) 2i = Write a function called my_scale() that inputs a numeric vector x and outputs a vector such that: • The output vector contains the min-max scaled values of the input vector. • The output object contains additional attributes called a and b that contain, respectively, the original minimum and maximum of the input vector. • If the input vector does not contain both attributes a and b, the output vector should be scaled to the range from 0 to 1. If the input vector contains both attributes a and b, the output vector should be scaled to the range from a to b.

For any numeric vector x, the command my_scale(my_scale(x)) should represent the same vector of values as x. In other words, the my_scale() function is its own inverse function. Note 1: Attributes of an object that are not inherent to its class (e.g., the dim and dimnames attributes for matrix objects) will automatically be shown when printing the object. Note 2: This is not the same type of scaling as the built-in scale() function, which uses 2-score normalization (also called standardization). You should not use the scale() function for comparison.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply