1) data.hist('x') ---> generated histogram A, because you can see values of x are from -1 to 4 as in the
histogram A.
data.hist('y') ---> generated histogram B, because you can see values of y are from 0.0 to 3.0 as in the
histogram B.
2) the values in the histogram A, -1 to 4 will be shifted by 5 i.e. 4 to 9.
4. Histograms Suppose we have a table called data with two numerical columns, "x" and·y. Consider...
Using the R language: Suppose we have a vector, called longvector with 1000 elements. A. How would you let R calculate the mean value of longvector? Write the code here: B. What if there are some NA values and you'd like R to remove the NA values when calculating the mean of longvector? Write the code here: C. How would you plot a histogram to show the distribution of values in longvector? Write the code here: D. How would you...
Simple Linear Regression (SLR) We have the following hypothetical data for the independent variable x (other names regressor, covariate, or explanatory variable) and the dependent variable y (regressand)(a) Use Excel to draw a y-x scatter diagram with y on the vertical axis. Add the linear trend line (b) Complete the table. Use 5 decimals throughout your calculations if applicable (c) Give an equation for and manually calculate the slope b. The table aids your calculations (d) Give an equation for and calculate the y-intercept...
The table below provides a training data set containing nine observations. two pedictors α1 and X) and one qualitative response variable (Category) X1 X2 Below is scatter plot which shows the data, with Category indicated 1.0 -0.5 0.0 0.5 1.0 1.5 2.0 X1 Suppose we wish to use this data set to make a prediction for Category when X-0 and X-3 using K nearest neighbors. a Compute the Euclidean distance between each observation and the test point X b. What...
Simple Linear Regression (SLR) We have the following hypothetical data for the independent variable x (other names: regressor, covariate, or explanatory variable) and the dependent variable y (regressand). (a) Use Excel to draw a y-x scatter diagram with y on the vertical axis. Add the linear trend line. (b) Complete the table. Use 5 decimals throughout your calculations if applicable. (c) Give an equation for and manually calculate the slope b1. The table aids your calculations. (d) Give an equation for and calculate...
Part 2: Preperation for ML algorithms %run part2-setup.py 7. Write the function prepare_data(dataset_dict), which takes a dataset dictionary and returns a tuple (X,y) that holds the datamatrix and the labels In [3] : .Both X and y are of type numpy arrays . If the output variable is numeric (np.issubdtype(y.dtype, np.number)) it should be kept as is, otherwise it should be discretized using the command pandas.factorize) (use default function parameters). .Categorical features (whose columns are specified in the configuration file)...
5. Suppose we have two random variables X and Y. They are discrete and have the exact same distribution and also independent. You see below the distribution of X which of course also the distribution of Y as well, that is what we called independent and identically distributed) P(X =- X. Remem- a./ (-) Find and draw the cumulative distribution function F() function of ber that F(x) -P(X S) HINT: For the next 3 parts you might want to make...
5. So far in our linear modeling, we have assumed that Ylz ~ NA,+Az,σ2); that is, there is a normal distribution of common variance around the regression line. Here, we change this up! Suppose that X~Unif(0, 1) and that for a given r, we know YlN(,22). (Here, the regression lne is 01z and the variance around the regression grows as r grows.) a. In R, figure out how to generate 1000 data points that follow this model and plot them....
(a) Suppose you are given the following (x, y) data pairs x136y217Find the least-squares equation for these data (rounded to three digits after the decimal) (b) Now suppose you are given these (x, y) data pairs. x217y136Find the least-squares equation for these data (rounded to three digits after the decimal). (c) In the data for parts (a) and (b), did we simply exchange the x and y values of each data pair? Yes No (d) Solve your answer from part (a) for x (rounded to...
11. Consider the following set of n-6 observations of x and y given in Table 1 i. Graph the observations in a scatter plot on paper by hand by plotting x on the x-axis and y on the y-axis. Comment on the relationship. Using observations from Table 1, what are the sample means i and-? Using observations from Table 1, calculate the deviations and squared deviations from the sample mean for x: (x 11. iii. -x) and (x )for each...
You can just answer question bcd 5Suppose we have an objective function f(x,y) and a constraint y-h). Suppose the Lagrangian has a critical point at (0,0,X). Explain in a sentence or two how you know that line r(t) = (t,th,(0)) is tangent to the constraint. b At the critical point, compute the second derivative of f along the line in a d2 At the critical point, compute the second derivative of f along the graph y - h(x) Describe the...