{'fraction_non_alphanumeric': 0.025729156437199252, 'fraction_numerical': 0.010442240335199188, 'mean_word_length': 4.475891736870407, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Weighted Solution to SVM Actionability and Interpretability

Research in machine learning has successfully developed algorithms to build accurate classification models. However, in many real-world applications, such as healthcare, customer satisfaction, and environment protection, we want to be able to use the models to decide what actions to take. We investigate the concept of actionability in the context of Support Vector Machines. Actionability is as important as interpretability or explainability of machine learning models, an ongoing and important research topic. Actionability is the task that gives us ways to act upon machine learning models and their predictions. This paper finds a solution to the question of actionability on both linear and non-linear SVM models. Additionally, we introduce a way to account for weighted actions that allow for more change in certain features than others. We propose a gradient descent solution on the linear, RBF, and polynomial kernels, and we test the effectiveness of our models on both synthetic and real datasets. We are also able to explore the model's interpretability through the lens of actionability.


Introduction
SVM models are one of the best performing predictive models in machine learning, as they can effectively separate data into differing labels while maximizing the margin of the decision function. Despite the progress achieved with other predictive methods such as deep learning, SVM models remain competitive and compelling in areas likes healthcare, where data will never reach the large volumes required to train deep neural networks models. While there is extensive research on SVMs, there is little to no information about finding ways to use the margin to change labels of new datapoints. If we are given a datapoint which, based on the decision function of the SVM, is most likely an undesirable outcome (e.g., patient at risk of cardiovascular disease), or a datapoint for which we know the class (e.g, a sick patient), we would like to use the SVM boundary to move the datapoint to a desirable outcome. Moving the datapoint can be complex and challenging depending on the features themselves as well as the shape of the SVM boundary. Having this functionality would be relevant to many applications such as medical care, customer satisfaction, and environmental protection.
In this paper, we tackle the question of "What do I do with the prediction?" or "How do I use a prediction model to act upon an undesirable label?". Previous research (e.g., [4,12,15,16,19]) has defined actionability as giving a recommendation of the easiest way for a user to change an "unsatisfactory situation" based on a set of rules. Unfortunately, while rule-based classifiers allow for interpretability of the feature decisions, they are not the best performing models. Additionally, previous papers focus on the framework of defining costs of an action in rule-based classification and how to maximize gain for a given cost. In the context of an SVM, this part of the problem will be slightly simpler as we can assume we are in a Euclidean space and thus we will frame our problem as a minimization of a weighted Euclidean distance. To our knowledge, we are the first to propose a general approach for actionability, in the context of support vector machines.
We illustrate our approach with atherosclerosis, a serious disease of the arteries characterized by the deposition of plaques of fatty material on their inner walls, causing serious complications like a reduced blood flow in the big arteries, which increases the risk for heart attack and stroke. Atherosclerosis has no known cure, however, prevention can play an important role in reducing patient risk, by keeping under control the main risk factors: high cholesterol and triglycerides, tobacco consumption, diabetes, high BMI, high blood pressure, and lack of activity. The way these factors intertwine is unknown, and hoping to reduce all the factors at once is unrealistic for most patients. In atherosclerosis, as in many other health problems, one challenge that a physician might face is to make important decisions about what should be done to cure a patient or reduce his risk of a specific disease. The purpose of actionability here is to suggest actions that are fine-grained modifications of some actionable risk factors in order to decrease the risk of atherosclerosis in patients.
We define an action as a change in the value of some feature (e.g., weight of a patient, or his tobacco consumption). Our approach focuses on a framework where a datapoint is framed as a vector of numerical features. We will then use the vector to predict an outcome based on the given SVM model. The goal will be to minimize the weighted distance of the action that shifts the features to a point along the margin of the desired outcome. The weighted distance will be some combination of the distance travelled in each feature multiplied by a weight that represents the challenge of moving each feature, that is how actionable each feature is (e.g., how hard it is to stop smoking). The weight vector used to weight these distances is decided by the user. An example of weighting, say in the application of assessing the risk of atherosclerosis, may be that the amount of alcohol consumed (easier to change) has a lower weight while BMI (harder to change) has a higher weight. The action returned will then be the change in each actionable feature required to achieve the desired outcome.
Through the lens of actionability, we also investigate interpretability, the ability to explain machine learning models in a form that is understandable to a human [2]. By setting the weight vector to all 1's, we use the recommended actions to rank-order the pertinent features in the model.
In Section 2, we describe the related work on actionability. In Section 3, we describe the problem set up. In Section 4, we explore the linear SVM solution. In Section 5, we extend the solution to fit the non-linear SVM problem. In Section 6, we test the model on both simulated data and medical data. In Section 7, we discuss the results and conclusions we can make about the algorithm.

Related Work
In many real-world applications, a domain expert can act upon a prediction in many ways, but ultimately would like to use the prediction and the model to decide which actions to take. This type of knowledge falls under the umbrella of actionability, an important but widely unexplored concept in machine learning. A related topic is the interpretability of machine learning models, for which there is a surge in research interest from the community (e.g., [3,10,18]). Understanding why a model is making a prediction increases our confidence in using the models, helps detect bias, and communicate/explain predictions to other parties. While interpretability aims to answer the question "Why did the model make this prediction?", actionability gives ways to act upon those models and their predictions and address the related key question of "What to do now?".
Most research on learning actionable knowledge goes back to rule-based models, that can be classified into three main lines of research: (1) use of predefined set of simple actions that are mapped to classification rules or deviations [1,5,7,14]; (2) sift through a set of association or subgroup discovery rules [6,8,9,11] to identify descriptive actionable rules of the form Condition → Class, where Condition is a conjunction of features describing the target Class; (3) elaborate actions by comparing pairs of classification rules with contradicting classes but the same values for all stable attributes [15,16,17,21] to generate action rules. Given an unsatisfactory situation, the work in [19,20] discovers a set of action recommendations to improve that situation using classification rules. Finally, actionability is formalized as a case-based reasoning problem in [22,23]. Given an example to reclassify, the authors propose to search for the closest cases with the desirable class label, among training examples, centroids of the clusters of the opposite class, or SVM support vectors. Choosing the closest support vector will be used as a baseline to compare our proposed approach. For a detailed literature survey on rule-based actionability see [20].

Presenting the SVM Actionability Problem
Our model learns how to move a datapoint from the undesirable class to the desirable class. We will provide our general framework for both a linear and non-linear SVM. For a given linear SVM model, we have a decision boundary given by v T x + b = 0. Where x ∈ R d (the input space). We choose to use vector v here as the decision vector because we will later use w for the weight vector used in the actionability problem. In the case of a non-linear SVM, the decision boundary is given by v T φ(x) + b = 0, where φ is the feature expansion used for the SVM.
Additionally, we are given an initial point x 0 for which we predict an unfavorable result, or for which we know the label is not desirable (say with label y 0 ). Note, for this formulation, we require that for any label y, y ∈ {−1, +1}. We are also given a weight vector w which symbolizes the weight vector of the loss of acting on a feature (ranging between 0 and 1). This means the higher w i is, the harder it is to change that feature (i.e. it is static) and the lower w i is, the easier it is to change that feature (i.e. it is actionable). We assume that all features are normalized between −1 and 1 so that we can also standardize the weight vector and the distance formulation problem.
The goal will be to find the nearest point x n on the other side of the SVM boundary (including the margin). In other words, for the case of a linear SVM, the output is shown in Equation 1.
. Equation 2 presents the case of a non-linear SVM.
where dist(x 0 , x n ) is once again defined in Equation 3, N is the number of training points, x i is a training point, α i is the associated dual coefficient of training point x i , y i is the label for training point x i , and K is the kernel function corresponding to the feature expansion φ.
The function we are aiming to minimize is the weighted Euclidean distance between x 0 and x n in the original feature space (R d ). This is shown in Equation 3.
where is the Hadamard product, or element-wise multiplication.
Static Features Throughout this paper, we use the weight vector w to account for differing levels of actionable vs. static features. It is important to note, by making incredibly uneven weight values where some features have weights around 0.001 while static features have weights at 1, they will for all intents and purposes be static. This is the most interesting case for this paper. However, it should be noted that if we had a static variable such as age that cannot be moved at all, we could easily fix that variable. To do this, we can factor the static features into the intercept variable b for each point x 0 . Let's say x 00 and x 01 are static features. Then we can modify the original constraint as given in Equation 4.
In this case, we now have v , x n ∈ R d−2 . We can then simply perform the original optimization problem with the features in a lower dimension leaving the static features as the fixed inputs of x 0 .

Solution to Linear SVM
We derive a solution for Equation 1 using a Lagrangian and then performing gradient descent to optimize for distance. This derivation is shown in Appendix A. The result is to choose .
In Figure

Solution to Non-Linear SVM
Just as we did for the linear SVM, we can formulate the solution to Equation 2 using a Lagrangian and then perform gradient descent to optimize for the distance while taking into account the constraint. This derivation is shown in Appendix B. The result is to choose For some problems, finding x 1 is computationally infeasible, so an approximation is needed. In our experiment we use the nearest support vector on the margin. Then use ∇ x j L(x j , λ) defined in Equation 6 in the gradient descent algorithm.
where K (x i , x n ) is the derivative of the kernel function K(x i , x n ) with respect to x n (this must exist to find the nearest point). Figure 2a, presents an example for a polynomial SVM that finds the nearest point with the opposite label to the initial point using gradient descent. Figure 2b presents an example for a RBF SVM that finds the nearest point with the opposite label to the initial point using gradient descent.

Experiments
We evaluate our approach and present our experiments on both simulated and medical data. We also introduce a method of implementing interpretability through the suggested actions.

Simulated Data
We simulate data using the sklearn datasets package. This package creates separable data for an SVM classifier with noise. We use three different simulated datasets: 1) linearly separable data 2) a dataset where one group is inside a circle and the other is outside (the circles dataset) and 3) a dataset of two interleaving half circles (the moons dataset). To measure the success of the action proposed by our solution, we compare it to the only other research that's been done in SVM actionability which is to move to the nearest support vector that's at least on the margin of the desired class [22].

