# 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个单位的改变将导致成功概率的.7%提高”,我需要能够看到θ。我该怎么做呢?谢谢你的帮助。顺便说一句,这是一个家庭作业。
发布于 2018-06-04 00:41:35
看起来,您要查找的theta
值是您传递给分类器的内核对象的属性。你可以阅读更多的in this section of the sklearn documentation。您可以使用classifier.kernel_.theta
访问分类器内核的对数转换的theta值,其中classifier
是您的分类器对象的名称。
请注意,kernel object还有一个方法clone_with_theta(theta)
,如果您正在对theta进行修改,该方法可能会派上用场。
https://stackoverflow.com/questions/50668340
复制相似问题