/// <summary> /// Initializes a new custom trainer by loading the key-value pair of properties into the property set. /// </summary> /// <param name="strProperties">Specifies the key-value pair of properties each separated by ';'. For example the expected /// format is 'key1'='value1';'key2'='value2';...</param> /// <param name="icallback">Specifies the parent callback.</param> public void Initialize(string strProperties, IXMyCaffeCustomTrainerCallback icallback) { m_icallback = icallback; m_properties = new PropertySet(strProperties); m_nThreads = m_properties.GetPropertyAsInt("Threads", 1); string strRewardType = m_properties.GetProperty("RewardType", false); if (strRewardType == null) { strRewardType = "VAL"; } else { strRewardType = strRewardType.ToUpper(); } if (strRewardType == "VAL" || strRewardType == "VALUE") { m_rewardType = REWARD_TYPE.VALUE; } else if (strRewardType == "AVE" || strRewardType == "AVERAGE") { m_rewardType = REWARD_TYPE.AVERAGE; } string strTrainerType = m_properties.GetProperty("TrainerType"); switch (strTrainerType) { case "PG.SIMPLE": // bare bones model (Sigmoid only) m_trainerType = TRAINER_TYPE.PG_SIMPLE; m_stage = Stage.RL; break; case "PG.ST": // single thread (Sigmoid and Softmax) m_trainerType = TRAINER_TYPE.PG_ST; m_stage = Stage.RL; break; case "PG": case "PG.MT": // multi-thread (Sigmoid and Softmax) m_trainerType = TRAINER_TYPE.PG_MT; m_stage = Stage.RL; break; case "RNN.SIMPLE": m_trainerType = TRAINER_TYPE.RNN_SIMPLE; m_stage = Stage.RNN; break; default: throw new Exception("Unknown trainer type '" + strTrainerType + "'!"); } }
/// <summary> /// Initializes a new custom trainer by loading the key-value pair of properties into the property set. /// </summary> /// <param name="strProperties">Specifies the key-value pair of properties each separated by ';'. For example the expected /// format is 'key1'='value1';'key2'='value2';...</param> /// <param name="icallback">Specifies the parent callback.</param> public void Initialize(string strProperties, IXMyCaffeCustomTrainerCallback icallback) { m_icallback = icallback; m_properties = new PropertySet(strProperties); string strTrainerType = m_properties.GetProperty("TrainerType"); switch (strTrainerType) { case "RNN.SIMPLE": // bare bones model m_trainerType = TRAINER_TYPE.RNN_SIMPLE; break; default: throw new Exception("Unknown trainer type '" + strTrainerType + "'!"); } }