Linear SVM Results
In this section we compare the gradient descent and nearest support vector solutions. We see the distances for 1,000 datapoints in Figure 3a. The average weighted normalized distance for the gradient descent solution was 0.003 and for the nearest support vector was 0.013. The gradient descent solution shows a statistically significant p-value < 0.05 which implies that the distance from gradient descent to the initial point is less than that of the nearest support vector. The gradient descent found a solution in at most 2.60 milliseconds.

Non-Linear SVM Results
To compare the gradient descent and nearest support vector solutions, the distances for 1,000 datapoints with a RBF kernel are shown in Figure 3b for the moons dataset. The average weighted normalized distance for the gradient descent solution was 0.044 and for the nearest support vector was 0.085. The gradient descent solution shows a statistically significant p-value < 0.05 which implies that the distance from gradient descent to the initial point is less than that of the nearest support vector. The gradient descent found a solution in at most 916.72 milliseconds. The distances for 1,000 datapoints with a polynomial kernel are shown in Figure 3c for the circles datasets. The average weighted normalized distance for the gradient descent solution was 0.015 and for the nearest support vector was 0.022. The gradient descent solution shows a statistically significant p-value < 0.05 which again implies that the distance from gradient descent to the initial point is less than that of the nearest support vector. The gradient descent found a solution in at most 64.6 milliseconds.

