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

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. 

主站蜘蛛池模板: 缙云县| 淳安县| 东兰县| 屏东县| 营山县| 固原市| 桂阳县| 天镇县| 崇文区| 瓮安县| 都安| 阜新市| 石泉县| 安多县| 新营市| 宿州市| 广灵县| 临湘市| 田阳县| 海兴县| 册亨县| 油尖旺区| 台前县| 嘉峪关市| 万安县| 芜湖县| 团风县| 伊通| 五大连池市| 深水埗区| 龙州县| 崇左市| 汝州市| 伊金霍洛旗| 余干县| 沁水县| 孙吴县| 大关县| 杭州市| 高青县| 界首市|