Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <algorithm>
- #include <vector>
- #include <numeric>
- #include <cmath>
- using namespace std;
- void HelpMessage() {
- cout << "Usage: ./RadialNeuron study file name" << endl;
- cout << "Study file format: XVALUE \\t YVALUE \\t " << endl;
- }
- void gnuplotInit(FILE *gpipe) {
- fprintf(gpipe, "set terminal X11\n");
- fprintf(gpipe, "set nokey\n");
- fprintf(gpipe, "set pointsize 1.5\n");
- fprintf(gpipe, "set xrange [-2:12]\n");
- fprintf(gpipe, "set yrange [-2:2]\n");
- fprintf(gpipe, "set multiplot\n");
- fprintf(gpipe, "\n");
- }
- typedef struct point2 {
- double x, y ; //нормированные координаты точки
- double phi, theta ; //в сферических координатах
- double outValue;
- // Default constuctor
- point2() {}
- // Constructor with x, y coordinates
- point2(double _x, double _y) {
- x = _x;
- y = _y;
- }
- void moveCenter(point2 X_k, double eta) {
- double diffX, diffY;
- diffX = X_k.x - x;
- diffY = X_k.y - y;
- x = x + eta * diffX;
- y = y + eta * diffY;
- }
- void printPoint() {
- cout << "x = " << x << "\ty = " << y << endl;
- }
- } point2;
- double EuclideanDistance(const point2 a, const point2 b) {
- double xDiff2, yDiff2;
- xDiff2 = pow((a.x - b.x), 2);
- yDiff2 = pow((a.y - b.y), 2);
- return sqrt(xDiff2 + yDiff2);
- }
- class Radial {
- public:
- Radial(point2, FILE*, FILE*, double);
- point2 C;
- // eta setter
- void set_eta(double);
- //sigma setter
- void set_sigma(double);
- void etaInput();
- void StudyNeuron();
- void StudySigmaOffline();
- double ActivationFunction(point2);
- double ActivationFunctionWithSigma(point2, double);
- point2 *StudyMass;
- int Test();
- double GradientMethod();
- private:
- int ClassValue;
- FILE *gpipe;
- int StudyMassSize;
- void get_StudyData(FILE*);
- void Norm(point2*);
- void PlotGreenPoint(int);
- double sigma = 1.;
- double eta = 0.01;
- point2 testPoint;
- double TargetFunction(int);
- void pltStudyMass();
- void pltCenter();
- double getR(double);
- };
Add Comment
Please, Sign In to add comment