public HiddenLayer(int input_dimension, int output_dimension, double Gamma, double L1, double L2, double Drop_out, IVectorFunction Activation_Function) { ud = new UniformDistribution(); w = new double[output_dimension, input_dimension]; for (int j = 0; j < w.GetLength(0); j++) { for (int k = 0; k < w.GetLength(1); k++) { w[j, k] = (ud.NextDouble() - 0.5) * 2.0; } } b = new double[output_dimension, 1]; for (int j = 0; j < b.GetLength(0); j++) { b[j, 0] = (ud.NextDouble() - 0.5) * 2.0; } gamma = Math.Max(Gamma, 1.0 / 1000 / 1000 / 1000); L_1 = Math.Max(L1, 0); L_2 = Math.Max(L2, 0); drop_out = Math.Min(Math.Max(Drop_out, 0), 1); activation_Function = Activation_Function; }
/// <summary> /// Add a Modifier script to an Entity, based on a code block (delegate) and a VectorFunction /// </summary> /// <param name="e">Entity to add modifier script to</param> /// <param name="scriptCode">Code block (delegate) that is the script</param> /// <param name="func">Function whose value will be passed in ScriptContext.FunctionValue to script</param> /// <returns></returns> public static VectorModifierScript AddModifier(Entity e, VectorModifierDelegate scriptCode, IVectorFunction func) { if (!e.HasComponent<ScriptComp>()) { e.AddComponent(new ScriptComp()); e.Refresh(); } var sc = e.GetComponent<ScriptComp>(); var script = new VectorModifierScript(scriptCode, func); sc.Add(script); return script; }
public HiddenLayer(double[,] W, double[,] B, double Gamma, double L1, double L2, double Drop_out, IVectorFunction Activation_Function) { ud = new UniformDistribution(); w = W; b = B; gamma = Math.Max(Gamma, 1.0 / 1000 / 1000 / 1000); L_1 = Math.Max(L1, 0); L_2 = Math.Max(L2, 0); drop_out = Math.Min(Math.Max(Drop_out, 0), 1); activation_Function = Activation_Function; }
/// <summary> /// Create new ModifierScript /// </summary> /// <param name="code"></param> /// <param name="function">if null is passed, the unity function f(x)=x is applied as Function</param> public VectorModifierScript(VectorModifierDelegate code, IVectorFunction function) { this.ScriptCode = code; this.Function = function; }
public void Preset_3_3rd_Set_activation_Function(IVectorFunction Activation_Function) { activation_Function = Activation_Function; }