fatf.transparency.sklearn.linear_model
.linear_classifier_coefficients¶
-
fatf.transparency.sklearn.linear_model.
linear_classifier_coefficients
(clf: sklearn.base.BaseEstimator) → numpy.ndarray[source]¶ Extracts coefficients (feature importances) of a linear scikit-learn model.
New in version 0.0.2.
Note
Please note that for the coefficients (feature importances) to be comparable the values of all features had to be normalised to the same range before training the model.
- Parameters
- clfsklearn.base.BaseEstimator
A linear scikit-learn model.
- Returns
- coefficientsnumpy.ndarray
A numpy array that holds coefficients of the
clf
linear model. (The order of the coefficients corresponds to the order of the features in the training data array).
- Raises
- sklearn.exceptions.NotFittedError
The scikit-learn package (
sklearn.utils.validation.check_is_fitted
function) will raise this exception if the model is not fitted.- TypeError
The
clf
classifier is not a scikit-learn linear model.