Conditional Digital Feedback; is it a good Idea? (Neural Networks)

In summary, the code provided is for an Expectation Maximization (EM) sequence that is used to determine the input multiplier for an artificial neural network. The code is adapted from a tutorial and there are concerns about the accuracy of the E Step and whether the results are desired. There is also a discussion about the feasibility and potential issues of releasing this code to the general public, including concerns about battery consumption and synchronization. There is also a question about the efficiency of Java compared to native code on a phone.
  • #1
ADDA
67
2
In this example:



The input multiplier to the artificial neural network, at the bottom of the screen, for each note is determined by an output of an Expectation Maxamazation sequence that converges after ten iterations with input of the artificial neural network's output above a threshhold.

First, does this code look correct?

Java:
package com.adda.test;

public class EM {
    public float[] theta;
    private float[][] ml;
    private boolean[][] input;
    private int n, nsets, ncount;
   
    public EM () {
        this.n = 2;
        this.ncount = CONSTANTS.NFRAMES_COUNT;
        this.nsets = CONSTANTS.NFRAMES_SETS;
   
        this.theta = new float[2];
        this.ml = new float[this.nsets][this.n];
        this.input = new boolean[this.nsets][this.ncount];
       
        this.theta[0] = 0.45f;
        this.theta[1] = 0.55f;
    }
   
    public void setInput(boolean[] notes) {
        int itr, aitr, bitr;
       
        bitr = 0;
        for (itr = 0; itr < this.nsets; itr += 1) {
            for (aitr = 0; aitr < this.ncount; aitr += 1) {
                this.input[itr][aitr] = notes[bitr];
               
                bitr += 1;
            }
        }
       
   
        return;
    }
   
    private void EStep() {
        int itr, c, aitr;
       
        for (aitr = 0; aitr < this.nsets; aitr += 1) {
            c = 0;
            for (itr = 0; itr < this.ncount; itr += 1) {
                if (this.input[aitr][itr]) c += 1;
            }
            this.ml[aitr][0] = this.theta[0] * ((float)(this.ncount - c) / (float)this.ncount);
            this.ml[aitr][1] = this.theta[1] * ((float)c / (float)this.ncount);
        }
    
        return;
    }

   
    private void MStep() {
        float[][] ntheta = new float[this.nsets][2];
        int itr, c, aitr;
   
        for (aitr = 0; aitr < this.nsets; aitr += 1) {
            c = 0;
            for (itr = 0; itr < this.ncount; itr += 1) {
                if (this.input[aitr][itr]) c += 1;
            }
           
            ntheta[aitr][0] = (float)(this.ncount - c) * this.ml[aitr][0] + 0.1f;
            ntheta[aitr][1] = (float)c * this.ml[aitr][1] + 0.1f;
           
        }
       
        this.theta[0] = ntheta[0][0] / (ntheta[0][0] + ntheta[0][1]);
       
        this.theta[1] = ntheta[1][1] / (ntheta[1][0] + ntheta[1][1]);
       
   
        return;
    }
   

    public void iterate() {
        int itr;
       
        for (itr = 0; itr < 10; itr += 1) {
            this.EStep();
            this.MStep();
        }
   
        return;
    }
   
    public boolean isOn() {
       
        boolean ret = (  (this.theta[1] > CONSTANTS.THRESH) );
//     if (ret)
        System.out.print("\t" + ret + " " + this.theta[0] + " " + this.theta[1] + " ");
   
        return ret;
    }
   
}

I've adopted this code from this article:

http://www.cmi.ac.in/~madhavan/courses/datamining12/reading/em-tutorial.pdf

I might be doing something wrong in the E Step. Every theta is a conjugate of the other. Is that a desired result?

Second, would conditional feedback be plausible to even release to the general public? Is it a good idea? I've seen somewhere that 1/5 less of the max is desired for a runtime loop. Does that mean 0.2x or (1.0 - 0.2)x ? Seriously.
 
Technology news on Phys.org
  • #2
First, this function:

