Answers.Body: <blockquote>
    <p>Would I be right in saying that this becomes a sort of 'pattern recognition' problem? </p>
  </blockquote>
  
  <p>Technically, yes. In practice: no.</p>
  
  <p>I think you might be interpreting the term "pattern recognition" a bit too literal. Even though <a href="https://en.wikipedia.org/wiki/Pattern_recognition" rel="nofollow noreferrer">wikipedia</a> defines Pattern recognition as "a branch of machine learning that focuses on the recognition of patterns and regularities in data", it's not about solving problems that can "easily" be deduced by logical reasoning.</p>
  
  <p>E.g. you say that</p>
  
  <blockquote>
    <p>A '1' in the top right triangle in the matrix represents a convex relationship between two faces and a '1' in the bottom left triangle represents a concave relationship</p>
  </blockquote>
  
  <p>This is true <em>always</em>. In a typical machine learning situation, you wouldn't (usually) have this prior knowledge. At least not to the extent that it would b be tractable to “solve by hand”.</p>
  
  <p>Pattern recognition is conventionally a statistical approach to solving problems when they get too complex to analyze with conventional logical reasoning and simpler regression models. Wikipedia also states (with a source) that pattern recognition "in some cases considered to be nearly synonymous with machine learning".</p>
  
  <p>That being said: you <em>could</em> use pattern recognition on this problem. However, it seems like overkill in this case. Your problem, as far as I can understand, has an actual "analytical" solution. That is: you can, by logic, get a 100% correct result all the time. Machine learning algorithms could, in theory, also do this, and in that case, and this branch of ML is referred to as Meta Modelling[1].</p>
  
  <blockquote>
    <p>For example, if I supply the network with a number of training models - along with labels which describe the design feature which exists in the model, would the network learn to recognise specific adjacency patterns represented in the matrix which relate to certain design features?</p>
  </blockquote>
  
  <p>In a word: Probably. Best way to go? Probably not. Why not, you ask?</p>
  
  <p>There is always the possibility that your model doesn't learn exactly what you want. In addition you have many challenges like <a href="https://en.wikipedia.org/wiki/Overfitting" rel="nofollow noreferrer">overfitting</a> that you'd need to concern yourself about. It's a statistical approach, as I said. Even if it classifies all your test data as 100% correct, there is no way (unless you check the insanely intractable maths) to be 100% sure that it will always classify correctly. I further suspect that you're also likely to end up spending more time working on your model then the time it would take to just deduce the logic.</p>
  
  <p>I also disagree with @Bitzel: I would not do a CNN (convolutional neural network) on this. CNNs are used when you want to look at specific parts of the matrix, and the relation and connectedness between the pixels are important — for example on images. Since you only have 1s and 0s, I strongly suspect that a CNN would be vastly overkill. And with all the sparsity (many zeros) you’d end up with a lot of zeros in the convolutions. </p>
  
  <p>I'd actually suggest a plain vanilla (feed forward) neural network, which, despite the sparsity, I think will be able to do this classification pretty easily.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-19T15:43:44.817Z