The Atherosclerosis dataset
To illustrate the usefulness of our approach in preventing atherosclerosis, we conducted experiments using the atherosclerosis dataset derived from Stulong 1 , a twenty year study of the risk factors of the atherosclerosis in a population of 1,419 middle aged men. The patients have been classified into three groups: the normal, the risk, and the pathological groups. We also dispose of a granular integer risk score for each patient. The dataset used was pre-processed for the PKDD Discovery Challenge 2002. Our aim is to produce actions that would find the easiest way to take a patient at risk of atherosclerosis and get them to a point that would have a prediction of no risk.
When creating a SVM model to describe this dataset, we used the following features [SUBSC, TRIC, TRIGL, SYST, DIAST, BMI, WEIGHT, CHLST, ALCO_CONS, TOBA_CONSO] as these have all shown impacts on atherosclerosis risk. There is a description of each of these features in Appendix C. We then grouped together the pathological risk and risk groups as positive risk or +1 and no risk as negative risk or −1. Then, we tuned the SVM to perform best on this prediction problem using cross validation and tested on a test set of 20% of the data. This process was performed 10 times. The RBF SVM achieved an f1-score With the SVM models defined, the next step was to test the recommended actions based on the solution presented in Section 5. For each point that has a label of +1 and has an SVM prediction of +1, we found two points: one, the nearest support vector with a label of −1 and two, the solution via gradient descent of the nearest point on the margin presented in Section 5. Note, for this example, we choose a weight vector of We compare these two solutions using three different methods: (1) measure the weighted distance from both solutions to the point we are moving, (2) measure the action recommended by both solutions, and (3) measure the predicted risk of both solutions. To measure (3), we create a linear model to predict the granular integer risk score of atherosclerosis which is measured from 1 − 10. This linear model is presented in Equation 7. Using this regression model 2 , we can calculate and compare the risk associated with the old and new datapoints. This will help assess the impact of the actions in reducing the risk of atherosclerosis in the patient. Risk = 0.0072 · SU BSC + 0.0036 · T RIC + 0.00004 · T RIGL + 0.0088 · SY ST + 0.0068 · DIAST + 0.0191 · BM I + 0.0037 · W EIGHT + 0.0049 · CHLST − 0.1903 · ALCO_CON S + 0.8468 · T OBA_CON S − 1.0558 (7)

