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


Python SVR.pred方法代码示例

本文整理汇总了Python中sklearn.svm.SVR.pred方法的典型用法代码示例。如果您正苦于以下问题:Python SVR.pred方法的具体用法?Python SVR.pred怎么用?Python SVR.pred使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sklearn.svm.SVR的用法示例。


在下文中一共展示了SVR.pred方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: inner_product

# 需要导入模块: from sklearn.svm import SVR [as 别名]
# 或者: from sklearn.svm.SVR import pred [as 别名]

def inner_product(example1, example2):
    return example1.h_add * example2.h_add + example1.h_max * example2.h_max + example1.h_ff * example2.h_ff


def gram_matrix(examples1, examples2):
    gram = zeros((len(examples1), len(examples2)))
    for i in range(len(examples1)):
        for j in range(len(examples2)):
            gram[i, j] = inner_product(examples1[i], examples2[j])
    return gram


print examples[1].h_ff

from sklearn.svm import SVR, NuSVR

model = SVR(C=1000, epsilon=0.1, kernel="precomputed")  # model = SVR(kernel=kernel)
print gram_matrix(examples, examples)
model.fit(gram_matrix(examples, examples), array([example.cost for example in examples]))
print array([example.cost for example in examples])
print model.predict(gram_matrix(examples[:1], examples))


from mlpy import KernelRidge

model = KernelRidge(lmb=0.01)
model.learn(gram_matrix(examples, examples), array([example.cost for example in examples]))
print model.pred(gram_matrix(examples[:1], examples))
开发者ID:beomjoonkim,项目名称:openrave_repo,代码行数:31,代码来源:untitled.py


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