 .  
 


         ( ,         ,      ,  , ,     . .   )      ,  ,     .





 

 



 



 ,2020



ISBN978-5-0051-6327-1

     Ridero




  


       ().       [3]  4  :

1.       蠖   (),      .

2.         蠖    (),      .

3.         ().   ,          .

4.    ,          ,     ,  , , ..  .

          ,  ,    .

  2000     堖    ,          .

      ,  ,        ,  ,       ,   ,          .

      



  BBP/HBP,

  BRAIN,

 IBM DeepQA Watson,

 Siri  Apple,

        Google,

 JST,

  Spaun .


Ѡ2012     I-     ,             .

            ,         .          ,    ,         ,      ,      .

     .     freeware  MemBrain [14].

       .

       ,      . ʠ :



   

  

  

  


 ,    ,      .

        ,       .     ,           , ,   ,      .

      ,    , ,  , , , ,  蠫.      .

   ,       ,  ,   ,   ,  , ,   ,  ,  ,  .

        ,   .       젖 ,         - .

        .      ,  堖   ,     .

ʠ        . ,   ,  , ,  .

       ,      .

     ,   .  ,   ,      ,   (,     ),  .       .

        .    ,  1946   ..,     [16].

      ()    ,   ,     .

     , ,  ,   (),   .   ,  ,  , , , , .     ,   , , ,    , ,  .

       , 젖     ,     (),    ,  -,     - -,    .

     ,           ,  ,  .

ʠ :

  :

  Long short term memory (LSTM)

  , ,  :

       .

     

    MemBrain    .

     ,        , ,       .

     ,   ,    ,    ,   [4].

         ,    ,  ,   ,   , .

   4  ,    ,      ,   ,  .           ,   ,   ,  .

     .      (, ,  ,  ). ,  ,   ,      ,    ,    ,     , ,     .

  ,     ,  :  ໠蠫  .




 



 MemBrain         Help  MemBrain:



  ,  

    ( ,   csv-,   )

    c   

    

  

   (Convolutional Neural Networks)

    -

DLL (Dynamic Link Library)  MemBrain




  



        .  MemBrain       .       (  )   .     ,    .

,        ,       (   Decoder4To16_.as):



//    (view)

ViewSetting (BLACK_BG, true);

ViewSetting (SHOW_GRID, false);

ViewSetting (UPDATE_TEACH, true);

ViewSetting (UPDATE_THINK, true);

ViewSetting (SHOW_FIRE, false);

ViewSetting (SHOW_ACT_SPIKES, false);

ViewSetting (SHOW_LINKS, true);


/*        .    true false     .

     .

          .

      ,  FIRE SPIKES.

     .       View:

*/






.1 View



//    :

OpenNet (Decoder4To16.mbn);

//   ,    .






.2  Decoder4To16.mbn



// ,     ,  

//     :

RandomizeNet (); //  :






.3  



//

//    :

ResetThinkSteps (); //    (),  :






.4   ()



//

SetLessonCount (1); //   (1)

SetLessonCount (4); //   :






.5 Number ofLessons



//  ,   4

/*    4:



training lesson (  )   mbn & training lesson.mbl

validate lesson (  )   validate lesson.mbl

   (    1 3)   TrainResult.csv

  2 validate lesson (2 3)   ValidateResult.csv


      Lesson Editor > Lesson Files >  1.       :

*/

SelectLesson (1); //  Lesson Editor:






.6 1



//

//     ,   :

LoadLesson (Decoder4To16_Training. mbl); //  

//    (      ),    ,     .

ShowLessonEditor (false);

// ,   .   ,      .

SelectTeacher (RPROP); //    RPROP

//  (Adjust the teacher)      //Teacher Manager:






.7 



//

//  :

TeacherSetting (LEARNRATE, 0.1); //  

TeacherSetting (TARGET_ERR, 0.3); //    

TeacherSetting (LESSON_REPS, 1); //    

TeacherSetting (PATTERN_REPS, 1); //    

//   :

TeacherSetting (PATTERN_SELECT, RAND_ORDER);

SetTeachSpeed (0); //    

// 

//  

ShowErrorViewer (true);

//  

ResetErrorViewer();

//       

StartTeaching();

SleepExec (); //   

//    

ShowErrorViewer (false);

//   ()

ResetThinkSteps();



//   3,        ࠹1.



//    

SetRecordingType (RT_ACT);

//   堹3

StartRecording(3);

//  

ShowLessonEditor (false);

