# Scale/ Normalize Independent Variables
X = StandardScaler().fit_transform(X)
#Split data into train an test set at 50% each
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.5, random_state=42)
gpc= GaussianProcessClassifier(1.0 * RBF(1.0), n_jobs=-1)
gpc.fit(X_train,y_train)
y_proba=gpc.predict_proba(X_test)
#classify as 1 if prediction probablity greater than 15.8%
y_pred = [1 if x >= .158 else 0 for x in y_proba[:, 1]]
上面的代码按预期运行。然而,为了解释这个模型,比如“Beta1的1个单位的变化将导致成功概率的0.7%的提高”,我需要能够看到θ。我该怎么做? 谢谢你的帮助。顺便说一句,这是家庭作业
很好的问题。您确实可以访问
thetas
,但是在文档中不清楚如何做到这一点使用以下方法。这里我使用
iris
数据集。你知道吗结果:
文档中访问
thetas
的示例可以找到HERE希望这有帮助。你知道吗
看起来您要查找的
theta
值似乎是传递给分类器的内核对象的属性。你可以阅读更多的in this section of the sklearn documentation。您可以使用classifier.kernel_.theta
访问分类器内核的θ的日志转换值,其中classifier
是分类器对象的名称。你知道吗注意,kernel object还有一个方法
clone_with_theta(theta)
,如果您要修改θ,这个方法可能会派上用场。你知道吗相关问题 更多 >
编程相关推荐