Figure 5: RBF Distances Histogram
In Figures 4a-4b, we see a box plot for the actions for a RBF SVM and a polynomial SVM for two of the highly weighted features: SUBSC and TRIC. As we would hope, the gradient descent solution requires less movement than the nearest support vector for these features that are extremely hard to change. On the other hand, when investigating a feature with a lower weight, such as BMI, there is more relative movement, particularly for the gradient descent solution, as this is a feature that a patient can more easily change. This result is shown in Figures 4c-4d. The rest of these feature action boxplots are shown in Appendix F.
For the RBF SVM, the average weighted distance of the gradient descent solution was 0.011 and for the nearest support vector was 0.073. For the polynomial SVM, the average weighted distance of the gradient descent solution was 0.012 and for the nearest support vector was 0.144. The maximum time to run the gradient descent algorithm on either kernel was 2.265s. For both the RBF and polynomial SVM, our solution is statistically significantly closer to the original point than the solution presented by the nearest support vector. These results are presented as a histogram for the RBF SVM in Figure 5. The same plot is shown for the polynomial SVM in Appendix D. Additionally, we see these results presented in the form of a boxplot for both the RBF and polynomial SVM in Appendix E.  In Figure 7, we see a graph of the predicted risk of both the original point and the suggested point for both the gradient descent solution and the nearest support vector for the RBF SVM. The gradient descent solution shows a higher probability of decreasing the risk of the initial point. For the polynomial SVM, the same conclusion is found which is that the gradient descent solution shows a higher probability of decreasing the risk of the initial point. The figure depicting these results is shown in Appendix G.
Finally, we have included a set of figures to visualize the recommended actions of both the gradient descent solution and the nearest support vector. In Figure 6a, we visualize the percent change in each feature recommended for the solutions using a RBF SVM. In Figure 6b, we see the same for a polynomial SVM. Although these are just a few randomly chosen patients, we see the desired trend that the changes required for the gradient descent solutions are fainter colors (smaller percent change) while the changes for the nearest support vector are darker colors (larger percent change).

