-
-
Erfahrener Benutzer
Fleißiges Mitglied
no 3
hi,
den ad-wandler ist der eingebaute ad-wandler des alten c-control-mircrocontrollers von conrad,
ja, den pfeiffer, ist recht interessant,
neuralNet's
hier ist mal ein kleines programm:
vielleicht hilfs dir.
mfg
nomad
//================================================== =======================//
// THE Nomad - PROJECT //
// by //
// RYTTA COMMUNICATIONS INC. //
// (c) Version 0.0.1. March 2003 //
// //
//================================================== =======================//
// nn_1.c //
// ------------------- //
// begin : Fri.March 14. 12.00:00 GMT 2003 //
// copyright : (C) 2003 by s.morf //
// email :
// graphics : no //
// compile with : cc -o nn_1 nn_1.c -lm //
// start with : ./nn_1 //
// //
// for : neuralNet for sensorControl and //
// MotorMovements //
//************************************************** ************************/
// THIS PROGRAMM IS UNDER THE GNU-LICENCE //
/************************************************** *************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
************************************************** **************************
Contributions:
************************************************** **************************
Notes:
14.03. - interduction
- compile and run == ok
- result stimmt gemaess elektor artikel
************************************************** **************************
referneces:
berechnung des netzwerk-outputs
for L = 1 to number_of_layers
{
for n = 1 to number_of_neurons_in_biggest_layer
{
for c = to number_weights_in_biggest_layer
{
O(L+1,n) = O(L+1,n) + O(L,c) * W*L,n,c)
}
O(L+1,n) = 1/(1+exp(-1*O(L+1,n)))
}
}
listing 2
alternative outputprogrammierung
for t =1 + number_of_inputs to number_of_neurons
{
for f= 1 to number_of_neurons
{
O(t) = O(t) + O(f) * W(f,t)
}
O(t) = 1/(1+exp(-1 * O(t)))
}
sigmoid-funktion
-0.18
e = gem.rechner 1/(1+(e )) = 0.5449
e gem.c double exp(double x)
e = 2.7118 ..... as basis
1
output = ______________ = 0.5449
-0.18
1+ e
zu bild 10
input ins Neuron 1 = (0.2*0.5) + (0.4*0.
= 0.42
1
output = ______________ = 0.603
-0.42
1+ e
input ins neuron 2 = (0.2*0.1)+(0.4+0.9) = 0.38
1
output = ______________ = 0.594
-0.38
1+ e
input ins letzte neuron (0.594 * 0.7) + (0.603 * 0.5) = 0.717
1
final_output = ________________ = 0.672
-0.717
1+ e
************************************************** ************************
D E C L A R A T I O N S
************************************************** ************************/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include "conio.h"
#include <conio.h>
double in_1 = 0.2;
double in_2 = 0.4;
double W_11 = 0.1;
double W_12 = 0.5;
double W_21 = 0.9;
double W_22 = 0.8;
double W_31 = 0.7;
double W_32 = 0.5;
double Hid_in_1;
double Hid_in_2;
double Hid_out_1;
double Hid_out_2;
double Out_in_3;
double out_final;
main()
{
clrscr();
gotoxy(2,1);
printf("The NeuralNet Version 0.0.1. (c) 2003 RCI");
gotoxy(2,2);
printf("now running");
Hid_in_1 = (in_1 * W_12) + (in_2 * W_22);
gotoxy(2,4);
printf("Hidden Input 1 = %f",Hid_in_1);
Hid_in_2 = (in_1 * W_11) + (in_2 * W_21);
gotoxy(2,5);
printf("Hidden Input 2 = %f",Hid_in_2);
Hid_out_1 = 1/(1+exp(-1 * Hid_in_1));
gotoxy(2,6);
printf("Hidden output 1 = %f",Hid_out_1);
Hid_out_2 = 1/(1+exp(-1 * Hid_in_2));
gotoxy(2,6);
printf("Hidden output 2 = %f",Hid_out_2);
Out_in_3 = (Hid_out_2 * W_31) + (Hid_out_1 * W_32);
gotoxy(2,7);
printf("Output in_3 = %f",Out_in_3);
out_final = 1/(1+exp(-1 * Out_in_3));
gotoxy(2,10);
printf("Final Output = %f",out_final);
gotoxy(2,12);
printf("finished\n");
}
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- Anhänge hochladen: Nein
- Beiträge bearbeiten: Nein
-
Foren-Regeln
Lesezeichen