Answers.Text: Very thorough answer.  One short version is that for questions that have an analytical solution, ML is *usually* not the right approach.
Answers.UserDisplayName: Amrinder Arora
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-24T18:42:36.037Z
Answers.LastActivityDate: 2018-05-31T22:16:33.450Z
Answers.LastEditDate: 2018-05-31T22:16:33.450Z
Answers.UserDisplayName: Andreas Storvik Strauman
Answers.Body: <p><strong>The Problem</strong></p>
  <p>The training data for the proposed system is as follows.</p>
  <ul>
  <li>A Boolean matrix representing the surface adjacency of a solid geometric design</li>
  <li>Also represented in the matrix is differentiation between interior and exterior angles of edges</li>
  <li>Labels (described below)</li>
  </ul>
  <p>Convex and concave are not the correct terms to describe surface gradient discontinuities. An interior edge, such as made by an end mill, is not actually a concave surface. Surface gradient discontinuity, from the point of view of the idealized solid model, has a zero radius. An exterior edge is not a convex portion of a surface for the same reason.</p>
  <p>The intended output of the trained system proposed is a Boolean array indicating the presence of specific solid geometric design features.</p>
  <ul>
  <li>One or more slot</li>
  <li>One or more boss</li>
  <li>One or more holes</li>
  <li>One or more pockets</li>
  <li>One or more steps</li>
  </ul>
  <p>This array of Boolean values is also used as labels for training.</p>
  <p><strong>Possible Caveats in Approach</strong></p>
  <p>There are mapping incongruities in this approach. They fall roughly into one of four categories.</p>
  <ul>
  <li>Ambiguity created by mapping the topology in the CAD model to the matrix — solid geometries that have primary not captured in the matrix encoding proposed</li>
  <li>CAD models for which no matrix exists — cases where edges change from inner to outer angles or emerge from curvature</li>
  <li>Ambiguity in the identification of features from the matrix — overlap between features that could identify the pattern in the matrix</li>
  <li>Matrices describing features that are not among the five — this could become a data loss issue downstream in development</li>
  </ul>
  <p>These are just a few examples of topology issues that may be common in some mechanical design domains and obfuscate the data mapping.</p>
  <ul>
  <li>A hole has the same matrix as a box frame with internal radii.</li>
  <li>External radii may lead to oversimplification in the matrix.</li>
  <li>Holes that intersect with edges may be indistinguishable from other topology in matrix form.</li>
  <li>Two or more intersecting through holes may present adjacency ambiguities.</li>
  <li>Flanges and ribs supporting round bosses with center holes may be indistinguishable.</li>
  <li>A ball and a torus have the same matrix.</li>
  <li>A disk and band with a hexagonal cross with a 180 degree twist have the same matrix.</li>
  </ul>
  <p>These possible caveats may or may not be of concern for the project defined in the question.</p>
  <p>Setting a face size balances efficiency with reliability but limits usability. There may be approaches that leverage one of the variants of RNNs, which may permit coverage of arbitrary model sizes without compromising efficiency for simple geometries. Such an approach may involve splaying the matrix out as a sequence for each example, applying a well conceived normalization strategy to each matrix. Padding may be effective if there are no tight constraints on training efficiency and a practical maximum for number of faces exists.</p>
  <p><strong>Considering Count and Certainty as Output</strong></p>
  <p>To handle some of these ambiguities, a certainty <span class="math-container">$\in [0.0, 1.0]$</span> could be the range of the activation functions of the output cells without changing the labeling of the training data.</p>
  <p>The possibility of using a non-negative integer output, as an unsigned binary representation created by aggregating multiple binary output cells, instead of a single Boolean per feature should be at least considered as well. Downstream, the capability to count features may become important.</p>
  <p>This leads to five realistic permutations to consider, that could be produced by the trained network for each feature of each solid geometry model.</p>
  <ul>
  <li>Boolean indicating existence</li>
  <li>Non-negative integer indicating instance count</li>
  <li>Boolean and real certainty of one or more instance</li>
  <li>Non-negative integer representing most likely instance count and real certainty of one or more instances</li>
  <li>Non-negative real mean and standard deviation</li>
  </ul>
  <p><strong>Pattern Recognition or What?</strong></p>
  <p>In the current culture, applying an artificial network to this problem is not normally described as pattern recognition in the sense of computer vision or audio processing. It is thought of as learning a complex functional mapping via convergence in the rough direction of an idea mapping, given proximity, accuracy, and reliability criteria. The parameters of the function <span class="math-container">$f$</span>, given inputs <span class="math-container">$\mathcal{X}$</span>, are driven toward the associated labels <span class="math-container">$\mathcal{Y}$</span> during training.</p>
  <p><span class="math-container">$$f(\mathcal{X}) \implies \mathcal{Y}$$</span></p>
  <p>If the concept class being functionally approximated by the network is sufficiently represented in the sample used for training and the sample of training examples is drawn in the same way as the target application will later draw, the approximation is likely to be sufficient.</p>
  <p>In the world of information theory, there is a blurring of the distinction between pattern recognition and functional approximation, as there should be in that higher level AI conceptual abstraction.</p>
  <p><strong>Feasibility</strong></p>
  <blockquote>
  <p>Would the network learn to map matrices to [the array of] Boolean [indicators] of design features?</p>
  </blockquote>
  <p>If the above listed caveats are acceptable to the project stakeholders, the examples are well labeled and provided in sufficient number, and the data normalization, loss function, hyper-parameters, and layer arrangements are set up well, it is likely convergence will occur during training and a reasonable automated feature identification system. Again, its usability hinges on new solid geometries being drawn from the concept class like the training examples were. System reliability relies on training being representative of later use cases.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-09T05:37:16.240Z
