private void Replicate(SparseVector <double> vector, out SparseVector <double> vector1, out SparseVector <double> vector2) { int featureIdx = BowSpace.Words.Count; vector1 = vector.Clone(); vector1.InnerIdx.Add(featureIdx); vector1.InnerDat.Add(H1); vector2 = vector.Clone(); vector2.InnerIdx.Add(featureIdx); vector2.InnerDat.Add(H2); ModelUtils.TryNrmVecL2(vector1); ModelUtils.TryNrmVecL2(vector2); }
/// <summary> /// VMP message to 'sample' /// </summary> /// <param name="probsTrue">Constant value for 'probsTrue'.</param> /// <returns>The outgoing VMP message to the 'sample' argument</returns> /// <remarks><para> /// The outgoing message is the factor viewed as a function of 'sample' conditioned on the given values. /// </para></remarks> public static BernoulliIntegerSubset SampleAverageLogarithm(SparseVector probsTrue) { var logOdds = probsTrue.Clone(); logOdds.SetToFunction(probsTrue, MMath.Logit); return(new BernoulliIntegerSubset(logOdds)); }
/// <summary> /// VMP message to 'sample' /// </summary> /// <param name="probsTrue">Constant value for 'probsTrue'.</param> /// <returns>The outgoing VMP message to the 'sample' argument</returns> /// <remarks><para> /// The outgoing message is the factor viewed as a function of 'sample' conditioned on the given values. /// </para></remarks> public static BernoulliIntegerSubset SampleAverageLogarithm(SparseVector probsTrue) { var logOdds = probsTrue.Clone(); logOdds.SetToFunction(probsTrue, MMath.Logit); return new BernoulliIntegerSubset(logOdds); }