Atherosclerosis Interpretability
Using the framework presented in the processing of the atherosclerosis dataset, we present a way to delve into the interpretability of the SVM that classifies patients as either negative or positive risk. To do this, we use results of the SVM actionability. By using the same RBF SVM (γ = 1, C = 10) and a weight vector of all 1s, we can investigate the suggested actions as a proxy for feature importance. That is, when all features have equal weight, the features that move most to switch a classification from risk to no risk are the most important features when decreasing atherosclerosis risk. We use this weight vector of all 1s and measure the amplitude of all of the recommended actions (normalized by feature) to determine which features required the most change. In Table 1, we present the median and mean of the normalized amplitudes of the suggestion actions of all the features. Based on the results, changing TOBA_CONS is the most important (by a substantial amount) in terms of decreasing the risk while ALCO_CONS is the least important. The rest of the rankings allow one to identify the features an at-risk patient should focus most on when attempting to reduce risk of atherosclerosis. Polynomial SVM results are in Appendix H.

Discussion and Conclusion
The task of devising actions or actionability based on predictive models has been relatively unexplored in modern machine learning research. We propose a simple, yet an effective and efficient way of using SVM models for actionability. We show an answer to the nearest point of any point that switches the label predicted by a linear SVM to a desired result. This provides a good solution to any application that implements a linear SVM to divide data. For a non-linear SVM, we were able to find an algorithm via gradient descent that predicts the nearest point with a desirable outcome. This reduces the cost of the action. However, it is important to note that this algorithm is sensitive to the initial guess for the nearest point. A search of possible starting points should allow one to pick a point that will lend itself to finding the true global optima (such as the nearest support vector). In Section 6.2, we saw that the gradient descent solution gave an easier action than the nearest support vector with the given weight vector for both the RBF and polynomial SVM. Additionally, the gradient descent solution gave a higher probability of reducing predicted risk than the nearest support vector. Using the recommended actions, we explored the interpretability of the SVM models for the atherosclerosis dataset, and concluded that tobacco consumption was the most important risk factor to adjusting the atherosclerosis risk.
We must note that the action is only as good as the SVM model itself. If the SVM model is a good fit for the prediction problem, then the resulting action will also be relevant. Additionally, to reduce uncertainty of a given action, one could adjust the algorithm to go beyond the positive/negative margin to reach a point that is more confidently classified in the desired group. In future work, it would be interesting to explore variations of the actionability problem. For example, it's possible that a user has the bandwidth to change a limited number of features. Additionally, it would not be hard to expand the above results to a multiclass SVM classifier. We could then provide the nearest action to the desired class. Finally, there is more work to be done in exploring the weighting. Are there other more applicable ways to define actionable and static features? What other metrics could we use to replace the distance/cost metric that we aim to minimize? Paired with visualization techniques, our SVM approach to actionability has the potential to have an immense impact in assisting physicians in preventing diseases with actionable risk factors. We hope that this paper will motivate the machine learning community to conduct research on actionability so to take full advantage of the accurate prediction models.

Broader Impact
This algorithm is an extension of the SVM algorithm, so therefore it will impact the community in similar ways that SVM has impacted the world. A suggested action on a predicted outcome of the SVM algorithm could have a potentially huge beneficial impact in healthcare and the world of precision medicine. Say a patient is told they will most likely need surgery, a doctor could then explain to the patient the easiest changes they could make so that the doctor would no longer recommend surgery as a solution. Thus, actionability could be used to decide on a prevention policy by providing the physician with a tool for investigating the effects of the various factors on the risk of disease, for an individual patient. Additionally, this could be used for a positive impact in the world of climate change. It's possible that researchers use SVMs to predict outcomes of certain environments and that actionability would allow them to suggest how communities could achieve more desirable outcomes.
On the other hand, SVMs can be used by companies who may be using SVM models to predict the success of an advertisement. This algorithm could hypothetically used in marketing and business strategies to help companies attract more customers which may be viewed negatively in the eyes of the consumer. Similarly, politicians may be able to use this to change opinions of voters by feeding certain features that tend to change the minds of voters for their own gain.
While SVMs and the actionability approach we propose can be used maliciously, we do not believe this research would inherently put anyone at a disadvantage. However, we recognize that there are a few faults of this system. There is inherent bias in the weights provided by the user and therefore users could manipulate the system to give recommendations that enforce a previous bias. In some ways, it may be better to use this as an unweighted algorithm or require that extensive research is done into the weights of the actions.

