Reorganize model data into a list of model data with the same labels. Args: data: The data label_ids: The label ids unique_label_ids: The unique label ids Returns: Reorganized RasaModelData
(
self, data: Optional[Data], label_ids: np.ndarray, unique_label_ids: np.ndarray
)
| 839 | return new_data |
| 840 | |
| 841 | def _split_by_label_ids( |
| 842 | self, data: Optional[Data], label_ids: np.ndarray, unique_label_ids: np.ndarray |
| 843 | ) -> List["RasaModelData"]: |
| 844 | """Reorganize model data into a list of model data with the same labels. |
| 845 | |
| 846 | Args: |
| 847 | data: The data |
| 848 | label_ids: The label ids |
| 849 | unique_label_ids: The unique label ids |
| 850 | |
| 851 | Returns: |
| 852 | Reorganized RasaModelData |
| 853 | """ |
| 854 | label_data = [] |
| 855 | for label_id in unique_label_ids: |
| 856 | matching_ids = np.array(label_ids) == label_id |
| 857 | label_data.append( |
| 858 | RasaModelData( |
| 859 | self.label_key, |
| 860 | self.label_sub_key, |
| 861 | self._data_for_ids(data, matching_ids), |
| 862 | ) |
| 863 | ) |
| 864 | return label_data |
| 865 | |
| 866 | def _check_label_key(self) -> None: |
| 867 | """Check if the label key exists. |