SlideShare a Scribd company logo
1 of 4
public static void main(String[] args)
{
//initiate the weights
initWeights();
//load in the data
initData();
//train the network
for(int j = 0;j <= numEpochs;j++)
{
for(int i = 0;i {
//select a pattern at random
patNum = (int)((Math.random()*numPatterns)-0.001);
//calculate the current network output
//and error for this pattern
calcNet();
//change network weights
WeightChangesHO();
WeightChangesIH();
}
//display the overall network error
//after each epoch
calcOverallError();
System.out.println("epoch = " + j + " RMS Error = " + RMSerror);
}
//training has finished
//display the results
displayResults();
}
//============================================================
//********** END OF THE MAIN PROGRAM **************************
//=============================================================
//************************************
public static void calcNet()
{
//calculate the outputs of the hidden neurons
//the hidden neurons are tanh
for(int i = 0;i {
hiddenVal[i] = 0.0;
for(int j = 0;j hiddenVal[i] = hiddenVal[i] + (trainInputs[patNum][j] *
weightsIH[j][i]);
hiddenVal[i] = tanh(hiddenVal[i]);
}
//calculate the output of the network
//the output neuron is linear
outPred = 0.0;
for(int i = 0;i outPred = outPred + hiddenVal[i] * weightsHO[i];
//calculate the error
errThisPat = outPred - trainOutput[patNum];
}
//************************************
public static void WeightChangesHO()
//adjust the weights hidden-output
{
for(int k = 0;k {
double weightChange = LR_HO * errThisPat * hiddenVal[k];
weightsHO[k] = weightsHO[k] - weightChange;
//regularisation on the output weights
if (weightsHO[k] < -5)
weightsHO[k] = -5;
else if (weightsHO[k] > 5)
weightsHO[k] = 5;
}
}
//************************************
public static void WeightChangesIH()
//adjust the weights input-hidden
{
for(int i = 0;i {
for(int k = 0;k {
double x = 1 - (hiddenVal[i] * hiddenVal[i]);
x = x * weightsHO[i] * errThisPat * LR_IH;
x = x * trainInputs[patNum][k];
double weightChange = x;
weightsIH[k][i] = weightsIH[k][i] - weightChange;
}
}
}
//************************************
public static void initWeights()
{
for(int j = 0;j {
weightsHO[j] = (Math.random() - 0.5)/2;
for(int i = 0;i weightsIH[i][j] = (Math.random() - 0.5)/5;
}
}
//************************************
public static void initData()
{
System.out.println("initialising data");
// the data here is the XOR data
// it has been rescaled to the range
// [-1][1]
// an extra input valued 1 is also added
// to act as the bias
trainInputs[0][0] = 1;
trainInputs[0][1] = -1;
trainInputs[0][2] = 1;//bias
trainOutput[0] = 1;
trainInputs[1][0] = -1;
trainInputs[1][1] = 1;
trainInputs[1][2] = 1;//bias
trainOutput[1] = 1;
trainInputs[2][0] = 1;
trainInputs[2][1] = 1;
trainInputs[2][2] = 1;//bias
trainOutput[2] = -1;
trainInputs[3][0] = -1;
trainInputs[3][1] = -1;
trainInputs[3][2] = 1;//bias
trainOutput[3] = -1;
}
//************************************
public static double tanh(double x)
{
if (x > 20)
return 1;
else if (x < -20)
return -1;
else
{
double a = Math.exp(x);
double b = Math.exp(-x);
return (a-b)/(a+b);
}
}
//************************************
public static void displayResults()
{
for(int i = 0;i {
patNum = i;
calcNet();
System.out.println("pat = " + (patNum+1) + " actual = " + trainOutput[patNum] +
" neural model = " + outPred);
}
}
//************************************
public static void calcOverallError()
{
RMSerror = 0.0;
for(int i = 0;i {
patNum = i;
calcNet();
RMSerror = RMSerror + (errThisPat * errThisPat);
}
RMSerror = RMSerror/numPatterns;
RMSerror = java.lang.Math.sqrt(RMSerror);
}
}

More Related Content

What's hot

The Singleton Pattern In Java
The Singleton Pattern In JavaThe Singleton Pattern In Java
The Singleton Pattern In JavaKohei Nozaki
 
Deep learning study 3
Deep learning study 3Deep learning study 3
Deep learning study 3San Kim
 
What they don't tell you about JavaScript
What they don't tell you about JavaScriptWhat they don't tell you about JavaScript
What they don't tell you about JavaScriptRaphael Cruzeiro
 
Pick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruitPick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruitVaclav Pech
 
Use C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in GeckoUse C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in GeckoChih-Hsuan Kuo
 
Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Chih-Hsuan Kuo
 
Standard Template Library (STL) in Object Oriented Programming
Standard Template Library (STL) in Object Oriented ProgrammingStandard Template Library (STL) in Object Oriented Programming
Standard Template Library (STL) in Object Oriented ProgrammingMandeep Singh
 
Add Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSAdd Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSRyan Anklam
 
NS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIINS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIIAjit Nayak
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVMVaclav Pech
 
GPars howto - when to use which concurrency abstraction
GPars howto - when to use which concurrency abstractionGPars howto - when to use which concurrency abstraction
GPars howto - when to use which concurrency abstractionVaclav Pech
 
Silent Revolution by Max Voronoy (Senior Consultant, Engineering, Globallogic)
Silent Revolution by Max Voronoy (Senior Consultant, Engineering, Globallogic)Silent Revolution by Max Voronoy (Senior Consultant, Engineering, Globallogic)
Silent Revolution by Max Voronoy (Senior Consultant, Engineering, Globallogic)GlobalLogic Ukraine
 
Modern c++ Memory Management
Modern c++ Memory ManagementModern c++ Memory Management
Modern c++ Memory ManagementAlan Uthoff
 
Multi-Tasking Map (MapReduce, Tasks in Rust)
Multi-Tasking Map (MapReduce, Tasks in Rust)Multi-Tasking Map (MapReduce, Tasks in Rust)
Multi-Tasking Map (MapReduce, Tasks in Rust)David Evans
 
Java card and flow layout
Java card and flow layoutJava card and flow layout
Java card and flow layoutshiprashakya2
 

What's hot (20)

The Singleton Pattern In Java
The Singleton Pattern In JavaThe Singleton Pattern In Java
The Singleton Pattern In Java
 
Deep learning study 3
Deep learning study 3Deep learning study 3
Deep learning study 3
 
What they don't tell you about JavaScript
What they don't tell you about JavaScriptWhat they don't tell you about JavaScript
What they don't tell you about JavaScript
 
Mintz q207
Mintz q207Mintz q207
Mintz q207
 
Pick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruitPick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruit
 
Use C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in GeckoUse C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in Gecko
 
Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36
 
Standard Template Library (STL) in Object Oriented Programming
Standard Template Library (STL) in Object Oriented ProgrammingStandard Template Library (STL) in Object Oriented Programming
Standard Template Library (STL) in Object Oriented Programming
 
Add Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSAdd Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJS
 
NS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIINS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt III
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
 
GPars howto - when to use which concurrency abstraction
GPars howto - when to use which concurrency abstractionGPars howto - when to use which concurrency abstraction
GPars howto - when to use which concurrency abstraction
 
Silent Revolution by Max Voronoy (Senior Consultant, Engineering, Globallogic)
Silent Revolution by Max Voronoy (Senior Consultant, Engineering, Globallogic)Silent Revolution by Max Voronoy (Senior Consultant, Engineering, Globallogic)
Silent Revolution by Max Voronoy (Senior Consultant, Engineering, Globallogic)
 
Gpars workshop
Gpars workshopGpars workshop
Gpars workshop
 
Modern c++ Memory Management
Modern c++ Memory ManagementModern c++ Memory Management
Modern c++ Memory Management
 
Multi-Tasking Map (MapReduce, Tasks in Rust)
Multi-Tasking Map (MapReduce, Tasks in Rust)Multi-Tasking Map (MapReduce, Tasks in Rust)
Multi-Tasking Map (MapReduce, Tasks in Rust)
 
Reactive x
Reactive xReactive x
Reactive x
 
Js objects
Js objectsJs objects
Js objects
 
Java card and flow layout
Java card and flow layoutJava card and flow layout
Java card and flow layout
 
Jdbc
JdbcJdbc
Jdbc
 

Viewers also liked

AN INVESTIGATION ON FUZZY LOGIC CONTROLLERS (TAKAGI-SUGENO & MAMDANI) IN INVE...
AN INVESTIGATION ON FUZZY LOGIC CONTROLLERS (TAKAGI-SUGENO & MAMDANI) IN INVE...AN INVESTIGATION ON FUZZY LOGIC CONTROLLERS (TAKAGI-SUGENO & MAMDANI) IN INVE...
AN INVESTIGATION ON FUZZY LOGIC CONTROLLERS (TAKAGI-SUGENO & MAMDANI) IN INVE...ijfls
 
A Counterexample to the Forward Recursion in Fuzzy Critical Path Analysis Und...
A Counterexample to the Forward Recursion in Fuzzy Critical Path Analysis Und...A Counterexample to the Forward Recursion in Fuzzy Critical Path Analysis Und...
A Counterexample to the Forward Recursion in Fuzzy Critical Path Analysis Und...ijfls
 
A NEW RANKING ON HEXAGONAL FUZZY NUMBERS
A NEW RANKING ON HEXAGONAL FUZZY NUMBERSA NEW RANKING ON HEXAGONAL FUZZY NUMBERS
A NEW RANKING ON HEXAGONAL FUZZY NUMBERSijfls
 
WAVELET- FUZZY BASED MULTI TERMINAL TRANSMISSION SYSTEM PROTECTION SCHEME IN ...
WAVELET- FUZZY BASED MULTI TERMINAL TRANSMISSION SYSTEM PROTECTION SCHEME IN ...WAVELET- FUZZY BASED MULTI TERMINAL TRANSMISSION SYSTEM PROTECTION SCHEME IN ...
WAVELET- FUZZY BASED MULTI TERMINAL TRANSMISSION SYSTEM PROTECTION SCHEME IN ...ijfls
 
Stability enhancement of power system
Stability enhancement of power systemStability enhancement of power system
Stability enhancement of power systemijfls
 
Optimal Alternative Selection Using MOORA in Industrial Sector - A
Optimal Alternative Selection Using MOORA in Industrial Sector - A  Optimal Alternative Selection Using MOORA in Industrial Sector - A
Optimal Alternative Selection Using MOORA in Industrial Sector - A ijfls
 
Implementation of Fuzzy Controlled Photo Voltaic Fed Dynamic Voltage Restorer...
Implementation of Fuzzy Controlled Photo Voltaic Fed Dynamic Voltage Restorer...Implementation of Fuzzy Controlled Photo Voltaic Fed Dynamic Voltage Restorer...
Implementation of Fuzzy Controlled Photo Voltaic Fed Dynamic Voltage Restorer...ijfls
 
Fuzzy Clustering Based Segmentation of Vertebrae in T1-Weighted Spinal MR Images
Fuzzy Clustering Based Segmentation of Vertebrae in T1-Weighted Spinal MR ImagesFuzzy Clustering Based Segmentation of Vertebrae in T1-Weighted Spinal MR Images
Fuzzy Clustering Based Segmentation of Vertebrae in T1-Weighted Spinal MR Imagesijfls
 
International Journal of Fuzzy Logic Systems (IJFLS)
International Journal of Fuzzy Logic Systems (IJFLS) International Journal of Fuzzy Logic Systems (IJFLS)
International Journal of Fuzzy Logic Systems (IJFLS) ijfls
 

Viewers also liked (9)

AN INVESTIGATION ON FUZZY LOGIC CONTROLLERS (TAKAGI-SUGENO & MAMDANI) IN INVE...
AN INVESTIGATION ON FUZZY LOGIC CONTROLLERS (TAKAGI-SUGENO & MAMDANI) IN INVE...AN INVESTIGATION ON FUZZY LOGIC CONTROLLERS (TAKAGI-SUGENO & MAMDANI) IN INVE...
AN INVESTIGATION ON FUZZY LOGIC CONTROLLERS (TAKAGI-SUGENO & MAMDANI) IN INVE...
 
A Counterexample to the Forward Recursion in Fuzzy Critical Path Analysis Und...
A Counterexample to the Forward Recursion in Fuzzy Critical Path Analysis Und...A Counterexample to the Forward Recursion in Fuzzy Critical Path Analysis Und...
A Counterexample to the Forward Recursion in Fuzzy Critical Path Analysis Und...
 
A NEW RANKING ON HEXAGONAL FUZZY NUMBERS
A NEW RANKING ON HEXAGONAL FUZZY NUMBERSA NEW RANKING ON HEXAGONAL FUZZY NUMBERS
A NEW RANKING ON HEXAGONAL FUZZY NUMBERS
 
WAVELET- FUZZY BASED MULTI TERMINAL TRANSMISSION SYSTEM PROTECTION SCHEME IN ...
WAVELET- FUZZY BASED MULTI TERMINAL TRANSMISSION SYSTEM PROTECTION SCHEME IN ...WAVELET- FUZZY BASED MULTI TERMINAL TRANSMISSION SYSTEM PROTECTION SCHEME IN ...
WAVELET- FUZZY BASED MULTI TERMINAL TRANSMISSION SYSTEM PROTECTION SCHEME IN ...
 
Stability enhancement of power system
Stability enhancement of power systemStability enhancement of power system
Stability enhancement of power system
 
Optimal Alternative Selection Using MOORA in Industrial Sector - A
Optimal Alternative Selection Using MOORA in Industrial Sector - A  Optimal Alternative Selection Using MOORA in Industrial Sector - A
Optimal Alternative Selection Using MOORA in Industrial Sector - A
 
Implementation of Fuzzy Controlled Photo Voltaic Fed Dynamic Voltage Restorer...
Implementation of Fuzzy Controlled Photo Voltaic Fed Dynamic Voltage Restorer...Implementation of Fuzzy Controlled Photo Voltaic Fed Dynamic Voltage Restorer...
Implementation of Fuzzy Controlled Photo Voltaic Fed Dynamic Voltage Restorer...
 
Fuzzy Clustering Based Segmentation of Vertebrae in T1-Weighted Spinal MR Images
Fuzzy Clustering Based Segmentation of Vertebrae in T1-Weighted Spinal MR ImagesFuzzy Clustering Based Segmentation of Vertebrae in T1-Weighted Spinal MR Images
Fuzzy Clustering Based Segmentation of Vertebrae in T1-Weighted Spinal MR Images
 
International Journal of Fuzzy Logic Systems (IJFLS)
International Journal of Fuzzy Logic Systems (IJFLS) International Journal of Fuzzy Logic Systems (IJFLS)
International Journal of Fuzzy Logic Systems (IJFLS)
 

Similar to Mamdani

GeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good TestsGeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good TestsTomek Kaczanowski
 
Confitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good TestsConfitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good TestsTomek Kaczanowski
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good TestsTomek Kaczanowski
 
PQTimer.java A simple driver program to run timing t.docx
  PQTimer.java     A simple driver program to run timing t.docx  PQTimer.java     A simple driver program to run timing t.docx
PQTimer.java A simple driver program to run timing t.docxjoyjonna282
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfsiennatimbok52331
 
Integration Project Inspection 3
Integration Project Inspection 3Integration Project Inspection 3
Integration Project Inspection 3Dillon Lee
 
I am asked to provide the testing cases for the following co.pdf
I am asked to provide the testing cases for the following co.pdfI am asked to provide the testing cases for the following co.pdf
I am asked to provide the testing cases for the following co.pdfacecomputertcr
 
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdf
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdfpublic void turnRight(double degrees) {rotationInDegrees + - = deg.pdf
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdfisenbergwarne4100
 
I dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfI dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfarchanaemporium
 
4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладка4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладкаDEVTYPE
 
Create a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdfCreate a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdfmalavshah9013
 
#include stdafx.h using namespace std; #include stdlib.h.docx
#include stdafx.h using namespace std; #include stdlib.h.docx#include stdafx.h using namespace std; #include stdlib.h.docx
#include stdafx.h using namespace std; #include stdlib.h.docxajoy21
 
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdfImplement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdfkostikjaylonshaewe47
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdfakkhan101
 
@author public class Person{   String sname, .pdf
  @author   public class Person{   String sname, .pdf  @author   public class Person{   String sname, .pdf
@author public class Person{   String sname, .pdfaplolomedicalstoremr
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good TestsTomek Kaczanowski
 
public class Point {   Insert your name here    private dou.pdf
public class Point {    Insert your name here    private dou.pdfpublic class Point {    Insert your name here    private dou.pdf
public class Point {   Insert your name here    private dou.pdfanandshingavi23
 

Similar to Mamdani (20)

GeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good TestsGeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good Tests
 
Confitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good TestsConfitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good Tests
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
C# labprograms
C# labprogramsC# labprograms
C# labprograms
 
PQTimer.java A simple driver program to run timing t.docx
  PQTimer.java     A simple driver program to run timing t.docx  PQTimer.java     A simple driver program to run timing t.docx
PQTimer.java A simple driver program to run timing t.docx
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
 
Integration Project Inspection 3
Integration Project Inspection 3Integration Project Inspection 3
Integration Project Inspection 3
 
I am asked to provide the testing cases for the following co.pdf
I am asked to provide the testing cases for the following co.pdfI am asked to provide the testing cases for the following co.pdf
I am asked to provide the testing cases for the following co.pdf
 
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdf
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdfpublic void turnRight(double degrees) {rotationInDegrees + - = deg.pdf
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdf
 
I dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfI dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdf
 
Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
 
4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладка4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладка
 
Create a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdfCreate a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdf
 
#include stdafx.h using namespace std; #include stdlib.h.docx
#include stdafx.h using namespace std; #include stdlib.h.docx#include stdafx.h using namespace std; #include stdlib.h.docx
#include stdafx.h using namespace std; #include stdlib.h.docx
 
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdfImplement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
 
@author public class Person{   String sname, .pdf
  @author   public class Person{   String sname, .pdf  @author   public class Person{   String sname, .pdf
@author public class Person{   String sname, .pdf
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
 
public class Point {   Insert your name here    private dou.pdf
public class Point {    Insert your name here    private dou.pdfpublic class Point {    Insert your name here    private dou.pdf
public class Point {   Insert your name here    private dou.pdf
 
ETM Server
ETM ServerETM Server
ETM Server
 

Recently uploaded

Dubai Call Girls O528786472 Diabolic Call Girls In Dubai
Dubai Call Girls O528786472 Diabolic Call Girls In DubaiDubai Call Girls O528786472 Diabolic Call Girls In Dubai
Dubai Call Girls O528786472 Diabolic Call Girls In Dubaihf8803863
 
Top Call Girls In Charbagh ( Lucknow ) 🔝 8923113531 🔝 Cash Payment
Top Call Girls In Charbagh ( Lucknow  ) 🔝 8923113531 🔝  Cash PaymentTop Call Girls In Charbagh ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment
Top Call Girls In Charbagh ( Lucknow ) 🔝 8923113531 🔝 Cash Paymentanilsa9823
 
"Ready to elevate your Instagram? Let's go
"Ready to elevate your Instagram? Let's go"Ready to elevate your Instagram? Let's go
"Ready to elevate your Instagram? Let's goSocioCosmos
 
CALL ON ➥8923113531 🔝Call Girls Takrohi Lucknow best Female service 👖
CALL ON ➥8923113531 🔝Call Girls Takrohi Lucknow best Female service  👖CALL ON ➥8923113531 🔝Call Girls Takrohi Lucknow best Female service  👖
CALL ON ➥8923113531 🔝Call Girls Takrohi Lucknow best Female service 👖anilsa9823
 
Call Girls In Noida Mall Of Noida O9654467111 Escorts Serviec
Call Girls In Noida Mall Of Noida O9654467111 Escorts ServiecCall Girls In Noida Mall Of Noida O9654467111 Escorts Serviec
Call Girls In Noida Mall Of Noida O9654467111 Escorts ServiecSapana Sha
 
Call Girls In Patel Nagar Delhi 9654467111 Escorts Service
Call Girls In Patel Nagar Delhi 9654467111 Escorts ServiceCall Girls In Patel Nagar Delhi 9654467111 Escorts Service
Call Girls In Patel Nagar Delhi 9654467111 Escorts ServiceSapana Sha
 
Angela Killian | Operations Director | Dallas
Angela Killian | Operations Director | DallasAngela Killian | Operations Director | Dallas
Angela Killian | Operations Director | DallasAngela Killian
 
IMPACT OF FISCAL POLICY AND MONETARY POLICY ON THE ECONOMIC GROWTH OF NIGERIA...
IMPACT OF FISCAL POLICY AND MONETARY POLICY ON THE ECONOMIC GROWTH OF NIGERIA...IMPACT OF FISCAL POLICY AND MONETARY POLICY ON THE ECONOMIC GROWTH OF NIGERIA...
IMPACT OF FISCAL POLICY AND MONETARY POLICY ON THE ECONOMIC GROWTH OF NIGERIA...AJHSSR Journal
 
Elite Class ➥8448380779▻ Call Girls In Nizammuddin Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Nizammuddin Delhi NCRElite Class ➥8448380779▻ Call Girls In Nizammuddin Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Nizammuddin Delhi NCRDelhi Call girls
 
Unlock Your Social Media Potential with IndianLikes - IndianLikes.com
Unlock Your Social Media Potential with IndianLikes - IndianLikes.comUnlock Your Social Media Potential with IndianLikes - IndianLikes.com
Unlock Your Social Media Potential with IndianLikes - IndianLikes.comSagar Sinha
 
Night 7k Call Girls Noida New Ashok Nagar Escorts Call Me: 8448380779
Night 7k Call Girls Noida New Ashok Nagar Escorts Call Me: 8448380779Night 7k Call Girls Noida New Ashok Nagar Escorts Call Me: 8448380779
Night 7k Call Girls Noida New Ashok Nagar Escorts Call Me: 8448380779Delhi Call girls
 
Spotify AI DJ Deck - The Agency at University of Florida
Spotify AI DJ Deck - The Agency at University of FloridaSpotify AI DJ Deck - The Agency at University of Florida
Spotify AI DJ Deck - The Agency at University of Floridajorirz24
 
Call^ Girls Delhi Independent girls Chanakyapuri 9711199012 Call Me
Call^ Girls Delhi Independent girls Chanakyapuri 9711199012 Call MeCall^ Girls Delhi Independent girls Chanakyapuri 9711199012 Call Me
Call^ Girls Delhi Independent girls Chanakyapuri 9711199012 Call MeMs Riya
 
定制(ENU毕业证书)英国爱丁堡龙比亚大学毕业证成绩单原版一比一
定制(ENU毕业证书)英国爱丁堡龙比亚大学毕业证成绩单原版一比一定制(ENU毕业证书)英国爱丁堡龙比亚大学毕业证成绩单原版一比一
定制(ENU毕业证书)英国爱丁堡龙比亚大学毕业证成绩单原版一比一ra6e69ou
 
Independent Escorts Lucknow 8923113531 WhatsApp luxurious locale in your city...
Independent Escorts Lucknow 8923113531 WhatsApp luxurious locale in your city...Independent Escorts Lucknow 8923113531 WhatsApp luxurious locale in your city...
Independent Escorts Lucknow 8923113531 WhatsApp luxurious locale in your city...makika9823
 
GREAT OPORTUNITY Russian Call Girls Kirti Nagar 9711199012 Independent Escort...
GREAT OPORTUNITY Russian Call Girls Kirti Nagar 9711199012 Independent Escort...GREAT OPORTUNITY Russian Call Girls Kirti Nagar 9711199012 Independent Escort...
GREAT OPORTUNITY Russian Call Girls Kirti Nagar 9711199012 Independent Escort...Mona Rathore
 
Your LinkedIn Makeover: Sociocosmos Presence Package
Your LinkedIn Makeover: Sociocosmos Presence PackageYour LinkedIn Makeover: Sociocosmos Presence Package
Your LinkedIn Makeover: Sociocosmos Presence PackageSocioCosmos
 
CALL ON ➥8923113531 🔝Call Girls Ashiyana Colony Lucknow best sexual service O...
CALL ON ➥8923113531 🔝Call Girls Ashiyana Colony Lucknow best sexual service O...CALL ON ➥8923113531 🔝Call Girls Ashiyana Colony Lucknow best sexual service O...
CALL ON ➥8923113531 🔝Call Girls Ashiyana Colony Lucknow best sexual service O...anilsa9823
 

Recently uploaded (20)

Dubai Call Girls O528786472 Diabolic Call Girls In Dubai
Dubai Call Girls O528786472 Diabolic Call Girls In DubaiDubai Call Girls O528786472 Diabolic Call Girls In Dubai
Dubai Call Girls O528786472 Diabolic Call Girls In Dubai
 
Top Call Girls In Charbagh ( Lucknow ) 🔝 8923113531 🔝 Cash Payment
Top Call Girls In Charbagh ( Lucknow  ) 🔝 8923113531 🔝  Cash PaymentTop Call Girls In Charbagh ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment
Top Call Girls In Charbagh ( Lucknow ) 🔝 8923113531 🔝 Cash Payment
 
"Ready to elevate your Instagram? Let's go
"Ready to elevate your Instagram? Let's go"Ready to elevate your Instagram? Let's go
"Ready to elevate your Instagram? Let's go
 
CALL ON ➥8923113531 🔝Call Girls Takrohi Lucknow best Female service 👖
CALL ON ➥8923113531 🔝Call Girls Takrohi Lucknow best Female service  👖CALL ON ➥8923113531 🔝Call Girls Takrohi Lucknow best Female service  👖
CALL ON ➥8923113531 🔝Call Girls Takrohi Lucknow best Female service 👖
 
Call Girls In Noida Mall Of Noida O9654467111 Escorts Serviec
Call Girls In Noida Mall Of Noida O9654467111 Escorts ServiecCall Girls In Noida Mall Of Noida O9654467111 Escorts Serviec
Call Girls In Noida Mall Of Noida O9654467111 Escorts Serviec
 
Call Girls In Patel Nagar Delhi 9654467111 Escorts Service
Call Girls In Patel Nagar Delhi 9654467111 Escorts ServiceCall Girls In Patel Nagar Delhi 9654467111 Escorts Service
Call Girls In Patel Nagar Delhi 9654467111 Escorts Service
 
Angela Killian | Operations Director | Dallas
Angela Killian | Operations Director | DallasAngela Killian | Operations Director | Dallas
Angela Killian | Operations Director | Dallas
 
FULL ENJOY Call Girls In Mohammadpur (Delhi) Call Us 9953056974
FULL ENJOY Call Girls In Mohammadpur  (Delhi) Call Us 9953056974FULL ENJOY Call Girls In Mohammadpur  (Delhi) Call Us 9953056974
FULL ENJOY Call Girls In Mohammadpur (Delhi) Call Us 9953056974
 
IMPACT OF FISCAL POLICY AND MONETARY POLICY ON THE ECONOMIC GROWTH OF NIGERIA...
IMPACT OF FISCAL POLICY AND MONETARY POLICY ON THE ECONOMIC GROWTH OF NIGERIA...IMPACT OF FISCAL POLICY AND MONETARY POLICY ON THE ECONOMIC GROWTH OF NIGERIA...
IMPACT OF FISCAL POLICY AND MONETARY POLICY ON THE ECONOMIC GROWTH OF NIGERIA...
 
Elite Class ➥8448380779▻ Call Girls In Nizammuddin Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Nizammuddin Delhi NCRElite Class ➥8448380779▻ Call Girls In Nizammuddin Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Nizammuddin Delhi NCR
 
Unlock Your Social Media Potential with IndianLikes - IndianLikes.com
Unlock Your Social Media Potential with IndianLikes - IndianLikes.comUnlock Your Social Media Potential with IndianLikes - IndianLikes.com
Unlock Your Social Media Potential with IndianLikes - IndianLikes.com
 
Night 7k Call Girls Noida New Ashok Nagar Escorts Call Me: 8448380779
Night 7k Call Girls Noida New Ashok Nagar Escorts Call Me: 8448380779Night 7k Call Girls Noida New Ashok Nagar Escorts Call Me: 8448380779
Night 7k Call Girls Noida New Ashok Nagar Escorts Call Me: 8448380779
 
Spotify AI DJ Deck - The Agency at University of Florida
Spotify AI DJ Deck - The Agency at University of FloridaSpotify AI DJ Deck - The Agency at University of Florida
Spotify AI DJ Deck - The Agency at University of Florida
 
Call^ Girls Delhi Independent girls Chanakyapuri 9711199012 Call Me
Call^ Girls Delhi Independent girls Chanakyapuri 9711199012 Call MeCall^ Girls Delhi Independent girls Chanakyapuri 9711199012 Call Me
Call^ Girls Delhi Independent girls Chanakyapuri 9711199012 Call Me
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Masudpur
Delhi  99530 vip 56974  Genuine Escort Service Call Girls in MasudpurDelhi  99530 vip 56974  Genuine Escort Service Call Girls in Masudpur
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Masudpur
 
定制(ENU毕业证书)英国爱丁堡龙比亚大学毕业证成绩单原版一比一
定制(ENU毕业证书)英国爱丁堡龙比亚大学毕业证成绩单原版一比一定制(ENU毕业证书)英国爱丁堡龙比亚大学毕业证成绩单原版一比一
定制(ENU毕业证书)英国爱丁堡龙比亚大学毕业证成绩单原版一比一
 
Independent Escorts Lucknow 8923113531 WhatsApp luxurious locale in your city...
Independent Escorts Lucknow 8923113531 WhatsApp luxurious locale in your city...Independent Escorts Lucknow 8923113531 WhatsApp luxurious locale in your city...
Independent Escorts Lucknow 8923113531 WhatsApp luxurious locale in your city...
 
GREAT OPORTUNITY Russian Call Girls Kirti Nagar 9711199012 Independent Escort...
GREAT OPORTUNITY Russian Call Girls Kirti Nagar 9711199012 Independent Escort...GREAT OPORTUNITY Russian Call Girls Kirti Nagar 9711199012 Independent Escort...
GREAT OPORTUNITY Russian Call Girls Kirti Nagar 9711199012 Independent Escort...
 
Your LinkedIn Makeover: Sociocosmos Presence Package
Your LinkedIn Makeover: Sociocosmos Presence PackageYour LinkedIn Makeover: Sociocosmos Presence Package
Your LinkedIn Makeover: Sociocosmos Presence Package
 
CALL ON ➥8923113531 🔝Call Girls Ashiyana Colony Lucknow best sexual service O...
CALL ON ➥8923113531 🔝Call Girls Ashiyana Colony Lucknow best sexual service O...CALL ON ➥8923113531 🔝Call Girls Ashiyana Colony Lucknow best sexual service O...
CALL ON ➥8923113531 🔝Call Girls Ashiyana Colony Lucknow best sexual service O...
 

Mamdani

  • 1. public static void main(String[] args) { //initiate the weights initWeights(); //load in the data initData(); //train the network for(int j = 0;j <= numEpochs;j++) { for(int i = 0;i { //select a pattern at random patNum = (int)((Math.random()*numPatterns)-0.001); //calculate the current network output //and error for this pattern calcNet(); //change network weights WeightChangesHO(); WeightChangesIH(); } //display the overall network error //after each epoch calcOverallError(); System.out.println("epoch = " + j + " RMS Error = " + RMSerror); } //training has finished //display the results displayResults(); } //============================================================ //********** END OF THE MAIN PROGRAM ************************** //============================================================= //************************************ public static void calcNet() { //calculate the outputs of the hidden neurons //the hidden neurons are tanh for(int i = 0;i { hiddenVal[i] = 0.0; for(int j = 0;j hiddenVal[i] = hiddenVal[i] + (trainInputs[patNum][j] * weightsIH[j][i]); hiddenVal[i] = tanh(hiddenVal[i]); } //calculate the output of the network
  • 2. //the output neuron is linear outPred = 0.0; for(int i = 0;i outPred = outPred + hiddenVal[i] * weightsHO[i]; //calculate the error errThisPat = outPred - trainOutput[patNum]; } //************************************ public static void WeightChangesHO() //adjust the weights hidden-output { for(int k = 0;k { double weightChange = LR_HO * errThisPat * hiddenVal[k]; weightsHO[k] = weightsHO[k] - weightChange; //regularisation on the output weights if (weightsHO[k] < -5) weightsHO[k] = -5; else if (weightsHO[k] > 5) weightsHO[k] = 5; } } //************************************ public static void WeightChangesIH() //adjust the weights input-hidden { for(int i = 0;i { for(int k = 0;k { double x = 1 - (hiddenVal[i] * hiddenVal[i]); x = x * weightsHO[i] * errThisPat * LR_IH; x = x * trainInputs[patNum][k]; double weightChange = x; weightsIH[k][i] = weightsIH[k][i] - weightChange; } } } //************************************ public static void initWeights() { for(int j = 0;j { weightsHO[j] = (Math.random() - 0.5)/2; for(int i = 0;i weightsIH[i][j] = (Math.random() - 0.5)/5; } } //************************************ public static void initData() { System.out.println("initialising data"); // the data here is the XOR data // it has been rescaled to the range // [-1][1]
  • 3. // an extra input valued 1 is also added // to act as the bias trainInputs[0][0] = 1; trainInputs[0][1] = -1; trainInputs[0][2] = 1;//bias trainOutput[0] = 1; trainInputs[1][0] = -1; trainInputs[1][1] = 1; trainInputs[1][2] = 1;//bias trainOutput[1] = 1; trainInputs[2][0] = 1; trainInputs[2][1] = 1; trainInputs[2][2] = 1;//bias trainOutput[2] = -1; trainInputs[3][0] = -1; trainInputs[3][1] = -1; trainInputs[3][2] = 1;//bias trainOutput[3] = -1; } //************************************ public static double tanh(double x) { if (x > 20) return 1; else if (x < -20) return -1; else { double a = Math.exp(x); double b = Math.exp(-x); return (a-b)/(a+b); } } //************************************ public static void displayResults() { for(int i = 0;i { patNum = i; calcNet(); System.out.println("pat = " + (patNum+1) + " actual = " + trainOutput[patNum] + " neural model = " + outPred); } } //************************************ public static void calcOverallError() { RMSerror = 0.0; for(int i = 0;i { patNum = i; calcNet(); RMSerror = RMSerror + (errThisPat * errThisPat); } RMSerror = RMSerror/numPatterns;