models icon indicating copy to clipboard operation
models copied to clipboard

[TASK] Implement PredictNext, PredictLast & PredictRandom

Open marcromeyn opened this issue 3 years ago • 0 comments

We need a bunch of augmentations to support session-based recsys. In the examples below we have a sequence: ABCDE that we augment in following ways:

Prediction-next

Inputs A B C D
Targets B C D E

class PredictNext(DataAugmentation):
	def __init__(
		self, 
		schema: Schema
		target: Union[str, Tag, ColSchema],
	):
		...

Predict-last

Inputs A B C D
Targets E
class PredictLast(DataAugmentation):
	def __init__(
		self, 
		schema: Schema
		target: Union[str, Tag, ColSchema],
	):
		...

Predict-random

We grow the batch with extra samples where we sample a row_index, use the previous timesteps as features, the next as target.

Inputs A B C D
Targets E
Inputs A
Targets B
Inputs A B
Targets C
class PredictRandom(DataAugmentation):
	def __init__(
		self, 
		schema: Schema
		target: Union[str, Tag, ColSchema],
		# causal will control whether or not the elements in the sequence after the radomly picket element will be added to the inputs
		causal=True,
		# When this is bigger than 1, we will grow the batch with more samples
		num_per_batch=1
	):
		...

marcromeyn avatar Aug 30 '22 08:08 marcromeyn