In [15]:
import h2o
import numpy as np
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from h2o.estimators.glrm import H2OGeneralizedLowRankEstimator
In [16]:
h2o.init()
Warning: Version mismatch. H2O is version 3.5.0.99999, but the python package is version UNKNOWN.
H2O cluster uptime:
5 minutes 50 seconds 603 milliseconds
H2O cluster version:
3.5.0.99999
H2O cluster name:
ludirehak
H2O cluster total nodes:
1
H2O cluster total memory:
3.56 GB
H2O cluster total cores:
8
H2O cluster allowed cores:
8
H2O cluster healthy:
True
H2O Connection ip:
127.0.0.1
H2O Connection port:
54321
In [17]:
from h2o.h2o import _locate # private function. used to find files within h2o git project directory.
# Import walking gait data
gait = h2o.upload_file(path=_locate("smalldata/glrm_test/subject01_walk1.csv"))
gait.describe()
Parse Progress: [##################################################] 100%
Uploaded pyf9354afc-0978-42fa-8c42-4774d23d80d3 into cluster with 151 rows and 124 cols
Rows: 151 Cols: 124
Chunk compression summary:
chunk_type
chunk_name
count
count_percentage
size
size_percentage
C2S
2-Byte Fractions
1
0.8
386 B
0.5
C4S
4-Byte Fractions
123
99.19355
82.6 KB
99.54594
Frame distribution summary:
size
number_of_rows
number_of_chunks_per_column
number_of_chunks
172.16.2.38:54321
83.0 KB
151.0
1.0
124.0
mean
83.0 KB
151.0
1.0
124.0
min
83.0 KB
151.0
1.0
124.0
max
83.0 KB
151.0
1.0
124.0
stddev
0 B
0.0
0.0
0.0
total
83.0 KB
151.0
1.0
124.0
Column-by-Column Summary:
Time
R.ASIS.X
R.ASIS.Y
R.ASIS.Z
L.ASIS.X
L.ASIS.Y
L.ASIS.Z
V.Sacral.X
V.Sacral.Y
V.Sacral.Z
R.Thigh.Upper.X
R.Thigh.Upper.Y
R.Thigh.Upper.Z
R.Thigh.Front.X
R.Thigh.Front.Y
R.Thigh.Front.Z
R.Thigh.Rear.X
R.Thigh.Rear.Y
R.Thigh.Rear.Z
L.Thigh.Upper.X
L.Thigh.Upper.Y
L.Thigh.Upper.Z
L.Thigh.Front.X
L.Thigh.Front.Y
L.Thigh.Front.Z
L.Thigh.Rear.X
L.Thigh.Rear.Y
L.Thigh.Rear.Z
R.Shank.Upper.X
R.Shank.Upper.Y
R.Shank.Upper.Z
R.Shank.Front.X
R.Shank.Front.Y
R.Shank.Front.Z
R.Shank.Rear.X
R.Shank.Rear.Y
R.Shank.Rear.Z
L.Shank.Upper.X
L.Shank.Upper.Y
L.Shank.Upper.Z
L.Shank.Front.X
L.Shank.Front.Y
L.Shank.Front.Z
L.Shank.Rear.X
L.Shank.Rear.Y
L.Shank.Rear.Z
R.Heel.X
R.Heel.Y
R.Heel.Z
R.Midfoot.Sup.X
R.Midfoot.Sup.Y
R.Midfoot.Sup.Z
R.Midfoot.Lat.X
R.Midfoot.Lat.Y
R.Midfoot.Lat.Z
R.Toe.Tip.X
R.Toe.Tip.Y
R.Toe.Tip.Z
L.Heel.X
L.Heel.Y
L.Heel.Z
L.Midfoot.Sup.X
L.Midfoot.Sup.Y
L.Midfoot.Sup.Z
L.Midfoot.Lat.X
L.Midfoot.Lat.Y
L.Midfoot.Lat.Z
L.Toe.Tip.X
L.Toe.Tip.Y
L.Toe.Tip.Z
Sternum.X
Sternum.Y
Sternum.Z
R.Acromium.X
R.Acromium.Y
R.Acromium.Z
L.Acromium.X
L.Acromium.Y
L.Acromium.Z
R.Bicep.X
R.Bicep.Y
R.Bicep.Z
L.Bicep.X
L.Bicep.Y
L.Bicep.Z
R.Elbow.X
R.Elbow.Y
R.Elbow.Z
L.Elbow.X
L.Elbow.Y
L.Elbow.Z
R.Wrist.Med.X
R.Wrist.Med.Y
R.Wrist.Med.Z
R.Wrist.Lat.X
R.Wrist.Lat.Y
R.Wrist.Lat.Z
L.Wrist.Med.X
L.Wrist.Med.Y
L.Wrist.Med.Z
L.Wrist.Lat.X
L.Wrist.Lat.Y
L.Wrist.Lat.Z
R.Toe.Lat.X
R.Toe.Lat.Y
R.Toe.Lat.Z
R.Toe.Med.X
R.Toe.Med.Y
R.Toe.Med.Z
L.Toe.Lat.X
L.Toe.Lat.Y
L.Toe.Lat.Z
L.Toe.Med.X
L.Toe.Med.Y
L.Toe.Med.Z
R.Temple.X
R.Temple.Y
R.Temple.Z
L.Temple.X
L.Temple.Y
L.Temple.Z
Top.Head.X
Top.Head.Y
Top.Head.Z
type
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
mins
0.0
588.90717
1042.6
107.79163
600.01556
1028.7
-152.5
399.40009
1034.9
-21.44083
481.83603
732.70135
169.71159
535.63422
657.21033
74.20708
443.03299
613.54547
168.15961
468.19415
737.72083
-194.3
550.69415
684.75494
-133.588
435.01773
627.49988
-170.9
319.34705
444.43289
157.69023
376.44724
403.25574
102.54192
293.89526
368.28577
165.6133
341.2023
438.80435
-173.0
365.72482
375.95242
-121.0
304.46347
393.67728
-173.4
68.60076
56.43383
59.948
190.98845
76.90237
57.86759
157.32503
62.79
159.97461
242.90858
33.52863
102.0894
76.37951
58.7473
-74.0361
211.85968
69.02702
-69.30095
185.39088
48.22646
-140.1
254.42706
36.65646
-88.18266
627.38177
1342.9
-35.20795
511.80032
1427.4
164.48206
551.72424
1453.6
-249.9
485.94559
1227.9
216.05853
531.12134
1217.6
-266.6
424.32767
1129.1
242.29697
460.03223
1123.8
-304.8
535.87439
889.81964
262.1105
486.99316
876.53882
304.71069
554.35272
895.92426
-240.6
502.82971
886.58942
-300.9
179.7708
33.33099
181.24631
218.04131
36.96362
71.79319
199.80693
36.02512
-153.1
228.04898
42.9706
-54.88903
675.97009
1562.3
44.15432
683.50897
1567.3
-94.07465
614.13971
1740.4
-19.48838
maxs
2.5
641.12048
1091.4
180.07411
661.46918
1078.0
-80.37424
451.5914
1077.8
55.36993
692.89514
788.11365
217.07512
766.44531
750.72375
136.25021
728.67242
672.42242
209.89946
674.53168
783.71576
-138.1
773.97705
780.81445
-66.30186
713.16107
681.38623
-123.1844
719.69702
531.05676
200.56787
799.47015
457.5513
154.56749
751.88885
458.64368
202.59061
764.30676
494.35605
-116.5
821.66901
425.57733
-63.51654
750.77588
473.02411
-124.5
812.50183
320.70309
108.161
935.61414
198.72064
86.30818
934.44775
211.37376
188.70589
1073.9
179.28133
153.59363
821.7641
321.80249
-34.92287
971.31763
178.00603
-6.83138
955.73096
184.36398
-104.3698
1082.5
168.6488
-32.92321
673.89301
1393.9
43.75163
573.68665
1486.3
262.06827
609.36566
1507.8
-155.9
593.64148
1288.6
305.86801
643.91699
1271.8
-196.6
567.0025
1193.1
339.82635
608.93268
1186.4
-230.9
772.61859
1003.1
312.96448
751.62823
969.89471
362.03549
793.86859
998.83923
-188.3
768.91589
958.34167
-249.4
1026.0
136.89597
218.5173
1029.9
153.3546
113.4589
1024.1
133.35187
-111.9407
1039.4
146.49858
-9.44173
740.63611
1640.0
139.15808
754.62506
1647.9
0.84904
752.89178
1809.1
85.29955
mean
1.25
613.8
1066.0
147.3
621.8
1054.0
-113.1
419.6
1059.1
21.6
604.9
752.1
198.4
673.9
697.9
109.0
611.8
633.9
191.2
585.5
757.0
-165.3
678.7
728.7
-105.4
595.9
651.8
-150.8
546.6
475.6
178.2
612.1
427.5
128.7
542.3
394.8
183.8
576.6
453.6
-145.6
613.4
399.5
-93.9
549.9
418.0
-150.9
416.5
129.3
90.9
548.3
111.6
69.8
529.7
98.3
174.2
666.9
65.9
120.6
434.4
129.9
-51.1
586.8
102.8
-29.9
567.2
96.3
-123.8
681.1
67.5
-57.8
644.4
1368.9
7.6
541.7
1458.7
215.4
579.5
1480.7
-200.6
547.0
1259.3
262.8
596.1
1244.5
-229.9
504.2
1157.8
292.1
548.3
1148.8
-267.9
659.5
943.8
282.8
620.9
926.0
331.3
672.9
938.1
-214.6
631.5
922.0
-274.0
601.5
61.9
194.7
619.82417
68.5
86.6
618.3
65.9
-132.6
638.6
72.3
-31.8
705.7
1598.0
94.1
718.7
1603.0
-44.3
698.9
1773.0
33.6
sigma
0.7
14.8
14.3
24.6
15.4
14.0
24.4
14.1
12.7
23.9
67.0
14.4
15.4
76.7
25.9
18.0
95.5
14.8
12.7
67.4
11.6
17.8
73.0
26.2
21.1
94.2
12.0
13.8
134.9
25.3
10.8
144.5
16.5
12.0
154.8
28.8
8.4
143.0
17.1
14.9
155.0
15.6
14.9
151.6
25.4
13.3
237.4
86.8
9.3
244.6
37.9
7.6
251.1
44.4
6.4
267.5
36.2
13.6
241.5
83.3
9.6
252.6
30.6
12.5
255.4
36.3
9.3
271.4
34.5
13.7
12.1
14.7
27.0
15.8
16.4
32.9
16.8
15.4
31.8
32.7
16.9
29.3
36.9
15.2
23.3
45.9
18.4
31.3
50.6
17.8
23.1
79.0
30.0
13.8
88.3
24.8
15.1
79.9
27.5
13.2
87.5
19.8
13.6
267.8
31.3
9.0
262.6
31.4
10.5
269.2
30.7
11.0
265.9
28.9
11.8
19.0
19.8
31.9
20.3
20.9
31.7
43.7
17.7
34.5
zero_count
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
missing_count
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
In [18]:
# Plot first row of data on x- vs. y-coordinate features
gait_row = gait[1,:].drop("Time")
gait_row_np = np.array(h2o.as_list(gait_row))
x_coords = range(0, gait_row_np.shape[1], 3)
y_coords = range(1, gait_row_np.shape[1], 3)
x_pts = gait_row_np[0,x_coords]
y_pts = gait_row_np[0,y_coords]
plt.plot(x_pts, y_pts, 'bo')
# Add feature labels to each point
feat_names = [nam[:-2] for nam in gait_row.col_names[1::3]]
for i in xrange(len(feat_names)):
plt.annotate(feat_names[i], xy = [x_pts[i], y_pts[i]])
plt.title("Location of Body Parts at Time 0")
plt.xlabel("X-Coordinate Weight")
plt.ylabel("Y-Coordinate Weight")
plt.show()
In [19]:
# Basic GLRM using quadratic loss and no regularization (PCA)
model = H2OGeneralizedLowRankEstimator(k=10, loss="Quadratic", regularization_x="None", regularization_y="None", max_iterations=1000)
model.train(x=range(1,gait.ncol), training_frame=gait)
model.show()
glrm Model Build Progress: [##################################################] 100%
Model Details
=============
H2OGeneralizedLowRankEstimator : Beta - Generalized Low Rank Model
Model Key: GLRM_model_python_1445562467796_5
Model Summary:
number_of_iterations
final_step_size
final_objective_value
15.0
0.0
338916.5
ModelMetricsGLRM: glrm
** Reported on train data. **
MSE: NaN
Sum of Squared Error (Numeric): 338916.511217
Misclassification Error (Categorical): 0.0
Scoring History:
timestamp
duration
iteration
step_size
objective
2015-10-22 18:13:41
0.064 sec
0.0
1.05
345883.2
2015-10-22 18:13:41
0.073 sec
1.0
0.7
345883.2
2015-10-22 18:13:41
0.082 sec
2.0
0.5
345883.2
2015-10-22 18:13:41
0.097 sec
3.0
0.3
345883.2
2015-10-22 18:13:41
0.106 sec
4.0
0.2
345883.2
2015-10-22 18:13:41
0.118 sec
5.0
0.1
345883.2
2015-10-22 18:13:41
0.129 sec
6.0
0.0
345883.2
2015-10-22 18:13:41
0.141 sec
7.0
0.0
345883.2
2015-10-22 18:13:41
0.150 sec
8.0
0.0
338916.5
2015-10-22 18:13:41
0.159 sec
9.0
0.0
338916.5
2015-10-22 18:13:41
0.169 sec
10.0
0.0
338916.5
2015-10-22 18:13:41
0.178 sec
11.0
0.0
338916.5
2015-10-22 18:13:41
0.188 sec
12.0
0.0
338916.5
2015-10-22 18:13:41
0.199 sec
13.0
0.0
338916.5
2015-10-22 18:13:41
0.209 sec
14.0
0.0
338916.5
In [20]:
# Plot objective function value each iteration
model_score = model.score_history()
plt.xlabel("Iteration")
plt.ylabel("Objective")
plt.title("Objective Function Value per Iteration")
print model_score
plt.plot(model_score["iteration"], model_score["objective"])
plt.show()
timestamp duration iteration step_size objective
0 2015-10-22 18:13:41 0.064 sec 0 1.050000 345883.210313
1 2015-10-22 18:13:41 0.073 sec 1 0.700000 345883.210313
2 2015-10-22 18:13:41 0.082 sec 2 0.466667 345883.210313
3 2015-10-22 18:13:41 0.097 sec 3 0.311111 345883.210313
4 2015-10-22 18:13:41 0.106 sec 4 0.155556 345883.210313
5 2015-10-22 18:13:41 0.118 sec 5 0.051852 345883.210313
6 2015-10-22 18:13:41 0.129 sec 6 0.012963 345883.210313
7 2015-10-22 18:13:41 0.141 sec 7 0.002593 345883.210313
8 2015-10-22 18:13:41 0.150 sec 8 0.002722 338916.504756
9 2015-10-22 18:13:41 0.159 sec 9 0.001815 338916.504756
10 2015-10-22 18:13:41 0.169 sec 10 0.001210 338916.504756
11 2015-10-22 18:13:41 0.178 sec 11 0.000807 338916.504756
12 2015-10-22 18:13:41 0.188 sec 12 0.000403 338916.504756
13 2015-10-22 18:13:41 0.199 sec 13 0.000134 338916.504756
14 2015-10-22 18:13:41 0.209 sec 14 0.000034 338916.504756
In [21]:
# Archetype to feature mapping (Y)
gait_y = model._model_json["output"]["archetypes"]
print gait_y
gait_y_np = np.array(model.archetypes())
x_coords = range(0, gait_y_np.shape[1], 3)
y_coords = range(1, gait_y_np.shape[1], 3)
# Plot archetypes on x- vs. y-coordinate features
for k in xrange(gait_y_np.shape[0]):
x_pts = gait_y_np[k, x_coords]
y_pts = gait_y_np[k, y_coords]
plt.plot(x_pts, y_pts, 'bo')
# Add feature labels to each point
feat_names = [nam[:-1] for nam in gait_y.col_header[1::3]]
for i in xrange(len(feat_names)):
plt.annotate(feat_names[i], xy = [x_pts[i], y_pts[i]])
plt.title("Feature Weights of Archetype " + str(k+1))
plt.xlabel("X-Coordinate Weight")
plt.ylabel("Y-Coordinate Weight")
plt.show()
Archetypes:
rasisx
rasisy
rasisz
lasisx
lasisy
lasisz
vsacralx
vsacraly
vsacralz
rthighupperx
rthighuppery
rthighupperz
rthighfrontx
rthighfronty
rthighfrontz
rthighrearx
rthighreary
rthighrearz
lthighupperx
lthighuppery
lthighupperz
lthighfrontx
lthighfronty
lthighfrontz
lthighrearx
lthighreary
lthighrearz
rshankupperx
rshankuppery
rshankupperz
rshankfrontx
rshankfronty
rshankfrontz
rshankrearx
rshankreary
rshankrearz
lshankupperx
lshankuppery
lshankupperz
lshankfrontx
lshankfronty
lshankfrontz
lshankrearx
lshankreary
lshankrearz
rheelx
rheely
rheelz
rmidfootsupx
rmidfootsupy
rmidfootsupz
rmidfootlatx
rmidfootlaty
rmidfootlatz
rtoetipx
rtoetipy
rtoetipz
lheelx
lheely
lheelz
lmidfootsupx
lmidfootsupy
lmidfootsupz
lmidfootlatx
lmidfootlaty
lmidfootlatz
ltoetipx
ltoetipy
ltoetipz
sternumx
sternumy
sternumz
racromiumx
racromiumy
racromiumz
lacromiumx
lacromiumy
lacromiumz
rbicepx
rbicepy
rbicepz
lbicepx
lbicepy
lbicepz
relbowx
relbowy
relbowz
lelbowx
lelbowy
lelbowz
rwristmedx
rwristmedy
rwristmedz
rwristlatx
rwristlaty
rwristlatz
lwristmedx
lwristmedy
lwristmedz
lwristlatx
lwristlaty
lwristlatz
rtoelatx
rtoelaty
rtoelatz
rtoemedx
rtoemedy
rtoemedz
ltoelatx
ltoelaty
ltoelatz
ltoemedx
ltoemedy
ltoemedz
rtemplex
rtempley
rtemplez
ltemplex
ltempley
ltemplez
topheadx
topheady
topheadz
Arch1
597.8
1064.7
179.0
610.0
1058.2
-81.9
405.6
1065.3
48.3
519.4
746.4
214.5
573.3
678.5
121.2
493.2
627.9
199.9
636.4
761.5
-140.8
731.3
754.9
-74.7
676.1
659.5
-133.7
391.9
464.8
182.4
461.2
415.4
129.8
387.5
377.4
185.0
717.5
462.5
-128.5
779.4
423.0
-83.8
704.2
416.4
-134.9
250.0
80.1
89.7
395.1
78.8
62.1
383.2
65.6
169.0
536.2
44.9
110.5
723.0
78.6
-43.0
886.3
117.1
-36.3
860.7
106.1
-130.8
994.9
117.4
-78.9
636.0
1372.7
36.8
544.4
1460.4
251.1
556.5
1486.1
-166.5
578.4
1259.6
297.4
538.1
1251.5
-203.8
556.0
1152.5
331.5
470.2
1165.8
-238.3
765.1
992.8
282.5
742.5
961.6
335.2
571.3
933.6
-203.3
520.5
924.5
-258.5
468.3
38.4
187.9
478.2
43.1
79.0
925.6
95.7
-147.1
951.3
105.6
-48.0
694.0
1610.2
124.1
701.4
1615.9
-14.8
667.0
1780.9
63.6
Arch2
608.6
1054.0
117.4
609.8
1040.1
-143.6
411.9
1050.8
-1.8
652.7
747.2
172.4
726.5
705.8
76.9
687.9
631.0
168.8
479.1
758.7
-189.4
561.7
698.4
-131.6
448.1
653.4
-168.8
687.0
453.2
159.1
775.9
445.3
113.2
728.3
377.4
170.8
363.2
449.9
-160.6
399.1
387.9
-111.8
330.4
415.3
-165.2
772.0
60.0
92.9
904.1
119.7
76.3
894.7
97.6
180.5
1043.3
143.5
131.9
169.9
104.4
-62.5
338.7
77.3
-45.3
319.9
68.2
-132.7
440.8
45.8
-62.7
642.7
1351.5
-15.9
537.4
1445.1
188.7
591.0
1468.2
-224.2
513.5
1248.9
234.8
629.3
1235.4
-251.9
453.1
1153.7
259.6
597.9
1131.9
-293.3
579.6
916.0
269.8
532.5
903.6
313.7
778.2
972.0
-214.2
747.9
937.4
-273.9
984.2
105.1
203.8
997.0
123.0
96.0
373.2
38.0
-139.6
395.1
47.3
-38.6
718.5
1569.1
71.7
735.2
1573.5
-66.1
736.6
1746.7
13.0
Arch3
613.9
1079.7
176.1
614.4
1074.4
-85.3
414.9
1075.3
53.0
578.3
755.0
216.1
639.3
695.1
121.4
570.9
632.5
203.5
641.8
777.2
-151.2
745.9
770.5
-98.8
681.4
674.2
-144.6
498.8
459.8
185.9
572.8
419.0
132.7
504.4
373.0
189.4
668.0
488.8
-144.2
690.5
422.0
-95.5
628.8
461.4
-147.7
399.8
72.5
94.8
544.2
78.7
67.0
531.9
62.9
173.5
685.9
48.8
113.9
431.9
209.3
-41.7
575.1
128.8
-34.9
547.7
131.9
-128.5
653.2
57.7
-72.6
640.1
1389.0
40.2
548.6
1472.1
257.5
558.9
1506.1
-161.7
574.8
1269.1
301.0
553.2
1269.1
-202.0
544.9
1162.3
332.3
491.2
1180.7
-239.2
731.7
969.9
302.8
699.2
944.7
354.0
587.5
945.6
-207.5
539.6
939.6
-265.4
619.0
38.1
191.2
630.2
46.3
81.2
586.3
80.5
-142.3
615.6
79.8
-42.9
698.4
1621.1
134.2
707.4
1629.3
-4.9
679.9
1795.9
77.1
Arch4
625.9
1079.6
128.6
643.6
1068.2
-131.5
436.1
1069.6
-4.6
629.1
757.5
194.3
712.6
702.7
118.4
643.0
636.5
196.6
617.4
761.9
-178.2
708.1
735.1
-111.3
626.6
653.7
-157.9
552.4
516.2
183.9
585.1
431.2
142.1
498.2
448.3
187.8
628.2
440.4
-148.7
673.4
391.7
-91.7
607.6
397.2
-154.9
239.7
306.2
76.9
330.5
189.7
72.2
290.7
195.4
170.6
376.3
61.9
132.2
532.0
75.8
-52.6
701.6
74.9
-23.5
686.0
68.8
-120.8
813.3
50.4
-52.7
656.2
1381.8
-25.3
548.4
1480.4
176.5
597.1
1483.5
-240.5
548.6
1282.1
231.9
626.7
1243.5
-256.6
500.2
1182.8
264.3
583.0
1144.3
-291.0
627.9
944.3
277.5
583.6
935.2
325.8
696.0
921.8
-235.9
653.2
908.9
-296.7
313.3
109.5
196.0
349.9
100.2
93.4
749.1
42.8
-128.6
763.6
51.6
-26.9
720.5
1604.6
52.9
736.2
1605.4
-85.5
731.6
1780.9
-11.9
Arch5
634.2
1068.9
157.3
625.1
1052.7
-102.3
432.5
1056.4
45.6
655.6
751.8
205.7
722.6
705.7
109.2
673.1
631.6
193.4
586.8
748.8
-165.1
689.7
717.7
-121.7
598.6
640.2
-159.3
635.0
456.9
179.9
708.4
421.8
122.4
648.5
370.7
184.2
534.3
468.3
-164.8
529.4
397.1
-112.8
486.5
457.0
-166.0
560.8
69.8
94.2
705.4
78.3
65.3
695.0
64.0
172.3
848.4
50.0
112.3
202.4
310.6
-56.0
292.9
159.1
-40.6
261.6
170.3
-132.4
323.5
59.2
-69.3
651.5
1371.7
36.9
551.7
1449.4
251.0
582.7
1493.1
-164.2
558.9
1246.4
289.45738
601.4
1255.8
-203.0
516.2
1142.4
313.3
552.5
1162.6
-245.4
665.9
918.7
304.0
623.1
900.9
350.7
649.9
928.8
-210.7
608.2
924.8
-273.6
782.6
40.5
188.6
792.9
48.0
79.5
276.6
106.5
-142.4
302.6
100.1
-42.7
708.0
1600.7
132.4
719.2
1609.7
-5.6
693.9
1776.2
77.0
Arch6
594.2
1052.2
174.7
615.1
1043.8
-86.2
405.8
1051.1
34.8
490.8
738.5
213.4
543.1
663.3
125.9
453.4
623.3
201.3
633.1
743.7
-139.4
726.9
735.9
-69.5
670.3
641.6
-127.9
332.9
471.1
185.3
394.5
410.8
134.7
315.3
386.1
188.8
728.7
444.3
-120.9
793.3
414.7
-71.2
724.1
397.1
-128.6
136.0
110.0
95.1
279.5
88.5
66.2
263.8
72.2
174.1
407.7
44.6
112.4
790.0
65.2
-44.0
945.1
122.7
-18.8
930.3
112.1
-114.5
1057.2
142.0
-50.0
634.3
1356.3
22.0
541.2
1449.6
232.9
561.5
1465.6
-185.8
573.0
1250.1
284.0
547.5
1229.5
-218.3
549.2
1143.8
321.1
482.6
1141.4
-253.1
756.1
977.1
277.0
733.2
948.6
332.2
582.2
909.0
-213.0
533.6
899.9
-270.2
341.0
34.9
193.0
355.6
39.8
81.9
998.0
111.5
-125.0
1012.3
123.1
-23.4
696.1
1592.0
105.5
705.8
1595.3
-33.7
680.5
1763.9
43.0
Arch7
607.8
1085.0
115.1
617.7
1062.5
-144.7
414.0
1071.3
-9.2
667.8
781.5
183.5
753.1
743.6
97.6
707.7
665.9
183.1
535.5
763.7
-185.5
623.1
720.1
-120.0
523.8
654.8
-162.5
658.2
511.5
170.5
726.3
454.8
129.3
646.7
427.9
179.2
484.5
441.7
-150.5
528.0
389.1
-96.6
460.3
400.6
-155.7
500.3
164.0
80.3
638.1
131.0
75.6
607.2
116.3
175.7
752.2
63.4
138.1
357.3
80.0
-51.9
525.2
74.9
-27.9
512.8
63.4
-119.3
637.5
47.8
-50.2
639.7
1381.7
-26.6
526.3
1477.4
173.1
588.3
1489.7
-240.3
506.6
1281.3
224.7
633.7
1254.4
-258.1
448.1
1186.3
251.3
602.9
1149.8
-296.3
565.0
943.9
270.2
516.6
935.1
313.8
765.3
970.8
-217.9
732.2
941.7
-278.6
676.5
66.3
203.8
707.8
76.0
99.2
572.7
40.6
-126.9
587.2
49.5
-25.4
703.4
1607.3
54.8
720.5
1610.7
-83.1
707.0
1783.6
-7.7
Arch8
621.3
1054.5
155.6
644.7
1048.2
-104.0
434.6
1050.4
14.7
539.3
737.7
206.0
603.2
663.5
126.7
513.3
619.6
200.9
660.9
747.6
-155.1
757.5
739.8
-89.1
695.1
645.4
-139.0
391.6
484.8
190.1
433.9
407.8
141.8
350.0
409.0
193.7
735.7
441.0
-132.3
788.3
398.8
-76.3
722.2
396.0
-140.9
107.0
211.8
99.3
221.4
129.7
73.5
195.9
118.8
177.3
302.4
38.3
116.1
696.1
72.7
-48.3
861.6
85.9
-16.8
849.2
77.1
-114.9
975.3
74.1
-44.3
657.9
1357.1
-2.9
558.4
1454.4
202.8
590.8
1461.9
-214.8
577.0
1255.7
255.9
590.3
1223.7
-240.4
542.5
1151.9
292.1
532.7
1131.7
-274.7
714.0
946.8
275.5
681.1
927.7
328.7
632.1
901.0
-228.7
584.0
891.2
-286.1
241.3
49.1
194.6
265.3
50.9
85.0
912.4
57.6
-121.9
925.8
67.3
-19.8
724.4
1580.0
78.8
738.1
1582.0
-59.4
733.1
1755.7
16.0
Arch9
626.6
1051.6
138.6
618.4
1035.5
-122.3
426.0
1040.9
30.2
681.9
747.5
188.9
755.3
710.8
91.2
717.7
630.5
177.2
504.7
746.3
-173.6
594.0
689.5
-125.2
482.7
639.8
-160.6
707.2
454.3
168.7
785.5
429.7
109.9
733.9
371.4
175.1
387.1
450.5
-161.5
397.7
379.9
-110.7
344.5
428.3
-165.8
690.5
66.8
93.8
833.0
84.4
64.5
823.5
68.5
171.1
976.7
69.9
109.5
91.7
203.0
-65.8
223.7
107.3
-37.5
199.4
95.4
-131.1
287.8
39.5
-55.0
647.1
1353.7
21.8
535.6
1433.1
230.3
587.9
1472.9
-183.5
523.5
1232.7
269.1
622.4
1237.7
-218.3
470.0
1132.6
289.4
585.0
1138.2
-262.9
602.8
897.6
292.0
555.9
883.0
335.6
727.6
935.3
-206.4
690.9
915.9
-268.8
911.3
49.9
187.8
922.2
60.4
78.1
226.9
47.0
-133.1
255.1
52.0
-32.5
702.6
1586.1
113.7
716.1
1593.6
-24.5
687.5
1761.6
55.4
Arch10
598.8
1051.4
123.3
602.5
1036.1
-137.0
403.3
1044.4
6.2
649.8
744.5
176.7
721.6
703.8
79.6
686.8
628.4
172.9
475.9
751.1
-179.1
558.3
693.2
-119.7
446.0
646.7
-158.6
689.4
450.0
163.5
776.9
444.7
115.4
733.1
375.5
174.5
364.0
442.6
-148.9
397.6
382.4
-96.2
332.1
407.4
-154.2
784.3
59.6
97.3
912.8
123.3
75.9
906.8
100.5
180.7
1051.2
151.5
126.8
172.2
96.8
-50.2
339.7
78.4
-25.2
323.0
65.7
-117.6
443.9
44.6
-46.1
629.7
1353.8
-6.9
512.8
1442.1
194.4
577.9
1466.1
-218.1
490.1
1245.6
239.0
626.6
1233.2
-243.4
429.2
1150.4
261.0
601.2
1127.7
-285.9
545.8
907.1
272.2
497.6
896.9
315.7
789.0
981.7
-194.6
762.8
943.2
-254.5
996.3
110.5
201.2
1005.3
129.3
92.4
378.7
37.6
-124.0
397.5
47.4
-23.0
681.9
1594.8
80.0
698.6
1602.3
-57.7
652.4
1769.1
19.1
In [22]:
# Projection into archetype space (X)
x_key = model._model_json["output"]["representation_name"]
gait_x = h2o.get_frame(x_key)
gait_x.show()
time_np = np.array(h2o.as_list(gait["Time"]))
gait_x_np = np.array(h2o.as_list(gait_x))
# Plot archetypes over time
lines = []
for i in xrange(gait_x_np.shape[1]):
lines += plt.plot(time_np, gait_x_np[:,i], '-')
plt.title("Archetypes over Time")
plt.xlabel("Time")
plt.ylabel("Archetypal Projection")
plt.legend(lines, gait_x.col_names)
plt.show()
H2OFrame with 151 rows and 10 columns:
Arch1
Arch2
Arch3
Arch4
Arch5
Arch6
Arch7
Arch8
Arch9
Arch10
0
1.132704
0.387077
-1.041831
-0.485789
0.752806
-0.234696
0.080678
1.026057
-0.461999
-0.142426
1
0.913236
0.356854
-0.852937
-0.514801
0.622235
-0.212839
0.088337
1.144347
-0.406937
-0.126244
2
0.708520
0.318724
-0.676550
-0.544785
0.484920
-0.208563
0.096793
1.273791
-0.331545
-0.111166
3
0.539707
0.281940
-0.523285
-0.551700
0.367090
-0.221301
0.100310
1.380833
-0.263246
-0.101216
4
0.409526
0.243284
-0.401218
-0.545490
0.285280
-0.262595
0.109814
1.478938
-0.220086
-0.089475
5
0.308033
0.216094
-0.306869
-0.493988
0.211845
-0.293279
0.101047
1.523479
-0.164632
-0.094548
6
0.255902
0.202039
-0.235221
-0.409895
0.167245
-0.354948
0.086692
1.537114
-0.134313
-0.108548
7
0.232645
0.187327
-0.205273
-0.288777
0.150907
-0.406792
0.064703
1.503912
-0.113875
-0.119711
8
0.248342
0.167704
-0.219963
-0.139003
0.161010
-0.466711
0.025561
1.444212
-0.104952
-0.111789
9
0.275662
0.155155
-0.248057
0.053540
0.168638
-0.495775
-0.027820
1.319162
-0.085244
-0.111390
In [23]:
# Reconstruct data from X and Y
pred = model.predict(gait)
pred.head()
H2OFrame with 151 rows and 123 columns:
reconstr_R.ASIS.X
618.8
619.5
620.7
622.3
624.1
626.3
628.6
630.9
633.4
635.3
reconstr_R.ASIS.Y
1056.3
1054.8
1053.2
1052.4
1052.1
1052.5
1053.8
1055.5
1057.4
1059.7
reconstr_R.ASIS.Z
167.1
166.0
164.6
163.2
161.3
159.3
156.9
154.0
150.7
147.2
reconstr_L.ASIS.X
640.3
642.0
644.1
646.4
648.7
651.1
653.3
655.3
657.4
658.8
reconstr_L.ASIS.Y
1045.7
1045.3
1044.8
1044.8
1045.2
1046.1
1047.8
1049.5
1051.3
1053.3
reconstr_L.ASIS.Z
-94.9
-95.7
-96.9
-98.1
-99.6
-101.5
-103.7
-106.3
-109.4
-112.8
reconstr_V.Sacral.X
430.1
431.3
433.0
434.9
437.1
439.5
441.9
444.2
446.6
448.4
reconstr_V.Sacral.Y
1056.6
1054.8
1053.0
1051.7
1050.9
1050.8
1051.4
1052.3
1053.5
1055.0
reconstr_V.Sacral.Z
26.6
24.5
22.2
20.2
18.0
15.8
13.7
11.4
8.9
6.4
reconstr_R.Thigh.Upper.X
510.8
510.2
510.8
513.0
517.1
523.1
531.0
540.8
552.0
564.2
reconstr_R.Thigh.Upper.Y
741.4
740.0
738.8
738.0
737.6
737.6
737.9
738.7
739.4
740.3
reconstr_R.Thigh.Upper.Z
208.6
208.3
207.9
207.6
207.1
206.5
205.8
204.9
203.7
202.4
reconstr_R.Thigh.Front.X
562.7
562.9
564.7
568.1
573.8
581.6
591.7
604.0
617.8
632.9
reconstr_R.Thigh.Front.Y
663.9
661.7
659.7
658.4
658.0
658.4
659.7
661.9
664.3
667.4
reconstr_R.Thigh.Front.Z
120.1
121.2
122.2
123.1
124.0
124.7
125.3
125.7
125.6
125.3
reconstr_R.Thigh.Rear.X
472.4
471.4
472.0
474.7
479.9
487.8
498.4
511.7
527.0
544.0
reconstr_R.Thigh.Rear.Y
625.2
623.7
622.4
621.4
620.7
620.3
620.1
620.3
620.4
620.7
reconstr_R.Thigh.Rear.Z
197.1
197.7
198.2
198.7
199.2
199.5
199.9
200.1
200.0
199.8
reconstr_L.Thigh.Upper.X
651.3
655.5
659.1
662.7
666.7
669.2
672.0
673.0
672.5
669.6
reconstr_L.Thigh.Upper.Y
742.5
743.2
743.8
744.6
745.5
746.5
747.9
749.1
749.9
750.9
reconstr_L.Thigh.Upper.Z
-148.6
-149.1
-149.8
-150.6
-151.9
-153.5
-155.5
-158.0
-160.7
-163.6
reconstr_L.Thigh.Front.X
746.8
751.7
755.8
760.0
764.5
767.3
770.2
771.2
770.3
766.7
reconstr_L.Thigh.Front.Y
733.0
735.1
736.6
738.3
739.8
740.9
742.3
742.6
742.0
740.7
reconstr_L.Thigh.Front.Z
-80.1
-81.1
-82.3
-83.7
-85.5
-87.6
-90.1
-92.9
-95.9
-98.8
reconstr_L.Thigh.Rear.X
687.2
692.3
696.4
700.5
704.8
706.9
709.2
708.9
706.3
700.6
reconstr_L.Thigh.Rear.Y
638.7
640.1
641.4
642.7
643.8
644.9
646.2
647.0
647.2
647.4
reconstr_L.Thigh.Rear.Z
-138.2
-137.6
-137.1
-137.0
-137.4
-138.3
-139.8
-141.7
-144.0
-146.6
reconstr_R.Shank.Upper.X
351.7
349.0
348.2
349.7
354.0
361.6
372.6
386.8
404.0
423.7
reconstr_R.Shank.Upper.Y
470.2
470.5
471.1
472.2
474.0
476.5
479.6
483.4
487.4
491.9
reconstr_R.Shank.Upper.Z
184.7
186.0
187.2
188.3
189.3
190.1
190.6
190.9
191.0
190.6
reconstr_R.Shank.Front.X
412.7
408.1
405.2
404.5
406.2
411.0
418.8
429.6
443.2
459.3
reconstr_R.Shank.Front.Y
411.2
409.7
408.2
407.1
406.2
405.9
405.9
406.6
407.6
409.3
reconstr_R.Shank.Front.Z
132.6
134.3
135.8
137.3
138.8
139.9
141.1
142.0
142.7
143.0
reconstr_R.Shank.Rear.X
335.4
330.0
326.4
324.8
325.5
329.2
335.9
345.7
358.5
373.9
reconstr_R.Shank.Rear.Y
384.7
386.1
387.8
390.1
393.0
396.8
401.4
406.9
412.8
419.3
reconstr_R.Shank.Rear.Z
188.9
190.3
191.6
192.8
193.8
194.5
194.9
195.0
194.8
194.2
reconstr_L.Shank.Upper.X
746.7
750.3
752.3
754.1
756.1
755.3
754.4
750.8
744.4
734.4
reconstr_L.Shank.Upper.Y
440.1
440.6
440.8
441.2
441.4
441.5
442.0
441.8
441.0
440.1
reconstr_L.Shank.Upper.Z
-133.0
-132.1
-131.3
-131.0
-131.3
-132.1
-133.6
-135.6
-137.8
-140.3
reconstr_L.Shank.Front.X
814.2
815.8
815.8
815.6
815.3
812.4
809.4
803.8
795.7
784.5
reconstr_L.Shank.Front.Y
411.6
409.8
407.7
405.8
403.7
401.8
400.2
398.5
396.5
394.8
reconstr_L.Shank.Front.Z
-83.7
-81.5
-79.5
-78.0
-77.1
-77.1
-77.9
-79.3
-81.0
-83.2
reconstr_L.Shank.Rear.X
743.2
745.4
746.0
746.4
746.8
744.5
742.0
736.9
729.3
718.5
reconstr_L.Shank.Rear.Y
392.4
393.2
393.6
394.2
394.8
395.4
396.3
396.7
396.3
395.6
reconstr_L.Shank.Rear.Z
-141.0
-140.4
-140.0
-140.0
-140.4
-141.3
-142.8
-144.6
-146.7
-148.9
reconstr_R.Heel.X
158.7
146.0
134.3
123.7
114.3
107.3
103.1
101.5
104.2
110.5
reconstr_R.Heel.Y
107.5
117.2
127.8
139.8
153.5
169.3
187.0
206.8
227.8
249.5
reconstr_R.Heel.Z
101.2
103.3
105.4
106.8
107.6
107.5
106.4
104.4
101.9
98.4
reconstr_R.Midfoot.Sup.X
299.3
284.2
269.8
256.2
243.5
232.7
223.8
217.1
213.9
214.0
reconstr_R.Midfoot.Sup.Y
86.8
89.9
93.2
97.2
102.1
108.2
115.8
124.8
135.3
146.8
reconstr_R.Midfoot.Sup.Z
69.5
71.1
72.6
73.8
74.9
75.6
76.0
76.0
75.8
75.3
reconstr_R.Midfoot.Lat.X
286.6
270.4
254.9
239.9
225.6
212.9
201.8
192.7
187.2
184.8
reconstr_R.Midfoot.Lat.Y
68.3
70.7
73.3
77.3
82.5
89.9
99.3
110.9
124.4
139.6
reconstr_R.Midfoot.Lat.Z
177.8
179.1
180.2
181.0
181.6
181.6
181.2
180.4
179.3
177.8
reconstr_R.Toe.Tip.X
426.8
406.7
387.1
367.8
348.8
331.0
314.4
299.3
287.2
278.3
reconstr_R.Toe.Tip.Y
43.2
42.2
40.7
39.0
37.2
35.7
34.7
34.4
35.8
38.1
reconstr_R.Toe.Tip.Z
113.2
113.3
113.2
113.3
113.6
114.0
114.9
116.1
117.4
118.9
reconstr_L.Heel.X
819.5
805.6
789.6
773.6
757.4
740.6
723.1
705.9
688.6
670.9
reconstr_L.Heel.Y
66.5
66.3
65.4
65.3
66.8
68.1
70.7
73.2
75.0
75.7
reconstr_L.Heel.Z
-52.0
-51.2
-50.7
-50.4
-50.1
-50.3
-50.5
-51.1
-51.8
-52.8
reconstr_L.Midfoot.Sup.X
968.3
958.0
945.9
933.2
919.5
904.7
888.8
872.3
855.2
837.6
reconstr_L.Midfoot.Sup.Y
116.3
110.3
103.6
97.4
92.0
87.3
83.2
80.2
77.6
75.7
reconstr_L.Midfoot.Sup.Z
-35.6
-31.9
-28.4
-25.4
-23.1
-21.6
-21.2
-21.2
-21.6
-22.5
reconstr_L.Midfoot.Lat.X
948.0
939.8
929.6
918.6
906.1
892.0
876.3
859.5
841.9
823.6
reconstr_L.Midfoot.Lat.Y
108.4
102.1
94.8
88.3
82.9
78.1
74.5
71.9
69.9
68.4
reconstr_L.Midfoot.Lat.Z
-130.0
-126.9
-123.9
-121.6
-119.8
-118.7
-118.6
-119.0
-119.7
-120.8
reconstr_L.Toe.Tip.X
1073.3
1065.6
1056.0
1045.5
1033.0
1018.9
1003.0
985.9
967.9
949.4
reconstr_L.Toe.Tip.Y
132.6
122.3
111.3
100.8
90.3
81.4
72.5
65.4
59.5
55.5
reconstr_L.Toe.Tip.Z
-70.3
-64.8
-59.1
-54.6
-51.1
-48.7
-48.1
-48.2
-49.0
-50.4
reconstr_Sternum.X
663.1
663.3
664.0
664.8
665.9
667.1
668.4
669.6
670.8
671.6
reconstr_Sternum.Y
1359.7
1357.9
1356.2
1355.2
1354.8
1355.1
1356.2
1357.8
1359.7
1362.0
reconstr_Sternum.Z
14.4
11.3
8.2
5.3
2.2
-0.6
-3.5
-6.5
-9.6
-12.6
reconstr_R.Acromium.X
569.9
569.6
569.3
569.4
569.5
569.9
570.6
570.9
571.0
570.6
reconstr_R.Acromium.Y
1455.7
1454.7
1453.6
1453.1
1453.1
1453.8
1455.2
1456.9
1458.9
1461.4
reconstr_R.Acromium.Z
225.7
221.9
217.9
214.3
210.4
206.9
203.4
199.7
195.9
192.3
reconstr_L.Acromium.X
593.4
594.0
595.0
596.3
597.8
599.5
601.2
603.0
605.1
606.8
reconstr_L.Acromium.Y
1472.9
1470.1
1467.3
1465.2
1463.8
1463.2
1463.4
1464.1
1465.1
1466.7
reconstr_L.Acromium.Z
-194.1
-197.8
-201.7
-205.3
-208.9
-212.3
-215.5
-218.9
-222.4
-225.8
reconstr_R.Bicep.X
596.0
594.7
593.2
592.0
590.8
589.8
589.1
587.9
586.2
583.9
reconstr_R.Bicep.Y
1254.9
1254.2
1253.5
1253.2
1253.5
1254.3
1255.8
1257.7
1259.7
1262.2
reconstr_R.Bicep.Z
275.1
271.9
268.6
265.5
262.1
259.1
256.0
252.7
249.2
245.9
reconstr_L.Bicep.X
576.5
578.2
580.8
583.6
587.0
590.8
594.7
599.4
605.0
610.5
reconstr_L.Bicep.Y
1235.6
1232.6
1229.6
1227.4
1225.7
1224.8
1224.8
1225.2
1225.9
1227.1
reconstr_L.Bicep.Z
-226.7
-229.8
-232.9
-235.7
-238.4
-240.8
-243.0
-245.1
-247.2
-249.1
reconstr_R.Elbow.X
568.7
566.4
563.8
561.6
559.2
557.0
555.1
552.4
549.1
545.3
reconstr_R.Elbow.Y
1148.6
1148.2
1147.7
1147.8
1148.4
1149.5
1151.4
1153.7
1156.2
1159.2
reconstr_R.Elbow.Z
310.9
308.2
305.1
302.2
299.0
295.9
292.7
289.2
285.3
281.6
reconstr_L.Elbow.X
511.2
513.8
517.3
521.0
525.4
530.3
535.1
540.9
547.9
554.9
reconstr_L.Elbow.Y
1147.4
1144.0
1140.4
1137.6
1135.4
1134.0
1133.5
1133.4
1133.4
1133.8
reconstr_L.Elbow.Z
-261.7
-264.7
-267.7
-270.5
-273.1
-275.4
-277.4
-279.4
-281.4
-283.1
reconstr_R.Wrist.Med.X
769.5
764.4
758.6
752.8
746.2
739.6
732.7
724.3
714.6
704.4
reconstr_R.Wrist.Med.Y
975.9
970.9
965.4
960.5
955.8
951.9
948.9
946.1
943.3
941.4
reconstr_R.Wrist.Med.Z
268.9
269.3
269.8
270.4
271.0
271.7
272.5
273.2
273.6
274.1
reconstr_R.Wrist.Lat.X
745.1
739.0
732.1
725.2
717.2
709.2
701.0
691.1
679.8
668.0
reconstr_R.Wrist.Lat.Y
947.6
943.7
939.4
935.8
932.5
929.9
928.1
926.8
925.6
925.2
reconstr_R.Wrist.Lat.Z
322.7
323.4
324.0
324.7
325.2
325.7
326.2
326.4
326.4
326.3
reconstr_L.Wrist.Med.X
612.5
615.7
620.1
624.2
628.5
632.9
636.5
641.1
647.2
653.3
reconstr_L.Wrist.Med.Y
917.5
915.1
912.6
910.3
908.4
906.3
904.7
903.2
902.2
901.5
reconstr_L.Wrist.Med.Z
-220.2
-221.8
-223.5
-225.2
-227.0
-229.0
-231.1
-233.1
-235.0
-236.8
reconstr_L.Wrist.Lat.X
562.8
566.3
570.9
575.1
579.6
584.0
587.6
592.3
598.5
604.9
reconstr_L.Wrist.Lat.Y
907.4
904.5
901.5
898.9
896.8
894.9
893.7
892.8
892.2
891.9
reconstr_L.Wrist.Lat.Z
-276.2
-277.8
-279.4
-281.2
-283.0
-285.1
-287.4
-289.8
-292.0
-294.3
reconstr_R.Toe.Lat.X
362.7
343.3
324.4
305.6
287.2
269.8
253.5
238.8
227.3
218.8
reconstr_R.Toe.Lat.Y
30.5
29.3
27.8
27.3
27.7
29.9
34.1
40.3
48.8
59.2
reconstr_R.Toe.Lat.Z
194.7
195.5
196.2
196.6
196.9
196.9
196.7
196.4
195.9
195.3
reconstr_R.Toe.Med.X
374.6
356.5
338.9
321.6
304.7
289.0
274.7
262.0
252.5
246.0
reconstr_R.Toe.Med.Y
38.3
37.6
36.6
36.1
36.3
37.7
40.5
44.8
51.0
58.7
reconstr_R.Toe.Med.Z
83.2
83.7
83.9
84.1
84.5
84.8
85.2
85.7
86.2
86.8
reconstr_L.Toe.Lat.X
1015.7
1006.9
996.2
984.6
971.2
956.4
939.8
922.3
904.3
885.7
reconstr_L.Toe.Lat.Y
107.7
98.4
88.0
78.5
69.8
62.3
55.6
50.6
46.7
43.9
reconstr_L.Toe.Lat.Z
-143.9
-139.4
-135.0
-131.4
-128.6
-126.7
-126.1
-126.2
-126.8
-128.0
reconstr_L.Toe.Med.X
1031.3
1021.8
1010.5
998.4
984.7
969.8
953.4
936.1
918.1
899.9
reconstr_L.Toe.Med.Y
118.5
109.1
98.7
89.1
80.2
72.4
65.4
60.1
55.9
53.0
reconstr_L.Toe.Med.Z
-42.4
-37.6
-32.9
-29.1
-26.1
-24.1
-23.7
-23.8
-24.5
-25.8
reconstr_R.Temple.X
734.6
735.1
736.0
737.0
738.0
739.3
740.7
741.7
742.5
742.7
reconstr_R.Temple.Y
1585.1
1582.1
1579.2
1577.1
1575.5
1574.8
1574.5
1575.0
1576.3
1578.5
reconstr_R.Temple.Z
99.1
95.8
92.5
89.3
86.0
82.8
79.6
76.1
72.4
68.7
reconstr_L.Temple.X
745.4
746.6
748.1
749.6
751.2
752.9
754.7
756.0
757.1
757.5
reconstr_L.Temple.Y
1588.1
1584.9
1581.9
1579.6
1577.8
1576.9
1576.4
1576.7
1577.8
1579.7
reconstr_L.Temple.Z
-40.1
-43.3
-46.6
-49.6
-52.8
-55.9
-58.9
-62.3
-65.9
-69.5
reconstr_Top.Head.X
738.3
741.7
745.2
748.6
752.0
755.5
759.3
762.1
763.8
764.5
reconstr_Top.Head.Y
1759.8
1757.4
1755.0
1753.4
1752.2
1751.8
1751.8
1752.5
1753.9
1756.0
reconstr_Top.Head.Z
37.8
34.5
31.0
27.7
24.3
21.0
17.6
13.9
9.9
5.9
In [24]:
# Plot original and reconstructed L.Acromium.X over time
lacro_np = np.array(h2o.as_list(gait["L.Acromium.X"]))
lacro_pred_np = np.array(h2o.as_list(pred["reconstr_L.Acromium.X"]))
line_orig = plt.plot(time_np, lacro_np, '-')
line_imp = plt.plot(time_np, lacro_pred_np, '-')
plt.title("Position of Left Acromium over Time")
plt.xlabel("Time")
plt.ylabel("X-Coordinate of Left Acromium")
blue_patch = mpatches.Patch(color = 'blue', label = 'Original')
green_patch = mpatches.Patch(color = 'green', label='Imputed')
plt.legend([blue_patch, green_patch], ["Original", "Imputed"])
plt.show()
In [25]:
# Import walking gait data with missing values
gait_miss = h2o.upload_file(_locate("smalldata/glrm_test/subject01_walk1_miss15.csv"))
gait_miss.describe()
Parse Progress: [##################################################] 100%
Uploaded pyf709d91e-fe9b-4509-a6a1-f0bd0f9d62b8 into cluster with 151 rows and 124 cols
Rows: 151 Cols: 124
Chunk compression summary:
chunk_type
chunk_name
count
count_percentage
size
size_percentage
C2S
2-Byte Fractions
1
0.8
386 B
0.5
C4S
4-Byte Fractions
123
99.19355
82.6 KB
99.54594
Frame distribution summary:
size
number_of_rows
number_of_chunks_per_column
number_of_chunks
172.16.2.38:54321
83.0 KB
151.0
1.0
124.0
mean
83.0 KB
151.0
1.0
124.0
min
83.0 KB
151.0
1.0
124.0
max
83.0 KB
151.0
1.0
124.0
stddev
0 B
0.0
0.0
0.0
total
83.0 KB
151.0
1.0
124.0
Column-by-Column Summary:
Time
R.ASIS.X
R.ASIS.Y
R.ASIS.Z
L.ASIS.X
L.ASIS.Y
L.ASIS.Z
V.Sacral.X
V.Sacral.Y
V.Sacral.Z
R.Thigh.Upper.X
R.Thigh.Upper.Y
R.Thigh.Upper.Z
R.Thigh.Front.X
R.Thigh.Front.Y
R.Thigh.Front.Z
R.Thigh.Rear.X
R.Thigh.Rear.Y
R.Thigh.Rear.Z
L.Thigh.Upper.X
L.Thigh.Upper.Y
L.Thigh.Upper.Z
L.Thigh.Front.X
L.Thigh.Front.Y
L.Thigh.Front.Z
L.Thigh.Rear.X
L.Thigh.Rear.Y
L.Thigh.Rear.Z
R.Shank.Upper.X
R.Shank.Upper.Y
R.Shank.Upper.Z
R.Shank.Front.X
R.Shank.Front.Y
R.Shank.Front.Z
R.Shank.Rear.X
R.Shank.Rear.Y
R.Shank.Rear.Z
L.Shank.Upper.X
L.Shank.Upper.Y
L.Shank.Upper.Z
L.Shank.Front.X
L.Shank.Front.Y
L.Shank.Front.Z
L.Shank.Rear.X
L.Shank.Rear.Y
L.Shank.Rear.Z
R.Heel.X
R.Heel.Y
R.Heel.Z
R.Midfoot.Sup.X
R.Midfoot.Sup.Y
R.Midfoot.Sup.Z
R.Midfoot.Lat.X
R.Midfoot.Lat.Y
R.Midfoot.Lat.Z
R.Toe.Tip.X
R.Toe.Tip.Y
R.Toe.Tip.Z
L.Heel.X
L.Heel.Y
L.Heel.Z
L.Midfoot.Sup.X
L.Midfoot.Sup.Y
L.Midfoot.Sup.Z
L.Midfoot.Lat.X
L.Midfoot.Lat.Y
L.Midfoot.Lat.Z
L.Toe.Tip.X
L.Toe.Tip.Y
L.Toe.Tip.Z
Sternum.X
Sternum.Y
Sternum.Z
R.Acromium.X
R.Acromium.Y
R.Acromium.Z
L.Acromium.X
L.Acromium.Y
L.Acromium.Z
R.Bicep.X
R.Bicep.Y
R.Bicep.Z
L.Bicep.X
L.Bicep.Y
L.Bicep.Z
R.Elbow.X
R.Elbow.Y
R.Elbow.Z
L.Elbow.X
L.Elbow.Y
L.Elbow.Z
R.Wrist.Med.X
R.Wrist.Med.Y
R.Wrist.Med.Z
R.Wrist.Lat.X
R.Wrist.Lat.Y
R.Wrist.Lat.Z
L.Wrist.Med.X
L.Wrist.Med.Y
L.Wrist.Med.Z
L.Wrist.Lat.X
L.Wrist.Lat.Y
L.Wrist.Lat.Z
R.Toe.Lat.X
R.Toe.Lat.Y
R.Toe.Lat.Z
R.Toe.Med.X
R.Toe.Med.Y
R.Toe.Med.Z
L.Toe.Lat.X
L.Toe.Lat.Y
L.Toe.Lat.Z
L.Toe.Med.X
L.Toe.Med.Y
L.Toe.Med.Z
R.Temple.X
R.Temple.Y
R.Temple.Z
L.Temple.X
L.Temple.Y
L.Temple.Z
Top.Head.X
Top.Head.Y
Top.Head.Z
type
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
real
mins
0.0
588.90717
1042.6
107.79163
600.01556
1029.3
-152.5
399.40009
1034.9
-21.44083
481.83603
732.70135
169.71159
535.63422
657.21033
74.20708
443.03299
613.54547
168.15961
468.19415
737.72083
-194.3
550.69415
684.75494
-133.588
435.01773
627.49988
-170.9
319.34705
445.08429
157.69023
376.44724
403.25574
102.54192
295.04089
368.36661
165.6133
341.2023
438.80435
-173.0
365.72482
375.95242
-121.0
304.46347
393.67728
-173.4
68.60076
56.43383
59.948
190.98845
76.90237
57.86759
157.32503
62.79
159.97461
242.90858
33.52863
102.0894
76.37951
60.01719
-74.0361
211.85968
70.39124
-69.30095
185.39088
48.22646
-140.1
254.42706
36.65646
-88.18266
627.38177
1342.9
-35.20795
511.80032
1427.4
164.48206
551.72424
1453.6
-249.9
485.94559
1227.9
216.05853
531.12134
1217.6
-266.6
424.32767
1129.5
242.4415
460.20703
1123.8
-304.8
535.87439
889.81964
262.1105
486.99316
876.53882
304.71069
554.35272
895.92426
-240.6
503.10611
886.58942
-300.9
179.7708
33.33099
181.24631
218.04131
36.96362
71.79319
202.74066
36.02512
-153.1
228.04898
42.9706
-54.88903
675.97009
1562.3
44.15432
683.50897
1567.3
-94.07465
614.13971
1740.4
-19.48838
maxs
2.5
641.12048
1091.3
180.07411
661.46918
1078.0
-80.82956
451.5914
1077.8
55.29718
692.89514
788.11365
216.86717
766.44531
750.72375
136.25021
726.57483
672.42242
209.89946
674.53168
781.90839
-138.1
772.35175
780.81445
-66.30186
713.16107
681.38623
-123.1844
719.69702
531.05676
200.56787
799.47015
457.5513
154.56749
751.88885
458.64368
202.59061
764.30676
494.35605
-116.5
821.66901
425.57733
-63.825
750.77588
472.92294
-125.0268
812.50183
320.70309
108.161
935.61414
197.97754
85.62352
934.44775
209.43217
188.70589
1071.8
179.28133
153.59363
821.7641
321.80249
-34.92287
971.31763
178.00603
-6.83138
955.73096
184.36398
-104.3698
1082.5
168.6488
-33.04971
673.89301
1393.9
43.5209
573.64575
1485.4
262.06827
609.36566
1507.8
-156.2
593.20453
1288.6
305.86801
643.91699
1271.8
-196.6
567.0025
1193.1
339.82635
608.93268
1186.4
-230.9
771.56329
1003.1
312.96448
750.302
969.89471
362.03549
793.86859
998.83923
-188.3
768.91589
958.34167
-249.4
1022.3
136.89597
218.5173
1029.9
153.3546
113.4589
1024.1
132.61819
-111.9407
1039.4
146.49858
-9.44173
740.63611
1640.0
139.15808
754.62506
1647.9
0.84904
752.89178
1809.1
85.29955
mean
1.25
614.5
1065.7
147.7
621.5
1053.9
-113.1
420.0
1058.9
21.1
602.0
751.7
198.1
677.0
698.1
108.0
607.5
634.1
191.2
589.7
756.6
-164.4
676.4
729.0
-105.7
598.0
651.4
-151.0
543.7
476.8
177.9
612.2
427.1
128.6
551.0
395.3
183.2
579.0
453.9
-144.9
613.9
398.7
-94.3
548.7
418.7
-151.1
418.6
121.2
91.0
545.8
110.4
69.8
524.6
93.9
173.8
654.2
66.9
120.1
431.9
129.8
-51.3
575.0
103.8
-30.1
566.1
96.8
-123.6
678.9
66.4
-58.2
643.8
1367.9
7.5
541.6
1458.3
215.2
578.9
1482.0
-202.5
547.47776
1259.5
262.4
596.6
1244.5
-229.6
503.5
1157.8
293.6
546.0
1147.7
-268.4
657.2
944.1
283.0
617.1
928.3
331.3
674.0
938.2
-215.0
628.2
922.0
-273.3
592.7
61.3
194.7
616.1
67.7
86.2
610.7
64.8
-131.9
652.9
74.3
-32.4
708.1
1597.3
92.8
718.3
1603.8
-44.3
698.8
1773.2
34.9
sigma
0.7
14.9
14.1
25.4
15.2
14.2
24.2
14.4
12.1
24.0
67.1
14.2
15.7
74.7
26.4
18.5
96.4
15.1
12.5
66.3
11.3
17.8
72.2
26.1
21.3
92.8
11.5
14.0
134.8
25.7
11.1
144.0
16.5
11.7
155.4
28.6
8.4
142.4
17.2
15.0
155.0
15.2
14.5
153.1
25.8
13.2
235.0
81.8
9.4
245.1
37.5
7.5
257.2
40.8
6.5
267.4
38.1
13.7
239.6
81.7
9.4
253.0
31.5
12.8
253.7
36.9
9.4
273.2
33.9
13.5
11.8
14.9
26.9
15.4
16.7
32.4
17.6
15.7
32.0
32.6
17.4
30.3
36.9
15.5
23.6
46.3
18.2
31.1
51.0
17.5
23.4
77.5
30.2
13.8
87.6
24.2
14.9
79.3
27.6
13.3
88.5
20.0
13.6
271.4
30.7
9.0
264.7
31.2
10.6
276.4
30.7
11.0
266.6
30.1
11.7
18.9
20.3
32.2
20.6
21.3
31.6
42.8
16.9
34.7
zero_count
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
missing_count
0
25
20
23
22
30
24
17
28
15
19
24
25
20
14
22
20
15
33
26
24
21
23
23
25
27
20
23
22
21
19
16
29
23
23
30
29
22
17
24
19
25
24
21
18
19
20
24
21
22
21
16
28
16
25
25
21
23
25
19
28
23
24
22
25
32
18
18
27
26
26
20
22
24
24
15
28
25
24
18
24
22
18
35
28
30
19
23
25
28
36
21
26
19
20
24
21
15
20
24
25
22
25
18
22
19
19
26
30
29
28
21
22
24
15
31
22
19
23
23
18
20
24
30
In [26]:
# Basic GLRM using quadratic loss and no regularization
model2 = H2OGeneralizedLowRankEstimator(k=10, init="SVD", svd_method = "GramSVD", loss="Quadratic", regularization_x="None", regularization_y="None", max_iterations=2000, min_step_size=1e-6)
model2.train(x=range(1,gait_miss.ncol), training_frame=gait_miss, validation_frame=gait)
model2.show()
glrm Model Build Progress: [##################################################] 100%
Model Details
=============
H2OGeneralizedLowRankEstimator : Beta - Generalized Low Rank Model
Model Key: GLRM_model_python_1445562467796_8
Model Summary:
number_of_iterations
final_step_size
final_objective_value
2000.0
0.0
122299.7
ModelMetricsGLRM: glrm
** Reported on train data. **
MSE: NaN
Sum of Squared Error (Numeric): 122299.726469
Misclassification Error (Categorical): 0.0
ModelMetricsGLRM: glrm
** Reported on validation data. **
MSE: NaN
Sum of Squared Error (Numeric): 153530.207952
Misclassification Error (Categorical): 0.0
Scoring History:
timestamp
duration
iteration
step_size
objective
2015-10-22 18:13:52
0.352 sec
0.0
0.7
4709528.9
2015-10-22 18:13:52
0.360 sec
1.0
0.4
4709528.9
2015-10-22 18:13:52
0.368 sec
2.0
0.2
4709528.9
2015-10-22 18:13:52
0.376 sec
3.0
0.1
4709528.9
2015-10-22 18:13:52
0.384 sec
4.0
0.0
4709528.9
---
---
---
---
---
---
2015-10-22 18:14:19
28.280 sec
1995.0
0.0
122316.1
2015-10-22 18:14:19
28.300 sec
1996.0
0.0
122310.5
2015-10-22 18:14:19
28.322 sec
1997.0
0.0
122306.5
2015-10-22 18:14:20
28.342 sec
1998.0
0.0
122303.0
2015-10-22 18:14:20
28.363 sec
1999.0
0.0
122299.7
In [27]:
# Plot objective function value each iteration
model2_score = model2.score_history()
plt.xlabel("Iteration")
plt.ylabel("Objective")
plt.title("Objective Function Value per Iteration")
plt.plot(model2_score["iteration"], model2_score["objective"])
plt.show()
In [28]:
# Impute missing data from X and Y
pred2 = model2.predict(gait_miss)
pred2.head()
H2OFrame with 151 rows and 123 columns:
reconstr_R.ASIS.X
615.6
618.0
619.3
620.8
622.9
625.4
628.9
631.1
633.0
635.4
reconstr_R.ASIS.Y
1055.7
1054.9
1053.2
1052.3
1051.3
1051.5
1052.5
1054.2
1056.5
1058.8
reconstr_R.ASIS.Z
165.4
163.8
162.3
160.8
159.1
157.5
155.3
152.1
149.2
145.7
reconstr_L.ASIS.X
637.7
640.7
643.1
645.0
647.5
650.4
653.7
655.8
657.3
659.1
reconstr_L.ASIS.Y
1045.1
1045.7
1044.8
1044.7
1044.1
1045.1
1046.4
1048.0
1050.3
1052.4
reconstr_L.ASIS.Z
-96.1
-98.4
-99.3
-100.5
-101.8
-103.6
-105.6
-108.5
-111.3
-114.7
reconstr_V.Sacral.X
428.0
430.4
432.5
434.2
436.7
439.1
442.6
444.8
446.6
448.8
reconstr_V.Sacral.Y
1054.5
1054.9
1052.8
1051.6
1049.9
1049.8
1050.0
1050.8
1052.3
1053.7
reconstr_V.Sacral.Z
22.9
20.0
17.5
15.7
13.8
11.8
10.1
7.2
5.2
2.7
reconstr_R.Thigh.Upper.X
512.6
510.6
511.1
514.0
518.1
522.9
531.5
541.3
551.6
564.1
reconstr_R.Thigh.Upper.Y
742.0
741.6
740.1
739.3
738.5
737.7
738.0
738.6
739.4
740.2
reconstr_R.Thigh.Upper.Z
206.0
205.9
205.3
204.9
204.4
204.0
203.4
202.3
201.5
200.0
reconstr_R.Thigh.Front.X
564.2
563.4
564.8
569.1
574.6
581.1
591.7
604.0
617.0
632.3
reconstr_R.Thigh.Front.Y
666.1
663.9
661.5
660.5
659.6
658.7
659.8
661.8
664.2
667.2
reconstr_R.Thigh.Front.Z
117.1
118.7
119.6
120.5
121.3
122.1
122.7
122.9
123.3
122.9
reconstr_R.Thigh.Rear.X
474.5
471.6
471.9
475.7
480.9
487.2
498.2
511.6
525.9
543.2
reconstr_R.Thigh.Rear.Y
626.1
625.6
623.9
622.8
621.7
620.3
620.1
620.3
620.5
620.7
reconstr_R.Thigh.Rear.Z
193.9
194.8
195.0
195.4
195.5
196.0
196.2
196.3
196.7
196.4
reconstr_L.Thigh.Upper.X
652.0
652.5
659.5
663.4
667.4
669.8
673.1
674.0
673.1
670.9
reconstr_L.Thigh.Upper.Y
744.6
745.9
746.0
746.6
746.7
747.6
748.7
749.6
750.9
752.2
reconstr_L.Thigh.Upper.Z
-150.0
-151.7
-152.2
-153.0
-153.9
-155.2
-157.1
-159.6
-162.1
-165.2
reconstr_L.Thigh.Front.X
746.1
746.9
755.2
759.7
764.4
767.1
770.7
771.6
770.4
767.5
reconstr_L.Thigh.Front.Y
735.4
736.5
738.9
740.5
741.3
742.0
742.8
742.9
742.8
741.9
reconstr_L.Thigh.Front.Z
-80.6
-83.1
-84.6
-86.1
-87.8
-89.6
-92.3
-95.1
-97.6
-100.8
reconstr_L.Thigh.Rear.X
688.6
688.2
697.2
701.6
706.1
707.8
710.6
710.2
707.2
702.2
reconstr_L.Thigh.Rear.Y
641.7
643.3
644.1
645.0
645.5
646.3
647.2
647.7
648.4
649.0
reconstr_L.Thigh.Rear.Z
-138.7
-139.0
-138.4
-138.4
-138.3
-138.9
-140.3
-142.3
-144.3
-147.1
reconstr_R.Shank.Upper.X
353.7
348.8
347.5
350.4
354.7
361.2
372.2
386.6
402.8
422.7
reconstr_R.Shank.Upper.Y
472.6
473.6
473.3
474.4
475.6
477.0
479.9
483.7
487.8
492.2
reconstr_R.Shank.Upper.Z
180.2
182.1
183.2
184.2
185.2
186.3
187.0
187.3
187.8
187.6
reconstr_R.Shank.Front.X
413.7
407.6
404.5
405.0
406.7
410.3
417.9
428.9
441.6
457.9
reconstr_R.Shank.Front.Y
413.4
412.3
410.1
408.7
407.2
406.4
406.0
406.7
407.8
409.3
reconstr_R.Shank.Front.Z
128.6
131.6
133.2
134.6
135.6
137.1
137.7
138.7
139.7
139.9
reconstr_R.Shank.Rear.X
335.1
328.3
324.5
324.3
325.2
328.5
335.2
345.2
357.1
372.7
reconstr_R.Shank.Rear.Y
386.4
388.0
388.6
390.7
392.7
396.0
400.1
405.7
411.7
418.2
reconstr_R.Shank.Rear.Z
184.7
187.0
188.2
189.0
189.8
190.9
191.2
191.4
191.7
191.2
reconstr_L.Shank.Upper.X
747.0
744.4
752.2
754.7
756.8
755.7
755.2
751.5
744.6
735.3
reconstr_L.Shank.Upper.Y
444.1
443.9
444.1
444.0
443.4
443.1
443.1
442.6
442.2
441.6
reconstr_L.Shank.Upper.Z
-133.9
-133.9
-133.1
-132.9
-132.8
-133.3
-134.9
-136.7
-138.5
-141.3
reconstr_L.Shank.Front.X
812.4
809.3
814.7
815.3
815.3
812.2
809.5
803.9
795.4
784.8
reconstr_L.Shank.Front.Y
415.0
413.0
410.4
408.1
405.3
403.2
401.1
399.2
397.5
396.0
reconstr_L.Shank.Front.Z
-84.1
-83.5
-81.5
-80.5
-79.4
-78.8
-79.9
-80.9
-82.2
-84.7
reconstr_L.Shank.Rear.X
743.5
740.0
746.1
747.1
747.7
745.2
743.1
738.1
730.0
719.6
reconstr_L.Shank.Rear.Y
397.2
396.7
397.3
397.4
397.3
397.4
398.0
397.9
397.9
397.6
reconstr_L.Shank.Rear.Z
-141.9
-142.3
-142.0
-142.1
-142.4
-143.0
-144.8
-146.4
-148.1
-150.5
reconstr_R.Heel.X
154.5
142.3
130.9
121.1
111.2
106.7
100.5
99.7
101.7
107.8
reconstr_R.Heel.Y
108.2
117.3
126.7
139.2
151.7
168.1
185.5
205.5
226.4
248.5
reconstr_R.Heel.Z
95.9
99.2
101.4
102.3
103.3
103.9
103.0
101.2
98.9
95.5
reconstr_R.Midfoot.Sup.X
297.5
283.2
268.9
255.8
242.9
233.3
222.8
216.7
213.0
212.9
reconstr_R.Midfoot.Sup.Y
86.9
89.7
92.2
96.2
99.6
107.2
113.7
123.4
134.1
145.9
reconstr_R.Midfoot.Sup.Z
63.3
67.3
69.2
70.4
71.3
72.4
72.3
72.4
72.4
71.5
reconstr_R.Midfoot.Lat.X
284.2
268.0
252.7
238.1
223.7
212.6
200.2
191.9
185.7
183.4
reconstr_R.Midfoot.Lat.Y
70.0
71.5
73.3
77.6
81.4
90.2
98.5
110.4
123.9
139.1
reconstr_R.Midfoot.Lat.Z
170.9
174.9
176.2
176.8
177.3
177.9
177.2
176.5
175.6
173.9
reconstr_R.Toe.Tip.X
427.2
407.8
388.2
369.1
350.3
332.9
315.0
300.4
287.8
278.6
reconstr_R.Toe.Tip.Y
43.9
43.3
41.3
38.9
35.6
36.8
34.1
34.7
36.1
38.3
reconstr_R.Toe.Tip.Z
107.7
111.6
111.8
112.1
111.7
112.3
112.0
113.0
114.3
115.1
reconstr_L.Heel.X
811.7
797.7
784.1
769.8
753.8
737.5
720.5
703.8
685.7
667.7
reconstr_L.Heel.Y
69.9
66.6
68.6
68.4
69.4
69.9
73.0
74.9
76.2
76.5
reconstr_L.Heel.Z
-56.3
-55.4
-54.1
-53.5
-53.3
-53.1
-54.0
-54.5
-54.9
-56.4
reconstr_L.Midfoot.Sup.X
965.4
955.0
943.9
932.1
918.0
903.5
887.2
871.1
853.6
836.1
reconstr_L.Midfoot.Sup.Y
123.5
114.5
107.3
100.5
93.9
88.8
84.6
81.5
78.9
76.8
reconstr_L.Midfoot.Sup.Z
-32.6
-31.3
-28.3
-26.5
-24.4
-22.5
-22.2
-21.7
-21.4
-22.4
reconstr_L.Midfoot.Lat.X
947.2
938.2
928.8
918.0
905.0
891.3
875.1
859.1
841.3
823.2
reconstr_L.Midfoot.Lat.Y
112.9
104.6
97.6
90.7
83.9
78.8
74.9
72.3
70.3
68.6
reconstr_L.Midfoot.Lat.Z
-128.4
-127.1
-124.4
-122.7
-121.0
-119.6
-119.8
-119.6
-119.8
-121.1
reconstr_L.Toe.Tip.X
1073.9
1065.8
1056.2
1045.8
1032.6
1018.9
1002.1
985.7
967.7
949.7
reconstr_L.Toe.Tip.Y
139.0
128.8
114.6
103.0
91.0
81.7
72.6
65.5
59.9
55.7
reconstr_L.Toe.Tip.Z
-65.6
-62.5
-58.2
-55.3
-51.8
-49.0
-48.2
-47.7
-47.6
-49.2
reconstr_Sternum.X
659.5
662.4
663.2
664.0
665.2
666.7
669.1
670.2
670.8
672.0
reconstr_Sternum.Y
1359.3
1357.4
1355.6
1354.6
1353.6
1354.3
1355.5
1357.0
1359.4
1361.7
reconstr_Sternum.Z
9.7
6.2
2.9
0.5
-2.1
-4.7
-7.1
-10.6
-13.3
-16.5
reconstr_R.Acromium.X
567.0
570.9
570.5
570.3
570.1
570.3
571.6
571.5
570.9
571.1
reconstr_R.Acromium.Y
1455.4
1455.3
1453.8
1453.1
1452.2
1453.2
1454.4
1456.3
1458.8
1461.3
reconstr_R.Acromium.Z
221.5
217.9
213.3
209.9
206.3
203.0
200.0
195.6
192.2
188.5
reconstr_L.Acromium.X
589.5
593.9
594.8
595.7
597.1
599.0
601.7
603.5
604.8
606.9
reconstr_L.Acromium.Y
1469.1
1468.3
1464.9
1463.0
1460.7
1460.5
1460.8
1461.2
1462.8
1464.3
reconstr_L.Acromium.Z
-199.4
-203.4
-207.3
-210.3
-213.5
-217.0
-219.8
-223.9
-227.1
-230.6
reconstr_R.Bicep.X
596.2
597.1
595.9
594.7
593.4
592.3
592.6
590.7
588.5
586.8
reconstr_R.Bicep.Y
1254.9
1255.4
1254.5
1254.2
1253.7
1254.7
1256.0
1258.0
1260.5
1262.9
reconstr_R.Bicep.Z
271.3
268.7
264.5
261.4
258.0
255.2
252.5
248.4
245.6
242.2
reconstr_L.Bicep.X
575.0
577.7
580.2
582.5
586.0
590.3
595.1
600.4
605.2
610.9
reconstr_L.Bicep.Y
1232.1
1231.0
1227.7
1225.6
1223.2
1222.3
1222.2
1222.3
1223.4
1224.5
reconstr_L.Bicep.Z
-230.4
-234.2
-237.1
-239.2
-241.5
-244.0
-246.0
-248.7
-250.6
-252.8
reconstr_R.Elbow.X
570.1
569.2
567.1
564.9
562.6
560.3
559.4
556.0
552.3
549.0
reconstr_R.Elbow.Y
1148.6
1149.2
1148.6
1148.6
1148.2
1149.5
1150.9
1153.4
1156.3
1159.3
reconstr_R.Elbow.Z
307.8
306.2
302.4
299.6
296.3
293.5
290.6
286.4
283.2
279.3
reconstr_L.Elbow.X
509.2
511.8
515.5
518.7
523.4
528.8
534.6
541.4
547.7
554.9
reconstr_L.Elbow.Y
1143.0
1141.7
1137.9
1135.4
1132.4
1130.9
1130.3
1129.6
1130.0
1130.4
reconstr_L.Elbow.Z
-264.4
-268.3
-271.0
-273.0
-275.3
-277.9
-279.9
-282.4
-284.3
-286.3
reconstr_R.Wrist.Med.X
775.0
771.6
765.3
759.2
752.5
745.4
740.0
730.3
720.6
711.2
reconstr_R.Wrist.Med.Y
982.2
976.8
970.4
965.4
959.7
955.0
951.3
948.1
945.7
943.9
reconstr_R.Wrist.Med.Z
265.1
266.5
266.3
266.8
267.1
268.2
269.0
269.3
270.4
270.9
reconstr_R.Wrist.Lat.X
750.7
746.1
738.3
731.0
722.9
714.3
707.5
696.2
684.9
674.0
reconstr_R.Wrist.Lat.Y
950.3
946.3
941.6
938.1
933.9
930.9
928.6
927.1
926.4
926.0
reconstr_R.Wrist.Lat.Z
319.5
321.5
321.2
321.6
321.7
322.6
323.1
322.9
323.6
323.4
reconstr_L.Wrist.Med.X
612.7
615.8
619.9
623.1
627.7
633.1
637.3
643.5
648.8
655.2
reconstr_L.Wrist.Med.Y
910.6
910.0
908.0
905.9
903.1
901.6
899.1
898.0
897.4
896.6
reconstr_L.Wrist.Med.Z
-225.1
-227.8
-229.1
-230.5
-232.0
-233.6
-236.1
-238.0
-239.6
-241.7
reconstr_L.Wrist.Lat.X
563.3
566.3
570.7
573.8
578.4
583.9
587.8
594.3
599.8
606.3
reconstr_L.Wrist.Lat.Y
900.9
899.7
897.1
894.8
891.8
890.2
888.2
887.3
887.1
886.6
reconstr_L.Wrist.Lat.Z
-281.7
-284.5
-285.5
-286.8
-288.3
-290.2
-292.9
-295.2
-297.3
-299.9
reconstr_R.Toe.Lat.X
362.9
343.4
324.9
306.4
288.2
272.0
254.5
240.4
228.2
219.6
reconstr_R.Toe.Lat.Y
32.6
30.4
28.1
27.7
26.3
30.7
33.1
39.8
48.2
58.6
reconstr_R.Toe.Lat.Z
188.8
192.9
193.5
193.8
193.7
194.0
193.2
192.9
192.6
191.5
reconstr_R.Toe.Med.X
374.4
357.0
339.3
322.2
305.2
290.2
274.3
262.2
252.1
245.4
reconstr_R.Toe.Med.Y
38.8
37.7
36.3
35.9
34.5
38.1
39.3
44.3
50.6
58.3
reconstr_R.Toe.Med.Z
77.4
81.1
81.5
81.9
81.7
82.2
81.8
82.2
82.9
83.0
reconstr_L.Toe.Lat.X
1015.6
1006.8
996.3
984.8
970.7
956.4
938.9
922.3
904.0
885.6
reconstr_L.Toe.Lat.Y
110.6
100.5
89.5
79.7
69.7
62.0
55.0
50.1
46.2
43.0
reconstr_L.Toe.Lat.Z
-140.0
-137.8
-134.3
-132.1
-129.4
-127.3
-126.9
-126.5
-126.4
-127.7
reconstr_L.Toe.Med.X
1030.3
1020.7
1009.3
997.7
983.4
968.8
951.8
935.1
917.1
899.4
reconstr_L.Toe.Med.Y
122.9
112.6
101.2
91.1
80.8
73.0
65.7
60.5
56.3
53.1
reconstr_L.Toe.Med.Z
-38.8
-36.2
-32.4
-29.9
-27.0
-24.6
-24.1
-23.6
-23.5
-25.0
reconstr_R.Temple.X
725.7
736.2
735.8
736.2
736.2
737.1
739.0
739.3
739.5
740.2
reconstr_R.Temple.Y
1590.3
1580.6
1578.3
1576.3
1575.1
1575.7
1576.2
1577.5
1579.5
1581.7
reconstr_R.Temple.Z
91.7
89.0
85.3
82.5
79.4
76.5
73.7
69.4
66.3
62.4
reconstr_L.Temple.X
734.2
746.2
746.6
747.6
748.2
749.8
751.9
752.6
753.1
753.9
reconstr_L.Temple.Y
1594.6
1584.2
1581.7
1579.5
1578.1
1578.3
1578.7
1579.6
1581.3
1583.1
reconstr_L.Temple.Z
-48.2
-50.8
-54.1
-56.7
-59.5
-62.5
-65.2
-69.3
-72.5
-76.3
reconstr_Top.Head.X
714.5
742.8
742.5
744.7
744.9
746.8
749.8
750.7
751.9
753.1
reconstr_Top.Head.Y
1761.9
1755.1
1752.8
1751.1
1749.9
1750.9
1751.6
1752.9
1755.1
1757.2
reconstr_Top.Head.Z
28.8
26.8
22.8
19.9
16.5
13.2
10.2
5.6
2.1
-2.0
In [29]:
# Plot original and imputed L.Acromium.X over time
lacro_pred_np2 = np.array(h2o.as_list(pred2["reconstr_L.Acromium.X"]))
plt.plot(time_np, lacro_np, 'b-')
plt.plot(time_np, lacro_pred_np2, 'g-')
# Mark points where training data contains missing values
idx_miss = gait_miss["L.Acromium.X"].isna().where()
plt.plot(time_np[idx_miss], lacro_np[idx_miss], "o", marker = "x", ms = 8, mew = 1.5, mec = "r")
plt.title("Position of Left Acromium over Time")
plt.xlabel("Time")
plt.ylabel("X-Coordinate of Left Acromium")
blue_patch = mpatches.Patch(color = 'blue', label = 'Original')
green_patch = mpatches.Patch(color = 'green', label = 'Imputed')
red_patch = mpatches.Patch(color = 'red', label = "Missing")
plt.legend([blue_patch, green_patch, red_patch], ["Original", "Imputed", "Missing"])
plt.show()
In [ ]:
Content source: pchmieli/h2o-3
Similar notebooks: