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

Click For Summary
SUMMARY

The discussion centers on the implementation of an Expectation-Maximization (EM) algorithm in Java for conditional digital feedback in neural networks. The code provided demonstrates the E-Step and M-Step processes, with modifications suggested for the M-Step to improve convergence. The user questions the plausibility of releasing this feedback mechanism to the public and inquires about performance implications, particularly regarding battery consumption and synchronization on mobile devices.

PREREQUISITES
  • Understanding of Expectation-Maximization algorithms
  • Proficiency in Java programming
  • Familiarity with neural network concepts
  • Knowledge of performance optimization in mobile applications
NEXT STEPS
  • Research "Java performance optimization techniques for mobile applications"
  • Explore "Neural network training with Expectation-Maximization"
  • Learn about "Battery consumption analysis for mobile applications"
  • Investigate "Native code performance comparison with Java on mobile devices"
USEFUL FOR

Software developers, machine learning practitioners, and mobile application developers interested in optimizing neural network performance and understanding the implications of conditional digital feedback systems.

ADDA
Messages
67
Reaction score
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
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?
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
3
Views
2K
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 23 ·
Replies
23
Views
2K
  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 17 ·
Replies
17
Views
2K
  • · Replies 16 ·
Replies
16
Views
4K