Coefficient of determination or R2 or also goodness of fit is the key output used in regression analysis. It can tell the proportion of variance in target variables predicted from the features or attributes. It is the square of the correlation between actual and predicted output in a regression model.it always ranges…
Data Science
Answered Jan 15, 2020
·
1.9K Views
Read answer →
Let us load housing data to perform linear regression using keras. import matplotlib.pyplot as plt import pandas as pd import numpy as np Now we will load the data df = pd.read_csv('../data/housing-data.csv') Now we create feature and target variables X = df[['sqft', 'bdrms', 'age']].values y = df['price'].values Now…
Data Science
Answered Jan 15, 2020
·
2.2K Views
Read answer →
For sorting and ordering a dataframe, we need to create a dataframe. import pandas as pd df=pd.DataFrame({'col2':[444,555,666,444],'col3':['abc','def','ghi','xyz']}) df.head() Now we sort and order the dataframe df.sort_values(by='col2')
Data Science
Answered Jan 15, 2020
·
1.4K Views
Read answer →
To fill a null values with something else, let us create a dataframe having some null values import numpy as np df = pd.DataFrame({'col1':[1,2,3,np.nan], 'col2':[np.nan,555,666,444], 'col3':['abc','def','ghi','xyz']}) df.he
Data Science
Answered Jan 15, 2020
·
1.9K Views
Read answer →
To permanently delete or remove a column, we have to create a dataframe to implement the operation. import pandas as pd df = pd.DataFrame({'col1':[1,2,3,4],'col2':[444,555,666,444],'col3':['abc','def','ghi','xyz']}) df.head()
Data Science
Answered Jan 15, 2020
·
1.9K Views
Read answer →
For selecting multiple data based on criteria, we have to create a simple dataframe to illustrate the dataset. import pandas as pd df = pd.DataFrame({'col1':[1,2,3,4],'col2':[444,555,666,444],'col3':['abc','def','ghi','xyz']}) df.head() Now we Select from DataFrame using criteria from multiple columns newdf = df[(df[&#
Data Science
Answered Jan 15, 2020
·
1.7K Views
Read answer →
To perform a groupby function, we need to create a dataframe.Let us create a dataframe. import pandas as pd # Create dataframe data = {'Company':['GOOG','GOOG','MSFT','MSFT','FB','FB'], 'Person':['Sam','Charlie','Amy','Vanessa','Carl','Sarah'], 'Sales':[200,120,340,124,243,3
Data Science
Answered Jan 15, 2020
·
2.2K Views
Read answer →
Yes DML operations (update/insert/ delete) are allowed in the procedure also (DDL: such as create/ alter/drop/ truncate) is also allowed in the procedures. In case if the procedure will get executed in parallel then DDL on a permanent table is not recommended as there could be chances that one procedure has already…
Data Science
Answered Jan 15, 2020
·
1.7K Views
Read answer →
We can get the deviation in the form of standard error from the following code import numpy as np import pandas as pd import statsmodels.api as sm import math U = [12.5, 10.0, 7.6, 6.0, 4.4, 3.1, 2.5, 1.5, 1.0, 0.5, 0.3] U_0 = 12.5 y = [] for number in U: y.append(math.log(number/U_0, math.e)) y = np.array(y) t =…
Data Science
Answered Jan 15, 2020
·
1.7K Views
Read answer →
import numpy as np from sklearn.linear_model import LinearRegression from sklearn.decomposition import PCA X = np.random.rand(1000,200) y = np.random.rand(1000,1) model.fit(X,y) pca = PCA(n_components=8) pca.fit(X) PCA(copy=True, iterated_power='auto', n_components=3, random_state=None, svd_solver='auto', tol=0.0,…
Data Science
Answered Jan 15, 2020
·
1.5K Views
Read answer →
Data Science
Answered Jan 15, 2020
·
1.1K Views
Read answer →
import matplotlib.pyplot as plt from matplotlib import style import numpy as np style.use("fivethirtyeight") x=[[1],[2],[3],[4],[5],[6],[7],[8],[9],[10]] y=[[3],[5],[9],[9],[11],[13],[16],[17],[19],[21]] X=np.array(x) Y=np.array(y) learning_rate=0.015
Data Science
Answered Jan 15, 2020
·
985 Views
Read answer →