//        MemBrainSetThinkSpeed (500); //500     



//     3

ThinkLesson (); //     1( ࠹3)

SleepExec (); //    

//     (500)

StopRecording();

SelectLesson (2); //   2  

LoadLesson (Decoder4To16_Validate. mbl);

//    .    ,

EnableLessonOutData (false);

//    

SetRecordingType (RT_ACT);



//   ꠹4

StartRecording(4);

ShowLessonEditor (false); //   

ThinkLesson (); //     2( ࠹4)

SleepExec (); //    (Think on Lesson)

StopRecording (); //  



//   34CSV

SelectLesson(3);

ExportLessonRaw (Decoder4To16_TrainResult. csv);

SelectLesson(4);

ExportLessonRaw (Decoder4To16_ValidateResult. csv);



/*  ,   ,  MemBrain     */

// ExitMemBrain();



/*          . as  ("MemBrainScript1.as.



       Scripting -> Execute Script:






.8 



*/

     :






.9 



        ,     :






.10  



 .        .

      Decoder4To16_Training. mbl.      MemBrain   csv        .   MemBrain     Currently Edited (Training) Lesson.    Raw CSV Files -> Export Current Lesson (Raw CSV).   Export Lesson As (Raw CSV)    sv    .

      :

Decoder4To16_Training.mbl

Decoder4To16_TrainResult.csv

Decoder4To16_Validate.mbl

Decoder4To16_ValidateResult.csv

  mbl     .     Lesson Editor:






.11 mbl-



Lesson Editor -> Lesson Files -> Load Current Lesson.

    頖  堖  .     .




 :   SecondsTimer.as


/*            

  ,    Now ()         1.

     ,      ,   #include.

    SecondsTimer     .  ,      ,      MemBrain.

    ,  ,  -    .

            

*/



/*      .      .

AngelScript     .       .

*/

uint gSecondsTimerInstanceCount =0;



class SecondsTimer

{

// Constructor without arguments

SecondsTimer()

{

mId = gSecondsTimerInstanceCount++;

mReferenceTime = Now();

}



// Constructor with initial elapse time [s] (  )

SecondsTimer (uint seconds)

{

mId = gSecondsTimerInstanceCount++;

//   ,      .

int now = Now();



mReferenceTime = now + seconds;



//    :

/*

string timeStr;

TimeToString (now, timeStr);

Trace (timeStr);

TimeToString (mReferenceTime, timeStr);

Trace ( Timer " +mId + " started. Will elapse at:" +timeStr + "\n);

 timeStr;

TimeToString (now (), timeStr);

Trace () (timeStr);

TimeToString (mReferenceTime, timeStr);

Trace ( +mId + .   ():" +timeStr + "\n);

*/

}



~SecondsTimer()

{

gSecondsTimerInstanceCount;

}



// ,  

bool IsElapsed()

{

int now = Now();

bool elapsed = now> =mReferenceTime;

return elapsed;

}



//     

void Start (uint seconds)

{

//   ,      .

int now = Now();

mReferenceTime = now + seconds;

}



//     

void Start()

{

//   ,     .

int now = Now();

mReferenceTime =now;

}



// Return the elapsed seconds since the timer was started

int SecondsSinceStart()

{

//   

return Now () mReferenceTime;

}



//     

int mReferenceTime;

// ID     (    )

uintmId;

};




 



   ?

Ѡ    ,     (Exporting aNet) csv-.

 MemBrain           csv,  ,  .         ,  ,   MemBrain,    .

Ѡ      ,      .

  ,  <File> <Export >. :






.12  



      ,    .     ,  .           .




   CSV  (Net CSV File)


   , MemBrain      CSV-.     ,     ,       '<' '>' .     ,         :

/*

MemBrain, Version XX.XX

(<Month> <Day> <Year>)

 CSV-

   

[<NET START>]

   

[<INFO HEADER>]

      MemBrain.

 ,    ⠖       ,   [<NEURONS <],   .

[<NEURON FORMAT INFO>]

ID; LAYER; NAME = ; ; 

     .       CSV-.

[<NEURONS>]

1;I;In1

2;I;In2

3;O;Out

 ,    ꠖ       ,   [<LINKS <],   .

[<LINK FORMAT INFO>]

SOURCE_ID; TARGET_ID; WEIGHT

     .

      CSV-.

[<LINKS>]

1;3;0,263535

2;3;0,178995

  .

[<END>]

*/

  :



