Answers.Body: <p>Any neural network might be able to find some pattern (if there is one), provided adequate data. But you can always optimize with right assumptions.</p>
  <p>For instance, there might not be always a relation between visual representation of the snapshot and the function family (many families can span similar space).
  So, using a CNN might not be a good idea. The data has no temporal relation, so RNNs are out as well.</p>
  <p>An adequately large FNN and data will give you good results. You can later prune it and optimize.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-21T18:05:32.677Z
Answers.LastActivityDate: 2022-12-21T18:05:32.677Z
Answers.UserDisplayName: Aether
Answers.Body: <p>according to the question you have 2 classes. the samples from the first class are generated according to f and the samples from the second class are generated according to function g which is different from f, i.e the points are simulated according to different dynamics.</p>
  <p>Now we need to train a classifier to return the conditional probability of <span class="math-container">$P(Class|X,Y,Z,A,B)$</span>.</p>
  <p>depending on how non-linear this classification problem is, You can simply start with a simple fully connected network (lets say with 3 to 5 layers)
  and obviously the input layer has 5 node and hidden layers arbitrary size (shown with h_i) and the output layer should have two nodes (because you want to assign a score to 2 classes).</p>
  <p>here is the number and size of the layers<br />
  Layers: [5,h_1,h_2,...,h_last,2]<br />
  Then you can train your network with CrossEntropy loss (<a href="https://medium.com/swlh/cross-entropy-loss-in-pytorch-c010faf97bab" rel="nofollow noreferrer">https://medium.com/swlh/cross-entropy-loss-in-pytorch-c010faf97bab</a>)</p>
  <p>Once you got the first result, I would play with the the number of hidden layers (m) and size of each layer (h_i). If still the result is not good enough then you can think of more complex models such transformers -the backbone of large language models- (<a href="https://arxiv.org/pdf/1706.03762" rel="nofollow noreferrer">https://arxiv.org/pdf/1706.03762</a>) which is more powerfull.</p>
  <p>I hope I gave you some ideas how to proceed.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-07-09T13:47:38.537Z
Answers.LastActivityDate: 2024-07-09T13:47:38.537Z
Answers.UserDisplayName: saleh
Body: <p><strong>Problem Summary:</strong> Identify which equation a set of data was most likely generated from</p>
  <p><strong>Problem Description:</strong> Let's say I have two different equations that are functions of variables X and Y and parameters A and B.</p>
  <ul>
  <li>Class 1: <span class="math-container">$Z = f(X,Y,A,B)$</span></li>
  <li>Class 2: <span class="math-container">$Z = g(X,Y,A,B)$</span></li>
  </ul>
  <p>Now lets say I solve each equation 10k times using provided X and Y values, but randomized parameter values. This will generate two matrices with columns X, Y, and Z and 10k rows which I will now refer to as &quot;snapshots&quot;. Below is an example of a visualization with the color representing the Z value.</p>
  <p><strong>NOTE:</strong> I'm not interested in just building a CNN to classifying the snapshot visualizations below because I hope to generalize this problem to equations with many more variables so they cant really be visualized easily.</p>
  <p><a href="https://i.sstatic.net/6CqTc.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6CqTc.jpg" alt="enter image description here" /></a></p>
  <p><strong>My goal is to train a neural net using these snapshots (raw data, not visualizations) that are labeled with the equation that generated them.</strong></p>
  <p>However, I'm not really sure which type of neural net I should use. I could perhaps take a simple approach with a few fully-connected layers and the input would be the stretched out snapshot (so 30k long vector). Or maybe I need to use a CNN?</p>
  <p>My primary concern is that unlike with an image, the features of these snapshots are kind of meaningless. For example, in a normal image each feature refers a specific pixel. But with these snapshots, each row is just a random simulation of the equation.</p>
  <hr />
  <p><strong>My Question:</strong></p>
  <p>Does anyone have a recommendation on which type of neural net to use for this problem? Perhaps recommendations on useful abstractions/transformations of the raw data I could use as features? Any online resources (github/kaggle notebooks, academic papers) that have investigated a similar question would be extremely helpful.</p>
  <hr />
  <p><strong>EDIT:</strong>
  Some additional thoughts. Perhaps I need to sort the snapshot based on the Z values so now the rows have meaning (largest output, 2nd largest output, etc).</p>
  
Tags: <neural-networks><convolutional-neural-networks><classification><keras><feature-selection>
Title: Which type of neural network to use to classify data by which equation most likely generated it?
UserDisplayName: Nova
ThreadText: # Which type of neural network to use to classify data by which equation most likely generated it?
  
  (Asked by: username_0 on 2022-12-21)
  
  **Problem Summary:** Identify which equation a set of data was most likely generated from
  
  **Problem Description:** Let's say I have two different equations that are functions of variables X and Y and parameters A and B.
  
  * Class 1: $Z = f(X,Y,A,B)$
  * Class 2: $Z = g(X,Y,A,B)$
  
  Now lets say I solve each equation 10k times using provided X and Y values, but randomized parameter values. This will generate two matrices with columns X, Y, and Z and 10k rows which I will now refer to as "snapshots". Below is an example of a visualization with the color representing the Z value.
  
  **NOTE:** I'm not interested in just building a CNN to classifying the snapshot visualizations below because I hope to generalize this problem to equations with many more variables so they cant really be visualized easily.
  
  [![enter image description here](https://i.sstatic.net/6CqTc.jpg)](https://i.sstatic.net/6CqTc.jpg)
  
  **My goal is to train a neural net using these snapshots (raw data, not visualizations) that are labeled with the equation that generated them.**
  
  However, I'm not really sure which type of neural net I should use. I could perhaps take a simple approach with a few fully-connected layers and the input would be the stretched out snapshot (so 30k long vector). Or maybe I need to use a CNN?
  
  My primary concern is that unlike with an image, the features of these snapshots are kind of meaningless. For example, in a normal image each feature refers a specific pixel. But with these snapshots, each row is just a random simulation of the equation.
  
  ---
  
  **My Question:**
  
  Does anyone have a recommendation on which type of neural net to use for this problem? Perhaps recommendations on useful abstractions/transformations of the raw data I could use as features? Any online resources (github/kaggle notebooks, academic papers) that have investigated a similar question would be extremely helpful.
  
  ---
  
  **EDIT:**
  Some additional thoughts. Perhaps I need to sort the snapshot based on the Z values so now the rows have meaning (largest output, 2nd largest output, etc).
  
  **Tags:** neural-networks, convolutional-neural-networks, classification, keras, feature-selection
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-12-21. Score: 2
  
  Any neural network might be able to find some pattern (if there is one), provided adequate data. But you can always optimize with right assumptions.
  
  For instance, there might not be always a relation between visual representation of the snapshot and the function family (many families can span similar space).
  So, using a CNN might not be a good idea. The data has no temporal relation, so RNNs are out as well.
  
  An adequately large FNN and data will give you good results. You can later prune it and optimize.
  
  
  ---
  
  ### Answer by username_2 on 2024-07-09. Score: 1
  
  according to the question you have 2 classes. the samples from the first class are generated according to f and the samples from the second class are generated according to function g which is different from f, i.e the points are simulated according to different dynamics.
  
  Now we need to train a classifier to return the conditional probability of $P(Class|X,Y,Z,A,B)$.
  
  depending on how non-linear this classification problem is, You can simply start with a simple fully connected network (lets say with 3 to 5 layers)
  and obviously the input layer has 5 node and hidden layers arbitrary size (shown with h\_i) and the output layer should have two nodes (because you want to assign a score to 2 classes).
  
  here is the number and size of the layers  
  Layers: [5,h\_1,h\_2,...,h\_last,2]  
  Then you can train your network with CrossEntropy loss (<https://medium.com/swlh/cross-entropy-loss-in-pytorch-c010faf97bab>)
  
  Once you got the first result, I would play with the the number of hidden layers (m) and size of each layer (h\_i). If still the result is not good enough then you can think of more complex models such transformers -the backbone of large language models- (<https://arxiv.org/pdf/1706.03762>) which is more powerfull.
  
  I hope I gave you some ideas how to proceed.
  
  
  ---
  
  