Update Generalization

Updating an existing Generalization Table

Once you created a generalization table, you should have the ID for the created generalization table, you can just provide the generalization ID and the rest should be taken care of. This example is using NSFW Classification as a way to demonstrate how generalization works, but any method that supports generalization should work the same way with the exception that the labels are different.
Parameter NameDefault ValueRequiredDescription
generalize0TrueIf set to 1, you are telling the API that you want to generalize the results
generalization_idNULLTrueThe ID of the generalization table applicable to the method

Example cURL request

curl --location --request POST 'ttps://api.intellivoid.net/coffeehouse/v1/image/nsfw_classification' \
--form 'access_key="<YOUR ACCESS KEY>"' \
--form '[email protected]"nothing_important.jpg"' \
--form 'generalize="1"' \
--form 'generalization_id="da61676a13ebf77c3825dbad62d4cccbc14e96eb6e83f9f117eb1b41a1e53fcc"'

Example Response

  "success": true,
  "response_code": 200,
  "results": {
    "nsfw_classification": {
      "content_hash": "2d5e8a3a8588cc66baad2d606d0b595827c19b26da8fe91fd4cbfbb38df28e35",
      "content_type": "jpg",
      "safe_prediction": 99.9262,
      "unsafe_prediction": 0.073795,
      "is_nsfw": false
    "generalization": {
      "id": "da61676a13ebf77c3825dbad62d4cccbc14e96eb6e83f9f117eb1b41a1e53fcc",
      "size": 20,
      "top_label": "safe",
      "top_probability": 99.9262,
      "probabilities": [
          "label": "safe",
          "calculated_probability": 99.9262,
          "current_pointer": 1,
          "probabilities": [
          "label": "unsafe",
          "calculated_probability": 0.073795,
          "current_pointer": 1,
          "probabilities": [

Generalization Object Structure

idstringThe Generalization ID, this is used to update this table with new predictions
sizeintThe maximum size of the generalization table
top_labelstringThe top label from the generalization table
top_probabilityfloatThe top probability that is related to the top label from the generalization table
probabilitiesProbability[]Array of probabilities, each dedicated for each label.

Probability Object Structure

labelstringThe label of the probability set
calculated_probabilityfloatThe calculation of the set of probabilities as a whole
current_pointerintThe current pointer of the probability set
probabilitiesfloat[]Array of probabilities in the generalization table that are being used to calculate calculated_probability