tensorflow-playground icon indicating copy to clipboard operation
tensorflow-playground copied to clipboard

Problem with generate_batch_cbow(data,batch_size, num_skips=2, skip_window=2)

Open gourango01 opened this issue 8 years ago • 2 comments

ValueError: cannot copy sequence with size 4 to array axis with dimension 2.

gourango01 avatar Oct 04 '16 11:10 gourango01

Got a solution, but I did not check it for correctness. It involves making the mask for the sliding windows fit your dimensions.

romusters avatar Nov 02 '16 13:11 romusters

Here is what i did

	# move the sliding window  
	for i in range(batch_size):
		mask = [0] * span
		# taking context words equal to num_skips
		for ns in range(0,num_skips):
			posNumber = random.randint(0,span-1)
			while (posNumber == skip_window or or mask[posNumber]== 1):
				posNumber = random.randint(0,span-1)
			mask[posNumber]=1   

LopezGG avatar Sep 21 '17 04:09 LopezGG