本文整理汇总了Python中pystruct.learners.OneSlackSSVM.constraints_方法的典型用法代码示例。如果您正苦于以下问题:Python OneSlackSSVM.constraints_方法的具体用法?Python OneSlackSSVM.constraints_怎么用?Python OneSlackSSVM.constraints_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pystruct.learners.OneSlackSSVM
的用法示例。
在下文中一共展示了OneSlackSSVM.constraints_方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from pystruct.learners import OneSlackSSVM [as 别名]
# 或者: from pystruct.learners.OneSlackSSVM import constraints_ [as 别名]
print( "\tlabel histogram : ",
np.histogram(np.hstack([y.ravel() for y in YY]),
bins=range(14)))
print("YY[0].shape", YY[0].shape)
crf.initialize(XX, YY)# check if the data is properly built
sys.stdout.flush()
t0 = time.time()
ssvm.fit(XX, YY)
print("FIT DONE IN %.1fs"%(time.time() - t0))
sys.stdout.flush()
ssvm.alphas = None
ssvm.constraints_ = None
ssvm.inference_cache_ = None
if sMODELFILE:
print("Saving model in: ", sMODELFILE)
with open(sMODELFILE, "wb") as fd:
cPickle.dump(ssvm, fd)
else:
#REUSE PREVIOUSLY TRAINED MODEL
print(" RUSING PREVIOULSLY TRAINED MULTI-TYPE MODEL: ", sMODELFILE)
with open(sMODELFILE, "rb") as fd:
ssvm = pickle.load(fd)
print("INFERENCE WITH ", INFERENCE)
XX_test, YY_test =convertToTwoType(X_test,