Questions tagged [ragged]

A ragged array (or jagged array) is an array of arrays. The elements of a ragged array can be of different dimensions and sizes.

https://en.wikipedia.org/wiki/Jagged_array

78 questions
1
vote
1 answer

Space efficient data store for list of list of lists. Elements are integers, and size of all lists varies in length

Say my data looks like this thisList = [ [[13, 43, 21, 4], [33, 2, 111, 33332, 23, 43, 2, 2], [232, 2], [23, 11]] , [[21, 2233, 2], [2, 3, 2,1, 32, 22], [3]], [[3]], [[23, 12], [55, 3]], .... ] What is the most…
SantoshGupta7
  • 5,607
  • 14
  • 58
  • 116
1
vote
1 answer

Is there a way to normalize a ragged tensor?

I have tried tf.linalg.normalize and it gave me a value error: ValueError: TypeError: object of type 'RaggedTensor' has no len(). Also I could not make tf.keras.layers.experimental.preprocessing.Normalization() method work. Thank you,
Arwen
  • 168
  • 1
  • 13
1
vote
0 answers

input shape problem with RaggedTensor input in RNN

I have created ragged tensors from python lists as below. > list_a=tf.ragged.constant(list_a) > list_b=tf.ragged.constant(list_b) Checking the shapes gives me: list_a.shape TensorShape([10555, None,…
Arwen
  • 168
  • 1
  • 13
1
vote
0 answers

Keras custom layer on ragged tensor to reduce dimensionallity

I'm trying to write a custom layer that will handle variable-length vectors, and reduce them to the same length vector. The length is known in advance because the reason for the variable lengths is that I have several different data types that I…
Daniel Dror
  • 2,304
  • 28
  • 30
1
vote
1 answer

Converting Tensor to Ragged Tensor in Graph mode using Keras

I want to convert a Tensor to a Ragged Tensor in my graph using Keras. However, the function RaggedTensor.from_row_lengths fails in my graph. Tensorflow version: tf-nightly 2.1.0.dev20191203 Here's a code sample: import tensorflow as tf import…
Jcb3
  • 11
  • 1
  • 2
1
vote
0 answers

How do I pad a tf.data.Dataset that contains non-uniform tf.RaggedTensors?

There is a tutorial for creating a Transformer Chatbot that takes several lists of encoded-by-word sentences with different lengths, and first pads that length difference with tf.keras.preprocessing, then creates the dataset from such encoded…
David
  • 11
  • 2
1
vote
1 answer

How to read a dataset into pandas and leave out rows with uneven column count

I am trying to read a dataset, which has few rows with uneven column count ('ragged'). I want to leave out those rows and read the rest of the rows. Is it possible in pandas instead of breaking the dataset into separate data frames and combining…
1
vote
0 answers

Python h5py - efficient access of arrays of ragged arrays

I have a large h5py file with several ragged arrays in a large dataset. The arrays have one of the following types: # Create types of lists of variable length vectors vardoub = h5py.special_dtype(vlen=np.dtype('double')) varint =…
Marie R
  • 270
  • 3
  • 9
1
vote
1 answer

Reading ragged file into a 2d array - print - and find average of columns

I am having trouble reading the entire file and placing it into the array. It keeps leaving out the last 2 numbers in my txt file. What am I doing wrong in my createArr() method that is causing this. Also, my method avgTimeTemp() is not producing…
Kassie
  • 81
  • 4
0
votes
0 answers

Behavior sequence transformer model (BST) width variable-length sequences

I would like to adapt the BST model "BEHAVIOR SEQUENCE TRANSFORMER" so that it accepts variable-length sequences as input, I tried to use RaggedTensor, but the problem is how create the Input layer of movie_id and rating…
0
votes
0 answers

Does keras tuner support ragged tensors?

Appologies if this has been covered elsewhere but after a few days of hunting I can't seem to find a suitable answer. I am working with ragged tensors comprising short sections of waveform data. I wanted to be able to utilize the keras tuner. From…
webber.96
  • 1
  • 1
0
votes
0 answers

Tensorflow Keras, when using RaggedTensor as a prediction input, the prediction result is not consistent. Why?

I am currently practicing with tf.raggedtensor. I found the prediction results with tf.raggedtensor as a input changes every time when I make a prediction. Why does it change? Shouldn't the result be the same if the model and the input is…
RottsMe
  • 1
  • 3
0
votes
0 answers

Ragged rank for TensorFlow ragged constant and ragged stack not retrieving shape information and instead is returning none for known shape

I am trying to create an input to check my graph convolutional model which should receive a shape of (n,2,2,none,none) with n being the batch size and 2,2 being a pair of a pair of none,none shape matrices since the matrices will have different…
0
votes
2 answers

Ragged list to dataframe

I have a non-uniform list as follows: [['E', 'A', 'P'], ['E', 'A', 'X', 'P'], ['E', 'A', 'P'], ['P'], ['E', 'A', 'X', 'P'], ['E', 'A', 'P'], ['A', 'X', 'P'], ['E', 'A', 'P'], ['E', 'A', 'P'], ['E', 'A', 'X', 'P'], ['E', 'A', 'P'], ['E',…
Ossz
  • 314
  • 1
  • 10
0
votes
2 answers

In-place shuffle of a contiguous ragged array

I have a ragged array represented as a contiguous block of memory along with its "shape", corresponding to the length of each row, and its "offsets", corresponding to the index of the first element in each row. To illustrate, I have an array…
MSR
  • 2,731
  • 1
  • 14
  • 24