当前位置: 首页>>代码示例>>Python>>正文


Python OrthogonalMatchingPursuit.predict方法代码示例

本文整理汇总了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()
开发者ID:JakeMick,项目名称:kaggle,代码行数:15,代码来源:days_work.py

示例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
开发者ID:liangxh,项目名称:idu,代码行数:15,代码来源:classification.py

示例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)
"""



"""
开发者ID:dengemann,项目名称:nisl.github.com,代码行数:33,代码来源:kamitani9.py


注:本文中的sklearn.linear_model.OrthogonalMatchingPursuit.predict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。