Question

Examination 1 Directions: All work MUST be done in Jupyter Notebook 1.Separate the following data into...



Examination 1

Directions: All work MUST be done in Jupyter Notebook


1.Separate the following data into input and output data:
data = ([2,6,8],
[4,32,12],
[1,5,5]])

2.Split into train and test data. Split the following dataset at the split point of 2 and using all columns:
data = ([5, 10, 15],
[20,25,30],
[35,40,45]])

3.Use the size of the dataset array dimensions in the shape dimension by specifying the parameters:
data = [[2,4],
[6,8],
[10,12]]

4.Add the following arrays:

A = array ([5,8,1],
[6,1,2]])

b = array ([1, 5, 12])

5.Multiply the following vectors:

a = array ([10, 12, 18]) ; b = array ([2, 23, 46])

6.Divide the following vectors:

a = array ([3, 8, 9] b = array ([12, 15, 16])

7.Find the dot product of the following vectors:

a = array ([ 6, 8, 15]) b = array ([2, 4, 8])

8.Calculate the vector L^1 Norm of the following vector: a = array ([20, 32, 40])

9.Calculate the vector L^2 Norm of the following vector: a = array ([20, 32, 40])

10.Calculate the vector Max Norm of the following vector: a = array ([20, 32, 40])


Homework Answers

Answer #1
import pandas as pd 
import numpy as np
from numpy.linalg import norm
# max norm of a vector
from numpy import inf



#1.Separate the following data into input and output data:

data = ([2,6,8],[4,32,12],[1,5,5])
x=np.split(data,[1])
print(x)


# 2.Split into train and test data. Split the following dataset at the split point of 2 and using all columns`


data1 = ([5, 10, 15],
[20,25,30],
[35,40,45])

x1=np.split(data1,[2])
print(x)



#3.Use the size of the dataset array dimensions in the shape dimension by specifying the parameters:

data2=np.array([[2,4],[6,8],[10,12]])
print(data2.shape)



# 4.Add the following arrays:

a =np.array([[5,8,1],[6,1,2]])


b = np.array([1, 5, 12])

add_array=np.add(a,b)


print(add_array)



# 5.Multiply the following vectors:

a1 = np.array([10, 12, 18]) 
b1 = np.array([2, 23, 46])

mul_array=np.multiply(a1,b1)

print(mul_array)


#6.Divide the following vectors:

a2 = np.array([3, 8, 9])
b2 = np.array([12, 15, 16])

div_array=np.divide(a2,b2)

print(div_array)




#7.Find the dot product of the following vectors:

a3 = np.array([ 6, 8, 15]) 
b3 = np.array ([2, 4, 8])

dot_array=np.dot(a3,b3)

print(dot_array)


#8.Calculate the vector L^1 Norm of the following vector: 

a4 = np.array ([20, 32, 40])
l1 = norm(a4, 1)
print(l1)


#9.Calculate the vector L^2 Norm of the following vector: 


a5 = np.array ([20, 32, 40])
l2 = norm(a5, 2)
print(l2)


# 10.Calculate the vector Max Norm of the following vector: 

a6 =np.array ([20, 32, 40])
maxnorm = norm(a6, inf)

print(maxnorm)


Hello Student , I have completed all your answers , only you have to log into Jupyter notebook. To do that simply search Google colab in your browser and click on the first link after that click on the option Welcome to Colaboratory and just click on the file in the left corner and create a new notebook and rest you are having the code . And if you are new to Jupyter notebook, please feel free to ask me I will guide you.

Thankyou.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Can someone please answer the following questions with this data set? 1. If we choose an...
Can someone please answer the following questions with this data set? 1. If we choose an x value at random, remember that this depends on the data, so the x value could be a person or number, is it possible to find if x is usual or unusual? Why? Could you find the probability? What is it? 2. You may also find the confidence interval for the population mean, if your data is quantitative. If your data is qualitative, you...
Using R, answer the following question. The accompanying data set contains quiz scores for 12 students...
Using R, answer the following question. The accompanying data set contains quiz scores for 12 students in a chemistry class: 18, 15, 5, 8, 15, 20, 2, 16, 10, 12, 20, 15. Find a measure of central tendency that separates the data into two groups such that each group consists of 50% of the scores above and 50% of the scores below that measure. Find a measure of central tendency that represents the average of the 12 quiz scores. Find...
The following frequency table summarizes 60 data values. What is the 80th percentile of the data?...
The following frequency table summarizes 60 data values. What is the 80th percentile of the data? The table is read from left to right. 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 6 6 6 7 7 8 8 9 9 9 9 10 11 11 11 11 11 12 12 12 12 13 13 13 14 14 14 14 15 15 15 16 17 17 17 17 17 18 19 19 20...
Questions 2-7 will all be in regards to this data set: Observation X Y 1 20...
Questions 2-7 will all be in regards to this data set: Observation X Y 1 20 30 2 23 35 3 28 40 4 26 38 5 24 37 6 32 45 7 35 50 8 24 34 9 31 42 10 23 32 What is the Pearson's coefficient of correlation for the data set above?
Show all work and graphs. Use Minitab software, Analyze the correlation for the following data: Circuit...
Show all work and graphs. Use Minitab software, Analyze the correlation for the following data: Circuit Type Response 1 19 22 20 18 25 2 20 21 33 27 40 3 16 15 18 26 17
1. Consider the following small data set: Kane 20 12 2005 12 25 Ambler 22 12...
1. Consider the following small data set: Kane 20 12 2005 12 25 Ambler 22 12 2005 8 20 Kane 20 01 2006 13 32 Oakey 32 12 2005 30 50 Oakey 32 01 2006 25 45 Ambler 22 01 2006 15 28 Assume that the columns, from left to right, represent one character variable (town name) and five numeric variables (town number, month, year, low daytime temperature (in degrees F) and high daytime temperature (in degrees F)). a. Use...
6. Using the class data (see Blackboard file - "Class Survey Data - PSS-10 and GAS")...
6. Using the class data (see Blackboard file - "Class Survey Data - PSS-10 and GAS") calculate the correlation between the GAS – Goal disengagement and the GAS – Goal reengagement scores. Write the results in a statistical statement. 7. Using the class data calculate the correlation between the GAS – Goal disengagement and the PSS-10 scores. Write the results in a statistical statement. 8. Using the class data calculate the correlation between the GAS – Goal reengagement scores and...
ONLY NEED VALUES FOR C AND D. PLUS FINAL PLOT Use the following code to show...
ONLY NEED VALUES FOR C AND D. PLUS FINAL PLOT Use the following code to show that the power method can be used to calculate the largest eigenvalue and corresponding eigenvector of a covariance matrix. A. Generate the data: x <- rnorm(100000) dim(x) <- c(500,200) x <- x* 1:9 x[,1] <- x[,1]*2+ x[,3] + x[,20] x[,5] <- x[,5]*3+ x[,3] +2* x[,20] B.Calculate the covariance matrix and its powers vx <- var(x) vx2 <- vx%*%vx vx4 <- vx2%*%vx2 vx8 <- vx4%*%vx4...
ONLY NEED OUTPUT VALUES FOR C AND D. PLUS FINAL PLOT Use the following code to...
ONLY NEED OUTPUT VALUES FOR C AND D. PLUS FINAL PLOT Use the following code to show that the power method can be used to calculate the largest eigenvalue and corresponding eigenvector of a covariance matrix. A. Generate the data: x <- rnorm(1000) dim(x) <- c(50,20) x <- x* 1:9 x[,1] <- x[,1]*2+ x[,3] + x[,20] x[,5] <- x[,5]*3+ x[,3] +2* x[,20] B.Calculate the covariance matrix and its powers vx <- var(x) vx2 <- vx%*%vx vx4 <- vx2%*%vx2 vx8 <-...
Consider the following data on distances traveled by 100 people to visit the local park. distance...
Consider the following data on distances traveled by 100 people to visit the local park. distance freq 1-8 30 9-16 20 17-24 25 25-32 10 33-40 15 Expand and construct the table adding columns for relative frequency and cumulative relative frequency. Then plot Histogram, Frequency Polygon and Ogive Curve.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT