PatternsResource.generalizeRule(request, sub_analysis_id, rule_id, **kwargs)

Prior mandatory steps 1) Upload dataset 2) Create analysis 3) Create sub analysis 4) DataSharp 5) iRule

In Generalize, for an existing pattern, all its global(Macro) insights are found. A generalized pattern for <if age is greater than 21 and income is less than 50 and city is Phil, then LTV is low> can be any pattern with one less attribute such that there is highest support for the resultant pattern.

Works for insights where the insight length is more than one. To generate a generalized insight, drop one attribute-level at any point and compute the metrics. Collect all the newly generated insights and check if the support and confidence has increased and Lift >1. Present it as generalized insight else message “no generalized insight found”


sub_analysis_id Give sub analysis id
rule_id Give rule id

Possible errors

Error message
Invalid sub analysis id
Invalid rule id
Could not find better insight with one rule condition for the desired Class

POST Request Example

curl -u username:password -X POST {url_prefix}/generalize_rule/{sub_analysis_id}/{rule_id}/

Response Example

    "error": false,
    "error_msg": "",
    "result": [
            "actionability": 0.33333,
            "confidence": 0.96552,
            "explicability": 0.72,
            "hmean": 1.9525,
            "lift": 8.22884,
            "recommended": "No",
            "record_count": "28",
            "rule_string": "If month is jun and education is student, then y = no",
            "support": 0.03733,
            "target_bin": "no"
    "error": false,
    "error_msg": "",
    "result": "Could not find better insight with one rule condition for the desired Class"