ADDA said:
private void MStep() {
float[][] ntheta = new float[this.nsets][2];
int itr, c, aitr;

for (aitr = 0; aitr < this.nsets; aitr += 1) {
c = 0;
for (itr = 0; itr < this.ncount; itr += 1) {
if (this.input[aitr][itr]) c += 1;
}

ntheta[aitr][0] = (float)(this.ncount - c) * this.ml[aitr][0] + 0.1f;
ntheta[aitr][1] = (float)c * this.ml[aitr][1] + 0.1f;

}

this.theta[0] = ntheta[0][0] / (ntheta[0][0] + ntheta[0][1]);

this.theta[1] = ntheta[1][1] / (ntheta[1][0] + ntheta[1][1]);


return;
}

I changed to this function:

Java:
private void MStep() {
        float[][] ntheta = new float[this.nsets][2];
        int itr, c, aitr;
   
        for (aitr = 0; aitr < this.nsets; aitr += 1) {
            c = 0;
            for (itr = 0; itr < this.ncount; itr += 1) {
                if (this.input[aitr][itr]) c += 1;
            }
           
            ntheta[aitr][0] = (float)(this.ncount - c) * this.ml[aitr][0] + 0.01f;
            ntheta[aitr][1] = (float)c * this.ml[aitr][1] + 0.01f;
           
        }
       
        this.theta[0] = ntheta[0][0] / (ntheta[0][0] + ntheta[0][1]);
       
        this.theta[1] = ntheta[0][1] / (ntheta[0][0] + ntheta[0][1]);
       
        this.theta[0] *= ntheta[1][0] / (ntheta[1][0] + ntheta[1][1]);
       
        this.theta[1] *= ntheta[1][1] / (ntheta[1][0] + ntheta[1][1]);
   
        return;
    }

It made more sense to make the off parameter, 0 indexed theta, the same for frame one and two, and the on parameter. Is this correct?

As far as digital feedback goes, I turned it off. Basically the idea was for event detection. When a note is true or on, I wanted to turn it off, which is useful for detecting the next note and rhythm, yet not for detecting note duration; perhaps I could do both. An example may be viewed here:



Third, I'm using Java, is ~10 milliseconds sleep at a rate of 18 FPS plausible for a user? 1000. / 18. = 55.55556; If I were to release this to the phone market, Would it consume too much battery power? Would it get out of sync? I have a 3GHZ processor; most ARM processors are only ~1GHZ. It seems that java would load balance on my PC. Does the same thing happen on a phone? Is native code ( C/C++) even quicker than Java?
 

1. What is conditional digital feedback?

Conditional digital feedback refers to a system where feedback is given to a neural network based on certain conditions or criteria. This means that the network receives feedback only when specific conditions are met, rather than receiving feedback for every input.

2. How does conditional digital feedback work in neural networks?

In neural networks, conditional digital feedback is implemented by setting up rules or conditions for when feedback should be given. These rules can be based on factors such as accuracy, error rate, or specific patterns in the input data. When the conditions are met, the network receives feedback to adjust its weights and improve its performance.

3. Is conditional digital feedback beneficial for neural networks?

There is evidence that conditional digital feedback can improve the performance of neural networks. By providing feedback only when certain conditions are met, the network can focus on learning and adjusting its weights for specific patterns or situations, leading to better overall performance.

4. Are there any potential drawbacks to using conditional digital feedback in neural networks?

One potential drawback of conditional digital feedback is that it may limit the network's ability to adapt and learn from new or unexpected situations. If the conditions for feedback are too specific, the network may not receive enough feedback to adjust for novel inputs. Additionally, setting up and optimizing the conditions for feedback may require additional time and resources.

5. How can we determine the best conditions for conditional digital feedback in neural networks?

The best conditions for conditional digital feedback will depend on the specific task and dataset being used. One approach is to experiment with different conditions and see how they impact the network's performance. This can be done through trial and error or by using techniques such as grid search or genetic algorithms. It is also important to consider the trade-off between the specificity of the conditions and the network's ability to adapt to new situations.

Similar threads

  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
2
Views
918
  • Programming and Computer Science
Replies
3
Views
892
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
3
Views
3K
  • Programming and Computer Science
Replies
23
Views
1K
  • Programming and Computer Science
2
Replies
36
Views
2K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
13
Views
4K
Back
Top