Answers.LastActivityDate: 2018-12-09T05:43:59.447Z
Answers.LastEditDate: 2020-06-17T09:57:20.710Z
Answers.UserDisplayName: Douglas Daseeco
Body: <p>I am trying to develop a neural network which can identify design features in CAD models (i.e. slots, bosses, holes, pockets, steps).</p>
  
  <p>The input data I intend to use for the network is a n x n matrix (where n is the number of faces in the CAD model). A '1' in the top right triangle in the matrix represents a convex relationship between two faces and a '1' in the bottom left triangle represents a concave relationship. A zero in both positions means the faces are not adjacent. The image below gives an example of such a matrix.
  <a href="https://i.sstatic.net/Soj7K.png" rel="noreferrer"><img src="https://i.sstatic.net/Soj7K.png" alt="enter image description here"></a></p>
  
  <p>Lets say I set the maximum model size to 20 faces and apply padding for anything smaller than that in order to make the inputs to the network a constant size.</p>
  
  <p>I want to be able to recognise 5 different design features and would therefore have 5 output neurons - [slot, pocket, hole, boss, step]</p>
  
  <p>Would I be right in saying that this becomes a sort of 'pattern recognition' problem? For example, if I supply the network with a number of training models - along with labels which describe the design feature which exists in the model, would the network learn to recognise specific adjacency patterns represented in the matrix which relate to certain design features?</p>
  
  <p>I am a complete beginner in machine learning and I am trying to get a handle on whether this approach will work or not - if any more info is needed to understand the problem leave a comment. Any input or help would be appreciated, thanks. </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-23T05:01:46.390Z
