The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

627295 (2) [Avatar] Offline
I'm trying to make sure to thoroughly read each chapter and run all the code. Fun book so far, but I'm stumbling on section 4.7.1

I see, in the last snippet of this section, the following code:
>>> X_train, X_test, y_train, y_test = train_test_split(pca_topicvectors.values, sms.spam, test_size=0.3, random_>>> lda = LDA(n_components=1)
>>>, y_train)
LinearDiscriminantAnalysis(n_components=1, priors=None, shrinkage=None,
solver='svd', store_covariance=False, tol=0.0001)
>>> lda.score(X_test, y_test).round(3)
>>> lda = LDA(n_components=1)
>>> scores = cross_val_score(lda, pca_topicvectors, sms.spam, cv=10)
>>> "Accuracy: {:.3f} (+/-{:.3f})".format(scores.mean(), scores.std() * 2)
'Accuracy: 0.958 (+/-0.022)'

Unfortunately, I see no definition of pca_topicvectors anywhere in the code. I've got all the code for Chapter 4 running in a Jupyterlab notebook so far, but am stuck on this section.

Am i missing something simple here?
627295 (2) [Avatar] Offline

I see now that the variable is defined elsewhere and I simply neglected to include this variable from section 4.4.3 into my code.

This question is resolved. Apologies for my error.