.

        :   .

      circle1.csv (374):

csv-






 circle1.csv



      ,     :






 circle2.csv (21)



       circle. csv,  394:






 circle.csv



  砫Circle_1.mbn






.13 



 circle1.csv






.14 



 circle2.csv






.15 



  Lesson Editor  :






.16  



   MemBrain.

   Lesson Editor (Names from Net)   Wizard  Extras.    :






.17    Pattern Error Viewer:



   .






.18  



         csv-  1. csv.      :






.19   



    Export  File.

     Export Circle. csv:






.20   



  3.

1 .

2 [<NEURON FORMAT INFO>]

      (;  ,   ; ;  ; ):






.21 



3   :






.22  




  


  ,        ,     (Command Reference),       MemBrain    MemBrain   :






   MemBrain



      ,:

//  MemBrain net (*.mbn)

[void OpenNet (  &  fileName)]

//   MemBrain  (*.mbn)

[void SaveNet (const string &infileName)]

//    

[void GetCurrentNetFileName (string& out fileName)]

//   MemBrain CSV-

[void ExportNet (const string &infileName)]

//    

[uint GetInputCount()]

//    

[uint GetOutputCount()]

//   

[bool GetInputName (uint inNeuronNum, string &out name)]

//   

[bool GetOutputName (uint outNeuronNum, string &out name)]

//    

[bool GetOutputAct (uint outNeuronNum, double &out activation)]

//      

bool GetSelectedNeuronProp (SNeuronProp &out prop)

//       

void SetSelectedNeuronProp (SNeuronProp &inprop)

// prop   SLinkProp    :






.23 



// ViewSetting (EViewSetting setting, bool on)       :






.24  



   ,   ,    , ,  ,    ,    




      



MemBrain            .

      .      (Fire).    (Fire)  ,    ( )   <>0.

    ,    (Properties)  :

    (Threshold)

    (Upper Threshold)

     (1  )

    (The Output Recovery Time)

        ,      .

 ,   ( <> 0)   ( = 0),    ,   01       .

  ,        .    ,     Windows     .     ,     Windows.

  ,      ,     ,   >    养 (<Extras> <Executable When Firing>)     ,          .

  :






.25  



    <   > (Open File when Firing).    ,   .

,    display neuron fire indicators(  )  ,     .

  ,    ,        .  ,     ,      .  ,        ,    .

    <> <  > (<View> <Show Links>),          ,    (  <> 0).    ,    .    <> < > ,    .  堖   ,   .






.26  




:     


      ().pdf [38]      ,    : ,   .       In1,   .             MemBrain.

    (In1):   .

        MemBrain       . mbn [10]:






.27    



   :






.28 



 ⠖ 15. : 2, 7, 6  (1DLY 2 1DLY 7) 6  (H1H6).

        .

   (SdvReg0.csv)  In1   0. In2   ,    7.






.29     



    :






.30   



      ,       (   . Pattern Error Viewer):






.31  



 6    Target.  Export Graph     :






.32  



     .

  SdvReg00.csv,   Export Graph:






.33   .



 SdvReg2.csv   :

 In1    :                    .  In1  ,       ,   In1=1      .            1111000(. 34).

  In1=1,     csv-  ()    MemBrain.      ,  ,    . ࠖ ,     In1.



In2     .

        : 090720.csv:






.34,   In1



          In1    Lesson Editor,   In1.  ,  In1 = 0,   (     .    ,   In1=0):






.35 In1 



  In1  1,    






.36 In1 



     230620.as    ,  .  In1 = 1     csv-   .      ExportLessonRaw  LessonEditor,    230620.as.

 230620.as:

void main()

{

SelectLesson(3);

ExportLessonRaw(C:\ProgramData\MemBrain\230620-3.as);

}



   :

 View -> Show Fire Indicator.

 Windows   SdvReg_111.csv .

      (Fire):

  In1     (Properties) Executable When Firing :  Extras -> Executable when Firing.

 :






.38    



 Think on Lesson Lesson Editor.

Lesson Editor      230620-3.as 3:






.39  3



 3   SdvReg_111.csv.

 :






.40 



     In1,  SdvReg_111.csv   3.



 :

      :






.41 ,    




 



     Communication with the user.


  7:

1.  void MessageBox (const string &inmessage)      .   ,     .     ,     ,     .

2.  EDlgRet MessageBox (const string &inmessage, EMsgBoxType type)      .   :



MB_OK  

MB_OKCANCEL   

MB_YESNO   