A Linear SVM Solution via Gradient Descent
We can formulate the solution to Equation 1 using a Lagrangian and then perform gradient descent to optimize for the distance while taking into account the constraint. The Lagrangian is formulated in Equation 8. We then take the gradient of L(x n , λ) with respect to x n .
Since L(x n , λ) is convex, it will be optimized when the gradient is equal to zero which allows us to solve for λ.
To do this, take the dot product of the gradient with the vector v which leads to the result in Equation 9.
We can then use this equation for λ to find the λ at any x j . This gives us a value for ∇ x j L(x j , λ) at any vector x j . Algorithm 1 shows the gradient descent method for finding

Algorithm 1: Gradient Descent for Solving Actionability on Linear SVM
Input: SVM decision vector v, bias term b, initial point x 0 with label y 0 , and weight vector w ; set stopping tolerance > 0; set The vector x n that minimizes the weighted distance to x 0

B Non-Linear SVM Solution via Gradient Descent
Just as we did for the Linear SVM, we can formulate this question using a Lagrangian and then perform gradient descent to optimize for the distance while taking into account the constraint. The Lagrangian is formulated in Equation 10. We then take the gradient of L(x n , λ) with respect to x n .
In Equation 10, K (x i , x n ) is the derivative of the kernel function K(x i , x n ) with respect to x n (this must exist to find the nearest point). Again, like we did in the Linear SVM, we will set the gradient equal to 0 and then solve for λ. To do this, take the dot product of the equation with to the result in Equation 11.
We can then use the equation for λ from Equation 11 when minimizing the distance for any x j (simply replace x n with the current estimate x j ). This gives us a real value for ∇ x j L(x j , λ) at any vector x j . Using λ defined in Equation 11 we define ∇ x j L(x j , λ) in Equation 12.
The gradient descent algorithm for a non-linear SVM is the same as Algorithm 1, except that we must choose For some problems finding x 1 is computationally infeasible, so an approximation is needed. In our experiment we use the nearest support vector on the margin. Then use ∇ x j L(x j , λ) defined in Equation 12 in the gradient descent algorithm.

B.1 Specific Kernel Derivatives
To use the gradient descent solution for a kernel, we must define K (x, y). The two kernels we explore in this paper are the RBF kernel defined as K(x, y) := exp(−γ||x − y|| 2 ) and the polynomial kernel defined as K(x, y) := x T y + c D .
RBF Kernel: the derivative for the RBF kernel (with respect to y) is defined as Polynomial Kernel: the derivative for the polynomial kernel (with respect to y) is defined as

D Histogram of Atherosclerosis Distances
In Figure 8, we see the histogram representation of the distances of the gradient descent solution and nearest support vector for a polynomial kernel.

E Boxplots of Atherosclerosis Distances
In Figure 9, we see the distance comparisons between the gradient descent solution and nearest support vector.

F Boxplots of Feature Changes
In Figures 10 through 16, we present the boxplots of the other feature changes not presented in the text for a RBF and polynomial SVM.

G Probability of Decreased Risk for Polynomial SVM
In Figure 17 we present the predicted risk of the initial point vs. the solution for a polynomial SVM.

H Polynomial SVM Atherosclerosis Interpretability
By using the same polynomial SVM (with degree = 4) and a weight vector of all 1s, we investigate the suggested actions as a proxy for feature importance. In Table 3, we present the median and mean of the normalized amplitudes of the suggestion actions of all the features. Based on the results, changing TOBA_CONS is the most important (by a substantial amount) in terms of decreasing risk of atherosclerosis while SUBSC is the least important. The rest of the rankings are pretty similar to the rankings for the RBF SVM presented in Table 1.    Table 3: Feature interpretability for polynomial kernel (sorted by mean) Figure 11: Boxplot of CHLST action for gradient descent solution and nearest support vector.      In both graphs, we see the probability of decreasing the predicted risk by moving from the initial point to the suggested point.