Read the Following Statements: Int a = 5; Int B = 3; Int C = 7; B = a; a = C; C = B;

data analysis with python cognitive class answers

Enroll Here: Data Assay with Python

Module 1 – Introduction

Question 1: What does CSV stand for ?

  • Comma Separated Values
  • Car Sold values
  • Car State values
  • None of the higher up

Question 2: In the data ready what represents an aspect or feature?

  • Row
  • Column
  • Each element in the data ready

Question 3: What is another name for the variable that we desire to predict?

  • Target
  • Feature
  • Dataframe

Question iv: What is the control to display the first five rows of a dataframe df?

  • df.head()
  • df.tail()

Question v: what control do you utilise to go the data type of each row of the dataframe df?

  • df.dtypes
  • df.caput()
  • df.tail()

Question 6: How do you go a statistical summary of a dataframe df?

  • df.describe()
  • df.caput()
  • df,tails()

Question 7: If yous use the method describe() without changing whatever of the arguments you volition get a statistical summary of all the columns of blazon object?

  • Faux
  • True

Module ii – Data Wrangling

Question 1: Consider the dataframe "df" what is the event of the following operation df['symbolling'] = df['symbolling'] + i?:

  • Every chemical element in the column "symbolling" volition increase by one
  • Every element in the row "symbolling" will increase by i
  • Every element in the dataframe will increase by one

Question 2: Consider the dataframe "df", what does the command df.rename(columns={'a':'b'}) modify almost the dataframe "df"

  • rename cavalcade "a" of the dataframe to "b"
  • rename the row "a" to "b"
  • nothing as you must set the parameter "inplace =True "

Question three: Consider the dataframe "df" , what is the consequence of the post-obit operation df['price'] = df['price'].astype(int) ?

  • convert or bandage the row 'price' to an integer value
  • convert or cast the column 'cost' to an integer value
  • convert or cast the entire dataframe to an integer value

Question 4: Consider the column of the dataframe df['a']. The colunm has been standardized. What is the standard deviation of the values, i.e the outcome of applying the following operation df['a'].std() :

  • 1
  • 0
  • iii

Question 5: Consider the column of the dataframe df['Fuel'], with 2 values 'gas' and' diesel'. What will exist the proper noun of the new colunms pd.get_dummies(df['Fuel']) ?

  • ane and 0
  • Just diesel
  • Merely gas
  • Gas and diesel fuel

Question half dozen: What are the values of the new columns from part 5 a)

  • 1 and 0
  • Merely diesel
  • Just gas
  • Gas and diesel

Module 3 – Exploratory Information Analysis

Question i: Consider the dataframe "df". Which method provides the summary statistics?

  • df.describe()
  • df.head()
  • df.tail()
  • df.summary()

Question ii: Consider the post-obit dataframe:

df_test = df['torso-fashion', 'cost']

The following operations is applied:

df_grp = df_test.groupby(['torso-style'], as_index=Simulated).mean()

What are resulting values of df_grp['cost']:

  • The average price for each torso mode
  • The average price
  • The average body manner

Question 3: Correlation implies causation :

  • False
  • True

Question four: What is the minimum possible value of Pearson's Correlation :

  • 1
  • -100
  • -1

Question v: What is the Pearson correlation between variables X and Y, if Ten=Y:

  • -1
  • 1
  • 0
  • X
  • Y

Module iv – Model Development

Question i: Let X be a dataframe with 100 rows and 5 columns, permit y exist the target with 100 samples,bold all the relevant libraries and information accept been imported, the following line of code has been executed:

LR = LinearRegression()

LR.fit(Ten, y)

yhat = LR.predict(Ten)

How many samples does yhat contain :

  • five
  • 500
  • 100
  • 0

Question 2: What value of R^2 (coefficient of determination) indicates your model performs all-time ?

  • -100
  • -1
  • 0
  • 1

Question 3: What statement is truthful almost Polynomial linear regression

  • Polynomial linear regression is not linear in any way
  • Although the predictor variables of Polynomial linear regression are not linear the human relationship between the parameters or coefficients is linear.
  • Polynomial linear regression uses wavelets

Question iv: The larger the mean square error, the meliorate your model has performed

  • False
  • True

Question 5: Assume all the libraries are imported, y is the target and X is the features or dependent variables, consider the following lines of code:

Input = [('scale', StandardScaler()), ('model', LinearRegression())]

pipe = Pipeline(Input)

pipe.fit(X,y)

ypipe = pipe.predict(X)

What take we just done in the above code?

  • Polynomial transform, Standardize the information, then perform a prediction using a linear regression model
  • Standardize the information, and so perform prediction using a linear regression model
  • Polynomial transform then Standardize the data

Module 5 – Model Evaluation:

Question 1: In the following plot, the vertical access shows the mean square error andthe horizontal axis represents the order of the polynomial. The cherry-red line represents the training error the blue line is the test fault. What is the all-time order of the polynomial given the possible choices in the horizontal axis?

  • 2
  • eight
  • 16

Question two: What is the  use of the "train_test_split" office such that 40% of the data samples will be utilized for testing, the parameter "random_state" is ready to naught, and the input variables for the features and targets are_data, y_data respectively.

  • train_test_split(x_data, y_data, test_size=0, random_state=0.four)
  • train_test_split(x_data, y_data, test_size=0.4, random_state=0)
  • train_test_split(x_data, y_data)

