Results 1 to 1 of 1
  1. #1
    mhaider2 is offline Member
    Join Date
    May 2012
    Location
    Malaysia
    Posts
    3
    Rep Power
    0

    Lightbulb Compare input with the data from text file and etc??

    Hi,

    I'm new to java and currently trying to implement generalized regression neural network (grnn) in java. I need an opinion on how to comparing input with training data from text file.

    this is the basic code/algorithm that i use right now:
    public class Grnn {


    public static void main(String[] args)
    {

    // Check LSA, CM and CUT and compare to LSA, CM and CUT in training data,
    // Capture Target Output values = TargetOutput


    double LSA_Training_Data = 0.8;
    int CM_Training_Data = 77;
    int CUT_Training_Data = 65;

    double LSA = 0.6;
    int CM = 76;
    int CUT = 64;

    double dif1 = LSA_Training_Data - LSA;
    int dif2 = CM_Training_Data - CM;
    int dif3 = CUT_Training_Data - CUT;

    int NoOfNeuron = 3;
    int TargetOutput = 75;
    double numenator = (((TargetOutput * Math.pow(NoOfNeuron,dif1)) + (TargetOutput * Math.pow(NoOfNeuron,dif2)) + (TargetOutput * Math.pow(NoOfNeuron,dif3))));
    double denumenator = (Math.pow(NoOfNeuron,dif1)+ Math.pow(NoOfNeuron,dif2)+ Math.pow(NoOfNeuron,dif3));
    double holdtime = (numenator / denumenator);

    System.out.println ("hold time is " + holdtime);

    System.out.println ("exponent a " + (TargetOutput * Math.pow(NoOfNeuron,dif1)));
    System.out.println ("exponent b " + (TargetOutput * Math.pow(NoOfNeuron,dif2)));
    System.out.println ("exponent c " + (TargetOutput * Math.pow(NoOfNeuron,dif3)));



    }
    }
    This is the example of training data that i put in text file.

    LSA CM CUT Target Output
    60 1 1 0.1
    55 1 1 0.1
    60 33 17 0.2
    55 33 17 0.3
    60 77 65 47
    55 77 65 49
    0.8 77 65 75
    0.8 81 65 76
    0.7 81 65 78


    How am i going to compare my input (LSA, CM, CUT) with training data (LSA_Training_Data,CM_Training_Data,CUT_Training_D ata) that i put in text file and also capture the Target Output? The other problem is how am i going to capture the nearest Training Data in file? The input does not always the same with the data in text file. For example the input is can be 0.6(LSA), 76(CM) and 64(CUT) and if you refer to the training data above the nearest value is 0.8,77,65 where the target output is 75 . The use of GRNN is to predict the value of output (hold time) based on this three input (0.6,76,64). The way GRNN works can be seen in the code. As you can see, i manually input the value of LSA, CM, CUT, LSA_Training_Data,CM_Training_Data,CUT_Training_Da ta and Target Output but i need to get this data (LSA_Training_Data,CM_Training_Data,CUT_Training_D ata and Target Output) from text file based from the input (LSA, CM, CUT) that i provide.

    Your opinion is very, very much appreciated.
    Last edited by mhaider2; 05-08-2012 at 08:39 AM. Reason: code updated

Similar Threads

  1. Read text file and compare strings
    By africanhacker in forum New To Java
    Replies: 9
    Last Post: 04-01-2011, 01:53 AM
  2. Replies: 2
    Last Post: 03-25-2011, 03:36 PM
  3. Replies: 3
    Last Post: 04-26-2010, 10:00 PM
  4. count character in text file as input file
    By aNNuur in forum New To Java
    Replies: 7
    Last Post: 03-25-2010, 05:01 PM
  5. Replies: 2
    Last Post: 01-26-2009, 05:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •