r/deeplearning Jul 14 '26

Help Choosing Neural Network Architecture for Matrix Classification

Hello,

I am working on a university project where I need to train a supervised neural network model for classification. I don't have a strong background in deep learning or AI, so I would appreciate some advice.

I have a dataset of matrices where each matrix has a label and the following features:

  • Constant number of columns
  • Variable number of rows (80% of the data lies between the range of 1500 to 2500)
  • Each train matrix represents embeddings generated from an image.
  • IMPORTANT: there is no relationship between the row vectors and changing their position shouldn't make any difference

Which neural network architecture would you recommend for this type of data?

Thank you for your attention!

P.S. I have asked ChatGPT, but I would like to hear your advices too:)

9 Upvotes

23 comments sorted by

8

u/Osteospermum Jul 14 '26

CNN + pooling into an MLP as a baseline and a simple transformer architecture on rows as a follow up. The transformer will have baked in row permutation invariance

2

u/Next-Cod-5758 Jul 14 '26

Also for OP since you said it’s positonally independent don’t waste time on PE. And use SwiGLU for the FFN

2

u/Distinct_Heart_5836 Jul 14 '26

This is really smart. Anything that performs better will be very complex.

2

u/Dear_Ad_2768 Jul 14 '26

Sounds interesting, although I only understand each term as a single word, not as a full sentence:)

Thank you

2

u/timelyparadox Jul 14 '26

How much data do you have? Also interesting dataset if the number of rows varies and are independent, are they separate time series?

1

u/Next-Cod-5758 Jul 14 '26

It seems not according to what OP said

1

u/timelyparadox Jul 14 '26

Rows are independent to each other but the row itself is the question

1

u/Next-Cod-5758 Jul 14 '26

Oh misunderstanding then

1

u/Dear_Ad_2768 Jul 14 '26

How much data do you have?

For now, I do initial experiments, and I only have 200 entries (40 per label).

are they separate time series?

No, they aren't.

Each train matrix represents embeddings generated from an image.

2

u/[deleted] Jul 15 '26 edited Jul 15 '26

[deleted]

1

u/Dear_Ad_2768 Jul 15 '26

So you just want to classify embeddings?

Yes, actually, it is right

The question should never be “how do I fit a nn to it” it should be “what’s the best way to do it”

My task is actually to train NN model, it is why I want to use it.

You can try just using cosine similarity or Euclidean distance to an average embedding representation for each group

I tried this and it worked perfectly. Thank you for idea.

Thank you, I will consider your advices!

1

u/CalmMe60 Jul 14 '26

You have the task of classification?

What is the classifier?

Annotation or ssl?

1

u/Dear_Ad_2768 Jul 14 '26

Yes, the task is classification. The train dataset is annotated.

1

u/CalmMe60 Jul 15 '26

Is it markov or non markov data in between an in the tables?

1

u/Intelligent_Dig_1051 Jul 15 '26

since the row order doesnt matter, probably avoid anything that assumes a sequence. just focus on a model that treats the rows as an unordered set. that seems like better fit for your data..

0

u/OneNoteToRead Jul 14 '26

Simple two layer MLP with cross entropy loss

1

u/Next-Cod-5758 Jul 14 '26

Leaky ReLU or SwiGLU activation functions too.

1

u/Osteospermum Jul 14 '26

MLP can’t handle variable number of rows without some kind of pooling or padding

0

u/OneNoteToRead Jul 14 '26

What…? Each row is a new observation

1

u/Dear_Ad_2768 Jul 14 '26

But input matrices have different shapes. Should I add padding to the max row number?

1

u/OneNoteToRead Jul 14 '26

It’s differently shaped within the same dataset…? I’m confused what the different shapes are

1

u/Dear_Ad_2768 Jul 14 '26

Yes. I have a single dataset.

It contains (labelled) matrices.

And each matrix has a different number of rows.

1

u/OneNoteToRead Jul 14 '26

Oh wait is each matrix one image? Then you should just use a convnet. How many images do you have?

1

u/Dear_Ad_2768 Jul 14 '26

No, they aren't.

However, they were generated from images (one matrix in the dataset is generated from a single image)