Question three: What is the output of cross_val_score(lre, x_data, y_data, cv=ii)?

  • The predicted values of the examination data using cross validation.
  • The boilerplate R^2 on the test data for each of the two folds
  • This function finds the free parameter blastoff

Question 4: What is the lawmaking to create a ridge regression object "RR" with an alpha term equal x

  • RR=LinearRegression(alpha=10)
  • RR=Ridge(alpha=10)
  • RR=Ridge(alpha=1)

Question 5: What dictionary value would nosotros use to perform a grid search for the following values of alpha: i,10, 100. No other parameter values should be tested

  • alpha=[ane,10,100]
  • [{'alpha': [1,ten,100]}]
  • [{'alpha': [0.001,0.1,1, 10, 100, 1000,10000,100000,100000],'normalize':[True,Fake]} ]

Data Analysis with Python Concluding Exam Answers

Question 1: Question 1: What does the following command do:

df.dropna(subset=["toll"], centrality=0)

  • Driblet the "non a number" from the cavalcade toll
  • Drib the row cost
  • Rename the data frame price

Question 2: How would you provide many of the summery statistics for all the columns in the dataframe "df":

  • df.describe(include = "all")
  • df.head()
  • type(df)
  • df.shape

Question 3: How would y'all notice the shape of the dataframe df

  • df.describe()
  • df.caput()
  • type(df)
  • df.shape

Question iv: What task does the post-obit command to df.to_csv("A.csv") perform

  • change the name of the column to "A.csv"
  • load the data from a csv file chosen "A" into a dataframe
  • Save the dataframe df to a csv file called "A.csv"

Question 5: What job does the following line of code perform:

df['peak-rpm'].replace(np.nan, 5,inplace=True)

  • supplant the non a number values with 5 in the column 'peak-rpm'
  • rename the column 'peak-rpm' to v
  • add 5 to the data frame

Question 6: What task does the following line of lawmaking perform:

df['peak-rpm'].replace(np.nan, 5,inplace=True)

  • replace the non a number values with five in the column 'peak-rpm'
  • rename the column 'superlative-rpm' to 5
  • add together 5 to the data frame

Question 7: How do you "one hot encode" the cavalcade 'fuel-blazon' in the dataframe df

  • pd.get_dummies(df["fuel-type"])
  • df.hateful(["fuel-type"])
  • df[df["fuel-type"])==one ]=1

Question 8: What does the vertical axis in a scatter plot represent

  • contained variable
  • dependent variable

Question 9: What does the horizontal axis in a besprinkle plot stand for

  • contained variable
  • dependent variable

Question x: If we accept ten columns and 100 samples how large is the output of df.corr()

  • 10 10 100
  • 10 x 10
  • 100×100
  • 100×100

Question 11: what is the largest possible chemical element resulting in the post-obit operation "df.corr()"

  • 100
  • 1000
  • ane

Question 12: if the Pearson Correlation of two variables is cipher:

  • the 2 variable have zero hateful
  • the two variables are not correlated

Question 13: if the p value of the Pearson Correlation is 1:

  • the variables are correlated
  • the variables are not correlated
  • none of the above

Question fourteen: What does the following line of code do: lm = LinearRegression()

  • fit a regression object lm
  • create a linear regression object
  • predict a value

Question 15: If the predicted role is:

Yhat = a + b1 X1 + b2 X2 + b3 X3 + b4 X4

The method is

  • Polynomial Regression
  • Multiple Linear Regression

Question 16: What steps exercise the following lines of code perform:

Input=[('calibration',StandardScaler()),('model',LinearRegression())]

pipe=Pipeline(Input)

pipe.fit(Z,y)

ypipe=piping.predict(Z)

  • Standardize the data, then perform a polynomial transform on the features Z
  • find the correlation between Z and y
  • Standardize the data, and then perform a prediction using a linear regression model using the features Z and targets y

Question 17: What is the maximum value of R^2 that can be obtained

  • 10
  • 1
  • 0

Question xviii: We create a polynomial feature every bit follows "PolynomialFeatures(caste=2)", what is the order of the polynomial

  • 0
  • 1
  • 2

Question 19: You have a linear model the average R^2 value on your training information is 0.5, you perform a 100th order polynomial transform on your data then use these values to train some other model, your boilerplate R^two is 0.99 which annotate is correct

  • 100-th society polynomial volition work improve on unseen data
  • You should always employ the simplest model
  • the results on your preparation data is not the best indicator of how your model performs, you should use your test data to get a beter idea

Question twenty:Y'all train a ridge regression model, yous get a R^2 of 1 on your training data and you go a R^2 of 0 on your validation data, what should you do:

  • Nada your model performs flawlessly on your test data
  • your model is nether plumbing equipment perform a polynomial transform
  • your model is overfitting, increment the parameter alpha

kellyfriver.blogspot.com

Source: https://priyadogra.com/data-analysis-with-python-cognitive-class-answers/

0 Response to "Read the Following Statements: Int a = 5; Int B = 3; Int C = 7; B = a; a = C; C = B;"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel