@@ -873,6 +873,47 @@ def fork_dataset(data_id: int) -> int:
873873 return int (data_id )
874874
875875
876+ def _topic_add_dataset (data_id : int , topic : str ):
877+ """
878+ Adds a topic for a dataset.
879+ This API is not available for all OpenML users and is accessible only by admins.
880+ Parameters
881+ ----------
882+ data_id : int
883+ id of the dataset for which the topic needs to be added
884+ topic : str
885+ Topic to be added for the dataset
886+ """
887+ if not isinstance (data_id , int ):
888+ raise TypeError ("`data_id` must be of type `int`, not {}." .format (type (data_id )))
889+ form_data = {"data_id" : data_id , "topic" : topic }
890+ result_xml = openml ._api_calls ._perform_api_call ("data/topicadd" , "post" , data = form_data )
891+ result = xmltodict .parse (result_xml )
892+ data_id = result ["oml:data_topic" ]["oml:id" ]
893+ return int (data_id )
894+
895+
896+ def _topic_delete_dataset (data_id : int , topic : str ):
897+ """
898+ Removes a topic from a dataset.
899+ This API is not available for all OpenML users and is accessible only by admins.
900+ Parameters
901+ ----------
902+ data_id : int
903+ id of the dataset to be forked
904+ topic : str
905+ Topic to be deleted
906+
907+ """
908+ if not isinstance (data_id , int ):
909+ raise TypeError ("`data_id` must be of type `int`, not {}." .format (type (data_id )))
910+ form_data = {"data_id" : data_id , "topic" : topic }
911+ result_xml = openml ._api_calls ._perform_api_call ("data/topicdelete" , "post" , data = form_data )
912+ result = xmltodict .parse (result_xml )
913+ data_id = result ["oml:data_topic" ]["oml:id" ]
914+ return int (data_id )
915+
916+
876917def _get_dataset_description (did_cache_dir , dataset_id ):
877918 """Get the dataset description as xml dictionary.
878919
0 commit comments