官术网_书友最值得收藏!

How it works...

In Step 1, we imported the libraries that are required to build our models. In Step 2, we created the response and feature sets. We retrieved our feature set using the iloc() function of the pandas DataFrame. In Step 3, we split our dataset into training and testing sets. In Step 4, we built our base classifiers. Kindly note that we passed probability=True to our SVC function to allow SVC() to return class probabilities. In the SVC class, the default is probability=False.

In Step 5, we fitted our model to the training data. We used the predict_proba() function in Step 6 to predict the class probabilities for our test observations.

Finally, in Step 7, we assigned different weights to each of our models to estimate the weighted average predictions. The question that comes up is how to choose the weights. One way is to sample the weights uniformly and to make sure they normalize to one and validate on the test set and repeat keeping track of weights that provide the highest accuracy. This is an example of a random search. 

主站蜘蛛池模板: 宝兴县| 方正县| 邵阳市| 太保市| 天津市| 闽清县| 宁国市| 辽中县| 乐亭县| 民勤县| 石河子市| 泊头市| 滦平县| 通山县| 义乌市| 满洲里市| 和平区| 贺州市| 根河市| 资中县| 邻水| 寿宁县| 晋中市| 鄯善县| 新野县| 房山区| 柯坪县| 淮北市| 定边县| 雷波县| 富裕县| 蚌埠市| 休宁县| 拉孜县| 阳泉市| 德惠市| 喀什市| 台湾省| 肥乡县| 宁德市| 峨山|