added code

This commit is contained in:
Morten Hjorth-Jensen
2020-09-17 06:42:45 +02:00
parent 1256b2fc28
commit 2ae023f9bb
4 changed files with 286 additions and 0 deletions
+100
View File
@@ -0,0 +1,100 @@
1 21 1 0
2 23 1 0
3 25 1 1
4 29 1 0
5 21 1 0
6 24 1 0
7 27 1 0
8 29 1 0
9 28 1 0
10 26 1 0
11 30 2 0
12 31 2 0
13 31 2 0
14 31 2 1
15 32 2 0
16 34 2 0
17 34 2 0
18 31 2 0
19 32 2 0
20 32 2 0
21 33 2 0
22 34 2 0
23 31 2 1
24 30 2 0
25 33 2 0
26 36 3 1
27 35 3 0
28 35 3 0
29 38 3 0
30 37 3 1
31 36 3 0
32 35 3 0
33 39 3 0
34 39 3 0
35 38 3 1
36 37 3 0
37 37 3 0
38 40 4 0
39 41 4 1
40 44 4 0
41 44 4 0
42 43 4 1
43 42 4 0
44 41 4 0
45 40 4 1
46 42 4 0
47 42 4 0
48 43 4 0
49 44 4 1
50 44 4 0
51 42 4 0
52 41 4 1
53 45 5 0
54 45 5 1
55 49 5 0
56 48 5 1
57 47 5 0
58 49 5 1
59 46 5 1
60 45 5 0
61 49 5 1
62 48 5 0
63 47 5 1
64 46 5 0
65 47 5 0
66 50 6 1
67 51 6 1
68 51 6 0
69 54 6 1
70 53 6 1
71 51 6 0
72 52 6 1
73 54 6 0
74 55 7 1
75 56 7 1
76 58 7 0
77 59 7 1
78 59 7 1
79 58 7 0
80 55 7 1
81 56 7 1
82 57 7 1
83 58 7 1
84 59 7 0
85 55 7 1
86 56 7 1
87 57 7 1
88 58 7 0
89 59 7 1
90 56 7 1
91 60 8 1
92 65 8 1
93 67 8 1
94 66 8 0
95 63 8 1
96 61 8 1
97 69 8 1
98 65 8 1
99 64 8 1
100 63 8 0
1 1 21 1 0
2 2 23 1 0
3 3 25 1 1
4 4 29 1 0
5 5 21 1 0
6 6 24 1 0
7 7 27 1 0
8 8 29 1 0
9 9 28 1 0
10 10 26 1 0
11 11 30 2 0
12 12 31 2 0
13 13 31 2 0
14 14 31 2 1
15 15 32 2 0
16 16 34 2 0
17 17 34 2 0
18 18 31 2 0
19 19 32 2 0
20 20 32 2 0
21 21 33 2 0
22 22 34 2 0
23 23 31 2 1
24 24 30 2 0
25 25 33 2 0
26 26 36 3 1
27 27 35 3 0
28 28 35 3 0
29 29 38 3 0
30 30 37 3 1
31 31 36 3 0
32 32 35 3 0
33 33 39 3 0
34 34 39 3 0
35 35 38 3 1
36 36 37 3 0
37 37 37 3 0
38 38 40 4 0
39 39 41 4 1
40 40 44 4 0
41 41 44 4 0
42 42 43 4 1
43 43 42 4 0
44 44 41 4 0
45 45 40 4 1
46 46 42 4 0
47 47 42 4 0
48 48 43 4 0
49 49 44 4 1
50 50 44 4 0
51 51 42 4 0
52 52 41 4 1
53 53 45 5 0
54 54 45 5 1
55 55 49 5 0
56 56 48 5 1
57 57 47 5 0
58 58 49 5 1
59 59 46 5 1
60 60 45 5 0
61 61 49 5 1
62 62 48 5 0
63 63 47 5 1
64 64 46 5 0
65 65 47 5 0
66 66 50 6 1
67 67 51 6 1
68 68 51 6 0
69 69 54 6 1
70 70 53 6 1
71 71 51 6 0
72 72 52 6 1
73 73 54 6 0
74 74 55 7 1
75 75 56 7 1
76 76 58 7 0
77 77 59 7 1
78 78 59 7 1
79 79 58 7 0
80 80 55 7 1
81 81 56 7 1
82 82 57 7 1
83 83 58 7 1
84 84 59 7 0
85 85 55 7 1
86 86 56 7 1
87 87 57 7 1
88 88 58 7 0
89 89 59 7 1
90 90 56 7 1
91 91 60 8 1
92 92 65 8 1
93 93 67 8 1
94 94 66 8 0
95 95 63 8 1
96 96 61 8 1
97 97 69 8 1
98 98 65 8 1
99 99 64 8 1
100 100 63 8 0
+101
View File
@@ -0,0 +1,101 @@
ID Age Agegroup CHD
1 21 1 0
2 23 1 0
3 25 1 1
4 29 1 0
5 21 1 0
6 24 1 0
7 27 1 0
8 29 1 0
9 28 1 0
10 26 1 0
11 30 2 0
12 31 2 0
13 31 2 0
14 31 2 1
15 32 2 0
16 34 2 0
17 34 2 0
18 31 2 0
19 32 2 0
20 32 2 0
21 33 2 0
22 34 2 0
23 31 2 1
24 30 2 0
25 33 2 0
26 36 3 1
27 35 3 0
28 35 3 0
29 38 3 0
30 37 3 1
31 36 3 0
32 35 3 0
33 39 3 0
34 39 3 0
35 38 3 1
36 37 3 0
37 37 3 0
38 40 4 0
39 41 4 1
40 44 4 0
41 44 4 0
42 43 4 1
43 42 4 0
44 41 4 0
45 40 4 1
46 42 4 0
47 42 4 0
48 43 4 0
49 44 4 1
50 44 4 0
51 42 4 0
52 41 4 1
53 45 5 0
54 45 5 1
55 49 5 0
56 48 5 1
57 47 5 0
58 49 5 1
59 46 5 1
60 45 5 0
61 49 5 1
62 48 5 0
63 47 5 1
64 46 5 0
65 47 5 0
66 50 6 1
67 51 6 1
68 51 6 0
69 54 6 1
70 53 6 1
71 51 6 0
72 52 6 1
73 54 6 0
74 55 7 1
75 56 7 1
76 58 7 0
77 59 7 1
78 59 7 1
79 58 7 0
80 55 7 1
81 56 7 1
82 57 7 1
83 58 7 1
84 59 7 0
85 55 7 1
86 56 7 1
87 57 7 1
88 58 7 0
89 59 7 1
90 56 7 1
91 60 8 1
92 65 8 1
93 67 8 1
94 66 8 0
95 63 8 1
96 61 8 1
97 69 8 1
98 65 8 1
99 64 8 1
100 63 8 0
+43
View File
@@ -0,0 +1,43 @@
# Common imports
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.model_selection import train_test_split
from sklearn.utils import resample
from sklearn.metrics import mean_squared_error
from IPython.display import display
# Where to save the figures and data files
PROJECT_ROOT_DIR = "Results"
FIGURE_ID = "Results/FigureFiles"
DATA_ID = "DataFiles/"
if not os.path.exists(PROJECT_ROOT_DIR):
os.mkdir(PROJECT_ROOT_DIR)
if not os.path.exists(FIGURE_ID):
os.makedirs(FIGURE_ID)
if not os.path.exists(DATA_ID):
os.makedirs(DATA_ID)
def image_path(fig_id):
return os.path.join(FIGURE_ID, fig_id)
def data_path(dat_id):
return os.path.join(DATA_ID, dat_id)
def save_fig(fig_id):
plt.savefig(image_path(fig_id) + ".png", format='png')
infile = open(data_path("chddata.csv"),'r')
# Read the chd data as csv file and organize the data into two arrays with density and energies
chd = pd.read_csv(infile, names=('ID', 'Age', 'Agegroup', 'CHD'))
display(chd)
output = chd['CHD']
age = chd['Age']
agegroup = chd['Agegroup']
numberID = chd['ID']
display(output)
+42
View File
@@ -0,0 +1,42 @@
# Common imports
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.model_selection import train_test_split
from sklearn.utils import resample
from sklearn.metrics import mean_squared_error
from IPython.display import display
# Where to save the figures and data files
PROJECT_ROOT_DIR = "Results"
FIGURE_ID = "Results/FigureFiles"
DATA_ID = "DataFiles/"
if not os.path.exists(PROJECT_ROOT_DIR):
os.mkdir(PROJECT_ROOT_DIR)
if not os.path.exists(FIGURE_ID):
os.makedirs(FIGURE_ID)
if not os.path.exists(DATA_ID):
os.makedirs(DATA_ID)
def image_path(fig_id):
return os.path.join(FIGURE_ID, fig_id)
def data_path(dat_id):
return os.path.join(DATA_ID, dat_id)
def save_fig(fig_id):
plt.savefig(image_path(fig_id) + ".png", format='png')
infile = open(data_path("chddata.csv"),'r')
# Read the chd data as csv file and organize the data into two arrays with density and energies
chd = pd.read_csv(infile, names=('ID', 'Age', 'Agegroup', 'CHD'))
output = chd['CHD']
age = chd['Age']
agegroup = chd['Agegroup']
numberID = chd['ID']
display(output)