A zero valued row vector encoding this entity. Args: type_name: the string type name of the named entity as_matrix: if true, return a 1-by-N matrix instead of a vector. Returns: A numpy array. If as_matrix is True, the array has shape (1,n) where n is the number of
(self,
type_name,
as_matrix = True)
| 882 | return self.as_nql(np_vec, type_name, provenance) |
| 883 | |
| 884 | def zeros_numpy_array(self, |
| 885 | type_name, |
| 886 | as_matrix = True): |
| 887 | """A zero valued row vector encoding this entity. |
| 888 | |
| 889 | Args: |
| 890 | type_name: the string type name of the named entity |
| 891 | as_matrix: if true, return a 1-by-N matrix instead of a vector. |
| 892 | |
| 893 | Returns: |
| 894 | A numpy array. If as_matrix is True, the array has shape (1,n) |
| 895 | where n is the number of columns, else the shape is (n,). |
| 896 | """ |
| 897 | if as_matrix: |
| 898 | return np.zeros((1, self.get_max_id(type_name)), dtype='float32') |
| 899 | else: |
| 900 | return np.zeros((self.get_max_id(type_name),), dtype='float32') |
| 901 | |
| 902 | def one_hot_numpy_array(self, entity_name, |
| 903 | type_name): |
no test coverage detected