MB_YESNOCANCEL ,   

MB_RETRYCANCEL  RETRY CANCEL

MB_ABORTRETRYIGNORE  ABORT, RETRY IGNOR


   ,      .     ,     ,     .

3. ,       ,     double, string 蠫int.      :



EDlgRet UserInput (const string &inexplanation, double &ininitValue, double &out userValue)

EDlgRet UserInput (const string &inexplanation, int &ininitValue, int &out userValue),

EDlgRet UserInput (const string &inexplanation, const string &ininitValue, string &out userValue),

 InitValue      ,

userValue ,     .


  , ,  ,       .     ,     ,     . 堖  ,     ,        :    : IDOK  IDCANCEL

4.       

EDlgRet FileOpenDlg (const string &intitle, const string &inextension, const string &infileNameInit, string &out fileName).

		 title     .
		Extension   ,        . ,   txt        txt.
		 *    (   ),      .        (*.*).
		 fileNameInit         .  ,       .
		FileName   ,    ( ),   .
		   ,        :   ,     : IDOK  IDCANCEL.     ,     ,     .

5.          :

EDlgRet FileSaveDlg (const string &intitle, const string &inextension, const string &infileNameInit, string &out fileName).

6.   /    :

void ShowTraceWin (bool show).

 , show true   , false  .            ().

7.      :

void Trace (const string &intext).

		 text     .  \ r \ n ,   ,         .        MemBrain,        . ,     ,    !




      NetEditor     


      :

// UsingNetEditorExample.as

// NetEditor.as

// Position.as

     .               :

     (Pleas enter the number ofhidden layers for the net)   :2;






.42  



 2

  :      ,    MemBrain? (, )






.43  mbl-





     (  mbl),     .          :   :






.44    



    :






.45    



Ƞ ,       頹1?






.46   1



   (5).    

    2.






.47   2



     ,    :






.48   



   :






.49   



   .






.50 



  ,   mbl-,    :






.51  



.     :






.52  



,     3,      






.53    1



   4.       堹2:






.54    2



  񠖠7

  






.55 



   :






.56   



    :






.57  



,      .



     Using Net Editor Example as.        .

   Using Net Editor Example as   ,          const.     ,    ,     ..

          :

		// Determine how many normal hidden layers there shall be inthenet
		void DetermineHidLayerCount()
		{
		int count;

		if (UserInput (Please enter the number ofhidden layers for the net.,
		DEFAULT_HID_LAYER_COUNT, count) == IDOK)
		{
		if (count> gMaxHidLayerCount)
		{
		MessageBox (Too many hidden layers!);
		AbortScript();
		}

// Success. Adjust the size ofthe hidden layer arraynow.

gHidLayers.resize (count);

		}
		else
		{
		AbortScript();
		}
		}

   ,  mbl-

		// Create the I/Oneurons ofthe net using aMemBrain lessonfile
		void CreateIOFromMbl()
		{
		string lessonFileName;

		if (FileOpenDlg (Select Lesson File, mbl, , lessonFileName) == IDOK)
		{
		// Load the lesson into #1(delete all other lessons)
		SetLessonCount(1);
		LoadLesson (lessonFileName);
		gInputCount = GetLessonInputCount();
		gOutputCount = GetLessonOutputCount();
		if (gInputCount> gMaxCountPerLayer)
		{
		MessageBox (Too many input columns inlesson!);
		AbortScript();
		}
		else if (gOutputCount> gMaxCountPerLayer)
		{
		MessageBox (Too many output columns inlesson!);
		AbortScript();
		}

		// Now we tell the editor toactually create the input and output neurons.
		// The number ofhidden layers is required here toleave space for them.

         mbl-

		// Create net based on lesson or manual input?
		if (MessageBox (Do you want tocreate the net based on aMemBrain lesson file?, MB_YESNO) == IDYES)
		{
		gUseLesson = true;
		CreateIOFromMbl();
		}
		else
		{
		CreateIOFromUserInput();

}

      .



        :

		{
		if (count> gMaxHidLayerCount)
		{
		MessageBox (Too many hidden layers!);
		AbortScript();

}

      .



  :

		// Success. Adjust the size ofthe hidden layer arraynow.
		gHidLayers.resize (count);
		}




  



(   MemBrainExamples.)


          .         ,   ,   .      .

        .      ,          .

     :

   

    

   

     




  .


   .

   ,     (https://www.litres.ru/pages/biblio_book/?art=62874712)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .


