Feature extraction and PCA 4 – Predictions Don’t Grow on Trees, or Do They?

We have gathered 1,288 images of people’s faces, and each one has 1,850 features (pixels) that identify that person. Here’s the code we used – an example of one of our faces can be seen in Figure 11.22:plt.imshow(X[100].reshape((h, w)), cmap=plt.cm.gray) lfw_people.target_names[y[100]] ‘George W Bush’ Figure 11.22 – A face from our dataset: George W. Bush […]

Read More

Feature extraction and PCA 3 – Predictions Don’t Grow on Trees, or Do They?

Our goal is to predict whether or not a person gave a 5- or 1-star review based on the words they used in the review. Let’s set a baseline with logistic regression and see how well we can predict this binary category:from sklearn.linear_model import LogisticRegression lr = LogisticRegression()X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=100) […]

Read More


          Terms of Use | About Whystephanie | Privacy Policy | Cookies | Accessibility Help | Contact whystephanie