Comments.Text: As far as I understand, yes your problem is related to pattern recognition. Since the approach is to classify inputs with labels you previously provide for the neural net, I think a convolutional neural networks could work for you problem.
Comments.UserDisplayName: Bitzel
Tags: <neural-networks><machine-learning><convolutional-neural-networks><pattern-recognition>
Title: Using neural network to recognise patterns in matrices
UserDisplayName: Darren Taggart
ThreadText: # Using neural network to recognise patterns in matrices
  
  (Asked by: username_0 on 2018-01-22)
  
  I am trying to develop a neural network which can identify design features in CAD models (i.e. slots, bosses, holes, pockets, steps).
  
  The input data I intend to use for the network is a n x n matrix (where n is the number of faces in the CAD model). A '1' in the top right triangle in the matrix represents a convex relationship between two faces and a '1' in the bottom left triangle represents a concave relationship. A zero in both positions means the faces are not adjacent. The image below gives an example of such a matrix.
  [![enter image description here](https://i.sstatic.net/Soj7K.png)](https://i.sstatic.net/Soj7K.png)
  
  Lets say I set the maximum model size to 20 faces and apply padding for anything smaller than that in order to make the inputs to the network a constant size.
  
  I want to be able to recognise 5 different design features and would therefore have 5 output neurons - [slot, pocket, hole, boss, step]
  
  Would I be right in saying that this becomes a sort of 'pattern recognition' problem? For example, if I supply the network with a number of training models - along with labels which describe the design feature which exists in the model, would the network learn to recognise specific adjacency patterns represented in the matrix which relate to certain design features?
  
  I am a complete beginner in machine learning and I am trying to get a handle on whether this approach will work or not - if any more info is needed to understand the problem leave a comment. Any input or help would be appreciated, thanks.
  
  **Tags:** neural-networks, machine-learning, convolutional-neural-networks, pattern-recognition
  
  > **Comments:**
  > **username_1**: As far as I understand, yes your problem is related to pattern recognition. Since the approach is to classify inputs with labels you previously provide for the neural net, I think a convolutional neural networks could work for you problem.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2018-05-24. Score: 2
  
  > Would I be right in saying that this becomes a sort of 'pattern recognition' problem?
  
  Technically, yes. In practice: no.
  
  I think you might be interpreting the term "pattern recognition" a bit too literal. Even though [wikipedia](https://en.wikipedia.org/wiki/Pattern_recognition) defines Pattern recognition as "a branch of machine learning that focuses on the recognition of patterns and regularities in data", it's not about solving problems that can "easily" be deduced by logical reasoning.
  
  E.g. you say that
  
  > A '1' in the top right triangle in the matrix represents a convex relationship between two faces and a '1' in the bottom left triangle represents a concave relationship
  
  This is true *always*. In a typical machine learning situation, you wouldn't (usually) have this prior knowledge. At least not to the extent that it would b be tractable to “solve by hand”.
  
  Pattern recognition is conventionally a statistical approach to solving problems when they get too complex to analyze with conventional logical reasoning and simpler regression models. Wikipedia also states (with a source) that pattern recognition "in some cases considered to be nearly synonymous with machine learning".
  
  That being said: you *could* use pattern recognition on this problem. However, it seems like overkill in this case. Your problem, as far as I can understand, has an actual "analytical" solution. That is: you can, by logic, get a 100% correct result all the time. Machine learning algorithms could, in theory, also do this, and in that case, and this branch of ML is referred to as Meta Modelling[1].
  
  > For example, if I supply the network with a number of training models - along with labels which describe the design feature which exists in the model, would the network learn to recognise specific adjacency patterns represented in the matrix which relate to certain design features?
  
  In a word: Probably. Best way to go? Probably not. Why not, you ask?
  
  There is always the possibility that your model doesn't learn exactly what you want. In addition you have many challenges like [overfitting](https://en.wikipedia.org/wiki/Overfitting) that you'd need to concern yourself about. It's a statistical approach, as I said. Even if it classifies all your test data as 100% correct, there is no way (unless you check the insanely intractable maths) to be 100% sure that it will always classify correctly. I further suspect that you're also likely to end up spending more time working on your model then the time it would take to just deduce the logic.
  
  I also disagree with @username_1: I would not do a CNN (convolutional neural network) on this. CNNs are used when you want to look at specific parts of the matrix, and the relation and connectedness between the pixels are important — for example on images. Since you only have 1s and 0s, I strongly suspect that a CNN would be vastly overkill. And with all the sparsity (many zeros) you’d end up with a lot of zeros in the convolutions.
  
  I'd actually suggest a plain vanilla (feed forward) neural network, which, despite the sparsity, I think will be able to do this classification pretty easily.
  
  > **Comments:**
  > **username_3**: Very thorough answer.  One short version is that for questions that have an analytical solution, ML is *usually* not the right approach.  
  
  ---
  
  ### Answer by username_4 on 2018-12-09. Score: 0
  
  **The Problem**
  
  The training data for the proposed system is as follows.
  
  * A Boolean matrix representing the surface adjacency of a solid geometric design
  * Also represented in the matrix is differentiation between interior and exterior angles of edges
  * Labels (described below)
  
  Convex and concave are not the correct terms to describe surface gradient discontinuities. An interior edge, such as made by an end mill, is not actually a concave surface. Surface gradient discontinuity, from the point of view of the idealized solid model, has a zero radius. An exterior edge is not a convex portion of a surface for the same reason.
  
  The intended output of the trained system proposed is a Boolean array indicating the presence of specific solid geometric design features.
  
  * One or more slot
  * One or more boss
  * One or more holes
  * One or more pockets
  * One or more steps
  
  This array of Boolean values is also used as labels for training.
  
  **Possible Caveats in Approach**
  
  There are mapping incongruities in this approach. They fall roughly into one of four categories.
  
  * Ambiguity created by mapping the topology in the CAD model to the matrix — solid geometries that have primary not captured in the matrix encoding proposed
  * CAD models for which no matrix exists — cases where edges change from inner to outer angles or emerge from curvature
  * Ambiguity in the identification of features from the matrix — overlap between features that could identify the pattern in the matrix
  * Matrices describing features that are not among the five — this could become a data loss issue downstream in development
  
  These are just a few examples of topology issues that may be common in some mechanical design domains and obfuscate the data mapping.
  
  * A hole has the same matrix as a box frame with internal radii.
  * External radii may lead to oversimplification in the matrix.
  * Holes that intersect with edges may be indistinguishable from other topology in matrix form.
  * Two or more intersecting through holes may present adjacency ambiguities.
  * Flanges and ribs supporting round bosses with center holes may be indistinguishable.
  * A ball and a torus have the same matrix.
  * A disk and band with a hexagonal cross with a 180 degree twist have the same matrix.
  
  These possible caveats may or may not be of concern for the project defined in the question.
  
  Setting a face size balances efficiency with reliability but limits usability. There may be approaches that leverage one of the variants of RNNs, which may permit coverage of arbitrary model sizes without compromising efficiency for simple geometries. Such an approach may involve splaying the matrix out as a sequence for each example, applying a well conceived normalization strategy to each matrix. Padding may be effective if there are no tight constraints on training efficiency and a practical maximum for number of faces exists.
  
  **Considering Count and Certainty as Output**
  
  To handle some of these ambiguities, a certainty $\in [0.0, 1.0]$ could be the range of the activation functions of the output cells without changing the labeling of the training data.
  
  The possibility of using a non-negative integer output, as an unsigned binary representation created by aggregating multiple binary output cells, instead of a single Boolean per feature should be at least considered as well. Downstream, the capability to count features may become important.
  
  This leads to five realistic permutations to consider, that could be produced by the trained network for each feature of each solid geometry model.
  
  * Boolean indicating existence
  * Non-negative integer indicating instance count
  * Boolean and real certainty of one or more instance
  * Non-negative integer representing most likely instance count and real certainty of one or more instances
  * Non-negative real mean and standard deviation
  
  **Pattern Recognition or What?**
  
  In the current culture, applying an artificial network to this problem is not normally described as pattern recognition in the sense of computer vision or audio processing. It is thought of as learning a complex functional mapping via convergence in the rough direction of an idea mapping, given proximity, accuracy, and reliability criteria. The parameters of the function $f$, given inputs $\mathcal{X}$, are driven toward the associated labels $\mathcal{Y}$ during training.
  
  $$f(\mathcal{X}) \implies \mathcal{Y}$$
  
  If the concept class being functionally approximated by the network is sufficiently represented in the sample used for training and the sample of training examples is drawn in the same way as the target application will later draw, the approximation is likely to be sufficient.
  
  In the world of information theory, there is a blurring of the distinction between pattern recognition and functional approximation, as there should be in that higher level AI conceptual abstraction.
  
  **Feasibility**
  
  > Would the network learn to map matrices to [the array of] Boolean [indicators] of design features?
  
  If the above listed caveats are acceptable to the project stakeholders, the examples are well labeled and provided in sufficient number, and the data normalization, loss function, hyper-parameters, and layer arrangements are set up well, it is likely convergence will occur during training and a reasonable automated feature identification system. Again, its usability hinges on new solid geometries being drawn from the concept class like the training examples were. System reliability relies on training being representative of later use cases.
  
  
  ---
  
  