Пример #1
0
 private static double Score(SimpleMatrix features, IList <SimpleMatrix> weights)
 {
     for (int i = 0; i < weights.Count; i += 2)
     {
         features = weights[i].Mult(features).Plus(weights[i + 1]);
         if (weights[i].NumRows() > 1)
         {
             features = NeuralUtils.ElementwiseApplyReLU(features);
         }
     }
     return(features.ElementSum());
 }
Пример #2
0
        public virtual double GetPairwiseScore(SimpleMatrix antecedentEmbedding, SimpleMatrix anaphorEmbedding, SimpleMatrix pairFeatures)
        {
            SimpleMatrix firstLayerOutput = NeuralUtils.ElementwiseApplyReLU(antecedentEmbedding.Plus(anaphorEmbedding).Plus(pairFeaturesMatrix.Mult(pairFeatures)).Plus(pairwiseFirstLayerBias));

            return(Score(firstLayerOutput, pairwiseModel));
        }