update on logreg slides

This commit is contained in:
Morten Hjorth-Jensen
2020-09-18 06:12:43 +02:00
parent 740ca4964d
commit 59a9e35caf
2 changed files with 195 additions and 100 deletions
File diff suppressed because one or more lines are too long
+3 -4
View File
@@ -1043,7 +1043,7 @@ the probability of a given category. This leads us to the logistic function.
!split
===== Simple example =====
The following example on data for coronary heart disease (CHD) as function of age may serve as an illustration. In the code here we read and plot for whether a person has had CHD (output = 1) or not (output = 0) is plotted against age. Clearly, the figure shows that attempting to make a standard lineae regression fit may not be very meaningful.
The following example on data for coronary heart disease (CHD) as function of age may serve as an illustration. In the code here we read and plot whether a person has had CHD (output = 1) or not (output = 0). This ouput is plotted the person's against age. Clearly, the figure shows that attempting to make a standard linear regression fit may not be very meaningful.
!bc pycod
# Common imports
@@ -1494,12 +1494,11 @@ import seaborn as sns
correlation_matrix = cancerpd.corr().round(1)
# use the heatmap function from seaborn to plot the correlation matrix
# annot = True to print the values inside the square
plt.figure(figsize=(15,8))
sns.heatmap(data=correlation_matrix, annot=True)
plt.show()
#print eigvalues of correlation matrix
EigValues, EigVectors = np.linalg.eig(correlation_matrix)
print(EigValues)
!ec
!split