コード例 #1
0
 public double[] DGlobalContext(double[] dvalues)
 {
     double[] result = new double[LocationOutputs.Count()];
     for (int i = 0; i < result.Count(); i++)
     {
         for (int j = 0; j < Stonk.MktSize; j++)
         {
             if (LocationOutputs[i].Any())
             {
                 result[i] += dvalues[j] * LocationOutputs[i].Last()[j];
             }
         }
     }
     return(result);
 }
コード例 #2
0
 public double[] Multiply()
 {
     if (LocationOutputs.Count() == LocalContextOutputs.Count())
     {
         double[] output = new double[LocationOutputs.Last().Last().Count()];
         double[] ctxt   = new double[LocalContextOutputs.Count()];
         Parallel.For(0, ctxt.Count(), j => ctxt[j] = LocalContextOutputs[j].Last().First());
         this.GlobalOutputs = Activations.SoftMax(ctxt);
         Parallel.For(0, LocationOutputs.Count(), j =>
         {
             for (int i = 0; i < output.Count(); i++)
             {
                 output[i] = LocationOutputs[j].Last()[i] * GlobalOutputs[j];
             }
         });
         return(output);
     }
     return(null);
 }