MCPcopy Create free account
hub / github.com/chinawithfrank/ChatBotCourse / test_sets

Method test_sets

tf_classify_demo/sample_data.py:202–220  ·  view source on GitHub ↗

获取测试样本集

(self)

Source from the content-addressed store, hash-verified

200 return x_s, y_s
201
202 def test_sets(self):
203 """
204 获取测试样本集
205 """
206 x_s = []
207 y_s = []
208 for item in self.test_data:
209 vectors = item['vectors']
210 local_group_id = item['local_group_id']
211 x_array = np.zeros([self.dim_info.x_dim], dtype=np.float)
212 y_array = np.zeros(self.maps.group_id_size(), dtype=np.float)
213 y_array[local_group_id] = 1
214 for word_id in vectors:
215 vector = vectors[word_id]
216 for index, weight in enumerate(vector):
217 x_array[word_id*self.dim_info.vec_dim+index] = weight
218 x_s.append(x_array)
219 y_s.append(y_array)
220 return x_s, y_s
221
222
223if __name__ == '__main__':

Callers 1

trainFunction · 0.80

Calls 2

group_id_sizeMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected