提升算法的sklearn-kit的API

Turns Out…

We can see from the scores above that our Naive Bayes model actually does a pretty good job of classifying spam and “ham.” However, let’s take a look at a few additional models to see if we can’t improve anyway.

Specifically in this notebook, we will take a look at the following techniques:

Another really useful guide for ensemble methods can be found in the documentation here.

These ensemble methods use a combination of techniques you have seen throughout this lesson:

  • Bootstrap the data passed through a learner (bagging).
  • Subset the features used for a learner (combined with bagging signifies the two random components of random forests).
  • Ensemble learners together in a way that allows those that perform best in certain areas to create the largest impact (boosting).

In this notebook, let’s get some practice with these methods, which will also help you get comfortable with the process used for performing supervised machine learning in Python in general.

Since you cleaned and vectorized the text in the previous notebook, this notebook can be focused on the fun part - the machine learning part.

This Process Looks Familiar…

In general, there is a five step process that can be used each time you want to use a supervised learning method (which you actually used above):

  1. Import the model.
  2. Instantiate the model with the hyperparameters of interest.
  3. Fit the model to the training data.
  4. Predict on the test data.
  5. Score the model by comparing the predictions to the actual values.

Follow the steps through this notebook to perform these steps using each of the ensemble methods: BaggingClassifier, RandomForestClassifier, and AdaBoostClassifier.

Step 1: First use the documentation to import all three of the models.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值