本文整理汇总了Python中sklearn.linear_model.OrthogonalMatchingPursuit.predict方法的典型用法代码示例。如果您正苦于以下问题:Python OrthogonalMatchingPursuit.predict方法的具体用法?Python OrthogonalMatchingPursuit.predict怎么用?Python OrthogonalMatchingPursuit.predict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.linear_model.OrthogonalMatchingPursuit
的用法示例。
在下文中一共展示了OrthogonalMatchingPursuit.predict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fit_model_14
# 需要导入模块: from sklearn.linear_model import OrthogonalMatchingPursuit [as 别名]
# 或者: from sklearn.linear_model.OrthogonalMatchingPursuit import predict [as 别名]
def fit_model_14(self,toWrite=False):
model = OrthogonalMatchingPursuit()
for data in self.cv_data:
X_train, X_test, Y_train, Y_test = data
model.fit(X_train,Y_train)
pred = model.predict(X_test)
print("Model 14 score %f" % (logloss(Y_test,pred),))
if toWrite:
f2 = open('model14/model.pkl','w')
pickle.dump(model,f2)
f2.close()
示例2: classify_OMP
# 需要导入模块: from sklearn.linear_model import OrthogonalMatchingPursuit [as 别名]
# 或者: from sklearn.linear_model.OrthogonalMatchingPursuit import predict [as 别名]
def classify_OMP(train, test):
from sklearn.linear_model import OrthogonalMatchingPursuit as OMP
x, y = train
ydim = np.unique(y).shape[0]
y = [tovec(yi, ydim) for yi in y]
clf = OMP()
clf.fit(x, y)
x, y = test
proba = clf.predict(x)
return proba
示例3: SelectKBest
# 需要导入模块: from sklearn.linear_model import OrthogonalMatchingPursuit [as 别名]
# 或者: from sklearn.linear_model.OrthogonalMatchingPursuit import predict [as 别名]
feature_selection = SelectKBest(f_classif, k=50)
anova_svc = Pipeline([('anova', feature_selection), ('svc', clf)])
anova_svc.fit(X_train, y_train[i, :])
pipelines.append(anova_svc)
"""
"""
f_classif 100 + Ridge
"""
from sklearn.linear_model import OrthogonalMatchingPursuit as OMP
clf = OMP(n_nonzero_coefs=20)
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
"""
clf.fit(X_train, y_train_tall.T)
y_pred_tall = clf.predict(X_test)
clf.fit(X_train, y_train_large.T)
y_pred_large = clf.predict(X_test)
clf.fit(X_train, y_train_big.T)
y_pred_big = clf.predict(X_test)
"""
"""