Ejemplo n.º 1
0
        /// <summary>
        /// Create a list of all possible configurations based on the file provided.
        /// That is, generate all possible combinations of settings
        /// by combining values that are specified in the file.
        /// </summary>
        /// <param name="path">Path to parameters file</param>
        /// <returns>All possible combinations of settings</returns>
        public static List <LearningSettings> RetrieveParameters(string path)
        {
            var             reader     = new StreamReader(path);
            List <string[]> splitLines = new List <string[]>();

            while (!reader.EndOfStream)
            {
                var      line   = reader.ReadLine(); // data
                string[] values = ParseParamsLine(line);
                if (values == null)
                {
                    continue;
                }

                splitLines.Add(values);
            }

            reader.Close();
            return(SettingsMixer.BuildSettings(splitLines));
        }
Ejemplo n.º 2
0
        private List <LearningSettings> GetLearningSettingsFromUI()
        {
            LearningSettings lSettings = new LearningSettings();

            string[] maxIters = GetSimulatedParamsTexts(LearningSettings.MaxIterationsTitle, MaxIterations.Text);
            string[] badIters = GetSimulatedParamsTexts(LearningSettings.BadIterationsTitle,
                                                        BadIterations.Text == ""? (int.MaxValue / 5).ToString() : BadIterations.Text);
            string[]       lr        = GetSimulatedParamsTexts(LearningSettings.LearningRateTitle, LearningRate.Text);
            string[]       mnt       = GetSimulatedParamsTexts(LearningSettings.MomentumTitle, Momentum.Text);
            ActivationType aType     = (ActivationType)ActivationCombobox.SelectedItem;
            string         aTypeText = "";

            if (aType == ActivationType.Unipolar)
            {
                aTypeText = "U";
            }
            else if (aType == ActivationType.Bipolar)
            {
                aTypeText = "B";
            }
            else
            {
                throw new Exception("Unrecognized activation type");
            };

            string[] act = GetSimulatedParamsTexts(LearningSettings.ActivationFuncTitle, aTypeText);
            string[] hls = GetSimulatedParamsTexts(LearningSettings.HLTitle, LayersTextBox.Text);

            List <string[]> simulatedSplitLines = new List <string[]>()
            {
                maxIters, badIters, lr, mnt, act, hls
            };

            StringBuilder inputText = new StringBuilder();

            simulatedSplitLines.ForEach(l => inputText.AppendLine(string.Join(",", l)));
            paramsInputText = inputText.ToString();
            return(SettingsMixer.BuildSettings(simulatedSplitLines));
        }