g-simmons / mfp

FastText Word Embeddings Improve Prediction of Diet Success for MyFitnessPal Users
1 stars 0 forks source link

Feature Importances #1

Open g-simmons opened 5 years ago

g-simmons commented 5 years ago

For some reason sklearn's SVC will not return the coefficients. Running the below code gives the following attribute error. I think this may be an issue with the versions of scipy and sklearn, but I am not sure.

def f_importances(coef, names):
    imp = coef
    imp,names = zip(*sorted(zip(imp,names)))
    plt.barh(range(len(names)), imp, align='center')
    plt.yticks(range(len(names)), names)
    plt.show()

f_importances(svc.coef_, X.columns[0:100])

image

g-simmons commented 5 years ago

Fixed the above issue, now just need to identify foods that are rich in the important dimensions