Extract Model Drivers and Weights

Drivers are the list of most important features that contribute the most to predict the outcome. Identifying the most important features help us understand how changing them impacts the predictions.

DriversDrivers

Drivers

With Obviously AI API you can get the list of the most important drivers along with their relative weights. All you need is the ID of the Prediction report and your API Key.

Curl and Python Implementation

Curl

curl https://api.obviously.ai/user/report/<report_id>
-H 'Authorization: ApiKey <api_key>'

Python

import requests
head = {
  'Authorization' : 'ApiKey <api_key>'
}
response = requests.get(
  'https://api.obviously.ai/user/report/<report_id>', 
  headers = head
)
response.json()

Let's say our report id is abcd and the API key is 1234.

In the above code simply replace the api_key with abcd and report_id with 1234.This will return a JSON object containing the following elements:

  1. Drivers

  2. Driver Impact Proportion

  3. Percentage Impact

Let's consider we have already created a Prediction report to predict customer churn using the Telecom Churn Dataset.

Drivers

Drivers represent those columns/features that were used for prediction in the decreasing order of their importance.

"drivers": [
        "MonthlyCharges",
        "TotalCharges",
        "InternetService",
        "PaperlessBilling",
        "SeniorCitizen",
        "PaymentMethod",
        "MultipleLines",
        "StreamingMovies",
        "Partner",
        "StreamingTV",
        "gender",
        "Dependents",
        "DeviceProtection",
        "OnlineBackup",
        "OnlineSecurity",
        "TechSupport",
        "PhoneService",
        "Contract",
        "tenure"]

Driver Impact Proportion

Driver Impact Proportion represents the relative weights of each feature that was used for prediction.In the figure below it can be seen that MonthlyCharges has the highest value of 0.985 and hence it is the most important feature followed by TotalCharges and InternetService.

"driver_impact_proportion": 
{
        "Contract": 0.398,
        "Dependents": 0.597,
        "DeviceProtection": 0.592,
        "InternetService": 0.683,
        "MonthlyCharges": 0.985,
        "MultipleLines": 0.647,
        "OnlineBackup": 0.575,
        "OnlineSecurity": 0.543,
        "PaperlessBilling": 0.681,
        "Partner": 0.63,
        "PaymentMethod": 0.653,
        "PhoneService": 0.467,
        "SeniorCitizen": 0.656,
        "StreamingMovies": 0.635,
        "StreamingTV": 0.619,
        "TechSupport": 0.539,
        "TotalCharges": 0.964,
        "gender": 0.612,
        "tenure": 0.005
}

Percentage Impact

The Percentage Impact represents the percentage contribution of each feature to predict the outcome. The percentage contribution of Monthly Charges and Total Charges is 30.6% and 26.62%. Hence just these two features are the most important drivers and contribute more than 50% to predict Customer Churn.

"percentage_impact": 
{
        "Contract": "0.67%",
        "Dependents": "2.45%",
        "DeviceProtection": "2.36%",
        "InternetService": "4.27%",
        "MonthlyCharges": "30.6%",
        "MultipleLines": "3.39%",
        "OnlineBackup": "2.12%",
        "OnlineSecurity": "1.72%",
        "PaperlessBilling": "4.22%",
        "Partner": "3.03%",
        "PaymentMethod": "3.52%",
        "PhoneService": "1.05%",
        "SeniorCitizen": "3.59%",
        "StreamingMovies": "3.14%",
        "StreamingTV": "2.82%",
        "TechSupport": "1.67%",
        "TotalCharges": "26.62%",
        "gender": "2.7%",
        "tenure": "0.05%"
    }