Encog.Persist.EncogFileSection.ParseActivationFunction C# (CSharp) Method

ParseActivationFunction() public static method

Parse an activation function from a string.
public static ParseActivationFunction ( String>.IDictionary paras, String name ) : IActivationFunction
paras String>.IDictionary The params.
name String The name of the param to parse.
return IActivationFunction
        public static IActivationFunction ParseActivationFunction(
            IDictionary<String, String> paras, String name)
        {
            String v;
            try
            {
                v = paras[name];
                if (v == null)
                {
                    throw new PersistError("Missing property: " + name);
                }

                IActivationFunction af;
                String[] cols = v.Split('|');

                String afName = ReflectionUtil.AfPath
                                + cols[0];
                try
                {
                    af = (IActivationFunction) ReflectionUtil.LoadObject(afName);
                }
                catch (Exception e)
                {
                    throw new PersistError(e);
                }

                for (int i = 0; i < af.ParamNames.Length; i++)
                {
                    af.Params[i] = CSVFormat.EgFormat.Parse(cols[i + 1]);
                }

                return af;
            }
            catch (Exception ex)
            {
                throw new PersistError(ex);
            }
        }