How to know which features in a linear classifier mainly led to a prediction? I have a classification problem where I use a model (say Logistic regression or SVM) to determine whether an instance belongs to class 0 or class 1. 
For a certain prediction on a test instance X, if the prediction is class 0, I want to quantify the degree to which the features led to this prediction and obtain the main features that led to this prediction. 
For simplification, I can assume that the model is linear. 
I'm aware of techniques such as PCA, mutual information and information gain etc to determine correlation between features, linear combination of features, or how useful they are in an overall sense etc. My question is how to obtain the usefulness with respect to a specific instance and its prediction. 
 A: Any linear classification model can be represented as $class =sgn(\sum\nolimits \omega_i x_i - \epsilon)$, where $x$ is a feature vector of test example, $\omega$ is a weight vector of the model (separating hyperplane coefficients), and $\epsilon$ is a analyst-defined threshold.
Thus to know the most important features for single training example's positive prediction you only need to choose those $i$, for which $\omega_i x_i$ are maximum.
Also, if your training data was normalized, you can quantify the importance of each your model's features in general using only it's weight vector: features with larger weights contribute more to the result.
A: To add an illustration to @besvare's answer: 

(taken from my thesis)
Basically, in black you see the 2  coefficient vectors for a 3-class LDA. In color are the "contributions" of the features for each of the 3 classes towards their prediction. As you can see, prominent coefficients do not always lead to large contributions towards the respective class. 
Same story in English including a discussion of a bunch of things one should keep in mind for the interpretation is here (there's a slight difference to the thesis image in the centering, but otherwise it is the same):
C. Beleites, K. Geiger, M. Kirsch, S. B. Sobottka, G. Schackert and R. Salzer: Raman spectroscopic grading of astrocytoma tissues: using soft reference information, Anal. Bioanal. Chem., 400 (2011), 2801 - 2816. 
DOI: 10.1007/s00216-011-4985-4
personal web page with AAM version
