當前位置: 首頁>>代碼示例>>Python>>正文


Python RealFeatures.set_feature_vector方法代碼示例

本文整理匯總了Python中modshogun.RealFeatures.set_feature_vector方法的典型用法代碼示例。如果您正苦於以下問題:Python RealFeatures.set_feature_vector方法的具體用法?Python RealFeatures.set_feature_vector怎麽用?Python RealFeatures.set_feature_vector使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在modshogun.RealFeatures的用法示例。


在下文中一共展示了RealFeatures.set_feature_vector方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: features_dense_modular

# 需要導入模塊: from modshogun import RealFeatures [as 別名]
# 或者: from modshogun.RealFeatures import set_feature_vector [as 別名]
def features_dense_modular (A=matrixA,B=matrixB,C=matrixC):

    a=RealFeatures(A)
    b=LongIntFeatures(B)
    c=ByteFeatures(C)

# or 16bit wide ...
#feat1 = f.ShortFeatures(N.zeros((10,5),N.short))
#feat2 = f.WordFeatures(N.zeros((10,5),N.uint16))


# print(some statistics about a)

# get first feature vector and set it

    a.set_feature_vector(array([1,4,0,0,0,9], dtype=float64), 0)

# get matrices
    a_out = a.get_feature_matrix()
    b_out = b.get_feature_matrix()
    c_out = c.get_feature_matrix()

    assert(all(a_out==A))

    assert(all(b_out==B))

    assert(all(c_out==C))
    return a_out,b_out,c_out,a,b,c
開發者ID:42MachineLearning,項目名稱:shogun,代碼行數:30,代碼來源:features_dense_modular.py

示例2: features_dense_real_modular

# 需要導入模塊: from modshogun import RealFeatures [as 別名]
# 或者: from modshogun.RealFeatures import set_feature_vector [as 別名]
def features_dense_real_modular (A=matrix):

# ... of type Real, LongInt and Byte
    a=RealFeatures(A)

# print(some statistics about a)
#print(a.get_num_vectors())
#print(a.get_num_features())

# get first feature vector and set it
#print(a.get_feature_vector(0))
    a.set_feature_vector(array([1,4,0,0,0,9], dtype=float64), 0)

# get matrix
    a_out = a.get_feature_matrix()

    assert(all(a_out==A))
    return a_out
開發者ID:42MachineLearning,項目名稱:shogun,代碼行數:20,代碼來源:features_dense_real_modular.py


注:本文中的modshogun.RealFeatures.set_feature_vector方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。