Exemplo n.º 1
0
 public Agent(IxTrainerCallback icallback, MyCaffeControl <T> mycaffe, PropertySet properties, CryptoRandom random, Phase phase, BucketCollection rgVocabulary, bool bUsePreloadData, string strRunProperties = null)
 {
     m_icallback  = icallback;
     m_brain      = new Brain <T>(mycaffe, properties, random, icallback as IxTrainerCallbackRNN, phase, rgVocabulary, bUsePreloadData, strRunProperties);
     m_properties = properties;
     m_random     = random;
 }
Exemplo n.º 2
0
 public void Initialize(int nThreads, IxTrainerCallback icallback)
 {
     for (int i = 0; i < nThreads; i++)
     {
         m_rgCollectors.Add(new DataCollector(icallback));
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// The constructor.
 /// </summary>
 /// <param name="mycaffe">Specifies the MyCaffeControl to use for learning and prediction.</param>
 /// <param name="properties">Specifies the property set containing the key/value pairs of property settings.</param>
 /// <param name="random">Specifies a Random number generator used for random selection.</param>
 /// <param name="icallback">Specifies the callback for parent notifications and queries.</param>
 public TrainerNoisyDqn(MyCaffeControl <T> mycaffe, PropertySet properties, CryptoRandom random, IxTrainerCallback icallback)
 {
     m_icallback  = icallback;
     m_mycaffe    = mycaffe;
     m_properties = properties;
     m_random     = random;
 }
Exemplo n.º 4
0
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="icallback">Specifies the callback used for update notifications sent to the parent.</param>
        /// <param name="mycaffe">Specifies the instance of MyCaffe with the open project.</param>
        /// <param name="properties">Specifies the properties passed into the trainer.</param>
        /// <param name="random">Specifies the random number generator used.</param>
        /// <param name="phase">Specifies the phase of the internal network to use.</param>
        public DqnAgent(IxTrainerCallback icallback, MyCaffeControl <T> mycaffe, PropertySet properties, CryptoRandom random, Phase phase)
        {
            m_icallback  = icallback;
            m_brain      = new Brain <T>(mycaffe, properties, random, phase);
            m_properties = properties;
            m_random     = random;

            m_fGamma              = (float)properties.GetPropertyAsDouble("Gamma", m_fGamma);
            m_bUseRawInput        = properties.GetPropertyAsBool("UseRawInput", m_bUseRawInput);
            m_nMaxMemory          = properties.GetPropertyAsInt("MaxMemory", m_nMaxMemory);
            m_nTrainingUpdateFreq = properties.GetPropertyAsInt("TrainingUpdateFreq", m_nTrainingUpdateFreq);
            m_nExplorationNum     = properties.GetPropertyAsInt("ExplorationNum", m_nExplorationNum);
            m_nEpsSteps           = properties.GetPropertyAsInt("EpsSteps", m_nEpsSteps);
            m_dfEpsStart          = properties.GetPropertyAsDouble("EpsStart", m_dfEpsStart);
            m_dfEpsEnd            = properties.GetPropertyAsDouble("EpsEnd", m_dfEpsEnd);
            m_dfEpsDelta          = (m_dfEpsStart - m_dfEpsEnd) / m_nEpsSteps;
            m_dfExplorationRate   = m_dfEpsStart;

            if (m_dfEpsStart < 0 || m_dfEpsStart > 1)
            {
                throw new Exception("The 'EpsStart' is out of range - please specify a real number in the range [0,1]");
            }

            if (m_dfEpsEnd < 0 || m_dfEpsEnd > 1)
            {
                throw new Exception("The 'EpsEnd' is out of range - please specify a real number in the range [0,1]");
            }

            if (m_dfEpsEnd > m_dfEpsStart)
            {
                throw new Exception("The 'EpsEnd' must be less than the 'EpsStart' value.");
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// The constructor.
 /// </summary>
 /// <param name="mycaffe">Specifies the MyCaffeControl to use for learning and prediction.</param>
 /// <param name="properties">Specifies the property set containing the key/value pairs of property settings.</param>
 /// <param name="random">Specifies the random number generator to use.</param>
 /// <param name="icallback">Specifies the callback for parent notifications and queries.</param>
 /// <param name="rgVocabulary">Specifies the vocabulary to use.</param>
 public TrainerRNN(MyCaffeControl <T> mycaffe, PropertySet properties, CryptoRandom random, IxTrainerCallback icallback, BucketCollection rgVocabulary)
 {
     m_icallback    = icallback;
     m_mycaffe      = mycaffe;
     m_properties   = properties;
     m_random       = random;
     m_rgVocabulary = rgVocabulary;
 }
Exemplo n.º 6
0
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="icallback">Specifies the callback used for update notifications sent to the parent.</param>
        /// <param name="mycaffe">Specifies the instance of MyCaffe with the open project.</param>
        /// <param name="properties">Specifies the properties passed into the trainer.</param>
        /// <param name="random">Specifies the random number generator used.</param>
        /// <param name="phase">Specifies the phase of the internal network to use.</param>
        public DqnAgent(IxTrainerCallback icallback, MyCaffeControl <T> mycaffe, PropertySet properties, CryptoRandom random, Phase phase)
        {
            m_icallback  = icallback;
            m_brain      = new Brain <T>(mycaffe, properties, random, phase);
            m_properties = properties;
            m_random     = random;

            m_fGamma       = (float)properties.GetPropertyAsDouble("Gamma", m_fGamma);
            m_bUseRawInput = properties.GetPropertyAsBool("UseRawInput", m_bUseRawInput);
        }
Exemplo n.º 7
0
 public DataCollector(IxTrainerCallback icallback)
 {
     m_icallback = icallback;
     m_thread    = new Thread(new ThreadStart(doWork));
     m_thread.Start();
 }
Exemplo n.º 8
0
 /// <summary>
 /// The constructor.
 /// </summary>
 /// <param name="mycaffe">Specifies the MyCaffeControl to use for learning and prediction.</param>
 /// <param name="properties">Specifies the property set containing the key/value pairs of property settings.</param>
 /// <param name="random">Specifies a Random number generator used for random selection.</param>
 /// <param name="icallback">Specifies the callback for parent notifications and queries.</param>
 public TrainerPG(MyCaffeControl <T> mycaffe, PropertySet properties, Random random, IxTrainerCallback icallback)
 {
     m_icallback  = icallback;
     m_mycaffe    = mycaffe;
     m_properties = properties;
 }