Creating new dataset for LatentSSVM (in right format)

25 views
Skip to first unread message

Rizwan Parvez

unread,
Jan 2, 2017, 3:55:20 AM1/2/17
to pystruct
Hi, 
I am trying to train and fit my own dataset. I tried to use

nodes = []
object_1 = [1,2,3]
object_2 = [4,5,6]
object_3 = [7,8,9]
object_4 = [11,12,13]
object_5 = [14,15,19]
object_6 = [24,42,39]

image_1 = np.array([object_1, object_2])
image_2 = np.array([object_3])
image_3 = np.array([object_4, object_5, object_6])
nodes = [image_1,image_2, image_3]

new_x = [(features_i, np.vstack([np.arange(features_i.shape[0] - 1), np.arange(1, features_i.shape[0])])) for features_i in nodes]
new_y =[[1], [1], [0]]

latent_pbl = LatentGraphCRF(n_states_per_label=5,
inference_method='unary')
base_ssvm = NSlackSSVM(latent_pbl, C=1, tol=.01,
inactive_threshold=1e-3, batch_size=10)
latent_svm = LatentSSVM(base_ssvm=base_ssvm, latent_iter=2)


but I could not fit it:
latent_svm.fit(new_x, new_y)

Would anyone please tell me what is wrong? I don't understand what should be my n_states_per_label, and inference_method, batch size. 
Most importantly what is the right format of trainset?
Reply all
Reply to author
Forward
0 new messages