pima indian diabetes dataset analysis code example

Example 1: pima indian diabetes dataset solutions

coeff = list(diabetesCheck.coef_[0])labels = list(trainData.columns)features = pd.DataFrame()features['Features'] = labelsfeatures['importance'] = coefffeatures.sort_values(by=['importance'], ascending=True, inplace=True)features['positive'] = features['importance'] > 0features.set_index('Features', inplace=True)features.importance.plot(kind='barh', figsize=(11, 6),color = features.positive.map({True: 'blue', False: 'red'}))plt.xlabel('Importance')

Example 2: pima indian diabetes dataset solutions

import pandas as pdimport numpy as npimport seaborn as snsimport matplotlib.pyplot as plt% matplotlib inlinefrom sklearn.linear_model import LogisticRegressionfrom sklearn.externals import joblib