@@ -41,14 +41,27 @@ def test_kmeans(sagemaker_session):
41
41
k = 10 , sagemaker_session = sagemaker_session , base_job_name = 'test-kmeans' )
42
42
43
43
kmeans .init_method = 'random'
44
- kmeans .max_iterators = 1
44
+ kmeans .max_iterations = 1
45
45
kmeans .tol = 1
46
46
kmeans .num_trials = 1
47
47
kmeans .local_init_method = 'kmeans++'
48
48
kmeans .half_life_time_size = 1
49
49
kmeans .epochs = 1
50
50
kmeans .center_factor = 1
51
51
52
+ assert kmeans .hyperparameters () == dict (
53
+ init_method = kmeans .init_method ,
54
+ local_lloyd_max_iter = str (kmeans .max_iterations ),
55
+ local_lloyd_tol = str (kmeans .tol ),
56
+ local_lloyd_num_trials = str (kmeans .num_trials ),
57
+ local_lloyd_init_method = kmeans .local_init_method ,
58
+ half_life_time_size = str (kmeans .half_life_time_size ),
59
+ epochs = str (kmeans .epochs ),
60
+ extra_center_factor = str (kmeans .center_factor ),
61
+ k = str (kmeans .k ),
62
+ force_dense = 'True'
63
+ )
64
+
52
65
kmeans .fit (kmeans .record_set (train_set [0 ][:100 ]))
53
66
54
67
endpoint_name = name_from_base ('kmeans' )
@@ -80,14 +93,27 @@ def test_async_kmeans(sagemaker_session):
80
93
k = 10 , sagemaker_session = sagemaker_session , base_job_name = 'test-kmeans' )
81
94
82
95
kmeans .init_method = 'random'
83
- kmeans .max_iterators = 1
96
+ kmeans .max_iterations = 1
84
97
kmeans .tol = 1
85
98
kmeans .num_trials = 1
86
99
kmeans .local_init_method = 'kmeans++'
87
100
kmeans .half_life_time_size = 1
88
101
kmeans .epochs = 1
89
102
kmeans .center_factor = 1
90
103
104
+ assert kmeans .hyperparameters () == dict (
105
+ init_method = kmeans .init_method ,
106
+ local_lloyd_max_iter = str (kmeans .max_iterations ),
107
+ local_lloyd_tol = str (kmeans .tol ),
108
+ local_lloyd_num_trials = str (kmeans .num_trials ),
109
+ local_lloyd_init_method = kmeans .local_init_method ,
110
+ half_life_time_size = str (kmeans .half_life_time_size ),
111
+ epochs = str (kmeans .epochs ),
112
+ extra_center_factor = str (kmeans .center_factor ),
113
+ k = str (kmeans .k ),
114
+ force_dense = 'True'
115
+ )
116
+
91
117
kmeans .fit (kmeans .record_set (train_set [0 ][:100 ]), wait = False )
92
118
training_job_name = kmeans .latest_training_job .name
93
119
0 commit comments