/// <summary> /// Create a new instance of <see cref="INeatExperiment{T}"/>. /// </summary> /// <param name="configElem">Experiment config in json form.</param> /// <returns>A new instance of <see cref="INeatExperiment{T}"/>.</returns> public INeatExperiment <double> CreateExperiment(JsonElement configElem) { // Read the customEvaluationSchemeConfig section. ReadEvaluationSchemeConfig( configElem, out Func <double, double> fn, out ParamSamplingInfo paramSamplingInfo, out double gradientMseWeight); // Create an evaluation scheme object for the generative sinewave task; using the evaluation scheme // config read from json. var evalScheme = new GenerativeFnRegressionEvaluationScheme(fn, paramSamplingInfo, gradientMseWeight); // Create a NeatExperiment object with the evaluation scheme, // and assign some default settings (these can be overridden by config). var experiment = new NeatExperiment <double>("Generative Function Regression", evalScheme) { IsAcyclic = false, CyclesPerActivation = 1, ActivationFnName = ActivationFunctionId.LeakyReLU.ToString() }; // Read standard neat experiment json config and use it configure the experiment. NeatExperimentJsonReader <double> .Read(experiment, configElem); return(experiment); }
/// <summary> /// Create a new instance of <see cref="INeatExperiment{T}"/>. /// </summary> /// <param name="jsonConfig">Experiment config in json format.</param> /// <returns>A new instance of <see cref="INeatExperiment{T}"/>.</returns> public INeatExperiment <double> CreateExperiment(string jsonConfig) { // Parse the json config string. JObject configJobj = JObject.Parse(jsonConfig); // Read the customEvaluationSchemeConfig section. ReadEvaluationSchemeConfig( configJobj, out Func <double, double> fn, out ParamSamplingInfo paramSamplingInfo, out double gradientMseWeight); // Create an evaluation scheme object for the generative sinewave task; using the evaluation scheme // config read from json. var evalScheme = new GenerativeFnRegressionEvaluationScheme(fn, paramSamplingInfo, gradientMseWeight); // Create a NeatExperiment object with the configured evaluation scheme. var experiment = NeatExperiment <double> .CreateCyclic( "Generative Function Regression", evalScheme, __DefaultActivationFunctionName.ToString(), 1); // Read standard neat experiment json config and use it configure the experiment. NeatExperimentJsonReader <double> .Read(experiment, configJobj); return(experiment); }