How to delete predictions created with MALPredictionImport object?

I uploaded rule based predictions using the following code:

upload_job = MALPredictionImport.create_from_objects(
        client = client,
        project_id = "XXXXXXXXXXXXXX",
        name = "mal_job"+str(uuid.uuid4()),
        predictions = [
            lb_types.Label(
                data={ "global_key": "XXXXXX" },
                annotations=annotations,
            )
])
upload_job.wait_till_done()

Every time I reupload predictions to the same data row, the new ones get added on top of the old ones without replacing them. I tried asking support chat bot but it only mentioned deleting runs of a model. What model if I uploaded my own predictions without specifying any model?

Anyone knows how to quickly clear all previous predictions for a specific data row? Using web UI for this is a tedious process.

Hey @digitalcortex,
Via UI you can delete your MAL from the Automation tab in that project:


You can also do that via SDK:

project = client.get_project("<PROJECT_ID>")
importList = []
for imports in project.bulk_import_requests():
    importList.append(imports)
#importList[0] 
#importList[0].delete()  #This will delete all pre-annotations uploaded via MAL

Thank you, it works!

For Labelbox devs to see:
Naming of a “bulk_import_requests” method looks very counter intuitive: it looks like Im about to upload something instead of fetching old imports. Hence I could not find it as it was in my blind spot.

Word breakdown:
bulk - is often used by SDKs for uploading many objects at once, not downloading
import - is for uploading, not for fetching info
bulk_import_requests - looks like I’m about to call many upload operations at once.

I would suggest renaming this method to something like: list_mal_imports since these imports are created by MALPredictionImport class. It would even be much better if this class didn’t stand alone but migrated all its methods into client.get_project(“…”).import_predictions. Would be much more intuitive and SDK user would not have to do investigation connecting the dots from all over the SDK documentation just to import/delete predictions :grinning:

1 Like

Appreciate the feedback will get this internally so we can improve!

1 Like