⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 neural.cpp

📁 人工智能算法包含各种情况可在Delphi和C++中使用
💻 CPP
字号:
#include <fstream.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include "neural.hpp"

int main(int argc, char** argv)
{
    if(!argc == 2)
    {
        cerr<<"USAGE: NEURAL infile\n";
        exit(1);
    }
    Network net;
    if(net.trainingFile(argv[1]) == false)
    {
        cerr<<"Error in initializing net\n";
        exit(2);
    }
#ifdef DISPLAY_YES
    CLEAR_SCREEN();
#endif
    randomize();
    time_t startTime;
    time(&startTime);
    for(;;){
        net.forwardPass();
        net.backwardProp();
        net.displayDiff();
        if(net.atEpochEnd())
        {
            if(kbhit())
                break;
            if(net.trained())
                break;
                net.displayTotalError();
            net.zeroTotalError();
#ifdef DISPLAY_YES
                  CURSOR_GOTO(1,1);
#endif
        }
    }
    time_t endTime;
    time(&endTime);
    net.allForward();
    cin.get();
    net.display();
    unsigned long elapsed = (unsigned) endTime - (unsigned) startTime;
    net.displayPerformance(elapsed);
}


    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -