/// <summary>
        /// Creates an Infer.NET inference algorithm for making predictions from a binary Bayes point machine classifier
        /// with <see cref="Gaussian"/> prior distributions over factorized weights and features in a dense representation.
        /// </summary>
        /// <param name="generatedSourceFolder">The folder to drop the generated prediction algorithm to.</param>
        public static void CreateSparseBinaryPredictionAlgorithm(string generatedSourceFolder)
        {
            // Create the model
            var model = new SparseBinaryModel(computeModelEvidence: false, useCompoundWeightPriorDistributions: false);

            // Add the inferred variables
            model.Labels.AddAttribute(QueryTypes.Marginal);

            // Apply the query to the model and compile the inference algorithm
            GetCompiledInferenceAlgorithm("GaussianSparseBinaryBpmPrediction", generatedSourceFolder, model.Labels);
        }
        /// <summary>
        /// Creates an Infer.NET inference algorithm which trains a binary Bayes point machine classifier
        /// with factorized weight distributions on features in a sparse representation.
        /// </summary>
        /// <param name="generatedSourceFolder">The folder to drop the generated training algorithm to.</param>
        /// <param name="computeModelEvidence">If true, the generated training algorithm computes evidence.</param>
        /// <param name="useCompoundWeightPriorDistributions">
        /// If true, the generated training algorithm uses compound prior distributions over weights. Otherwise
        /// <see cref="Gaussian"/> prior distributions are used.
        /// </param>
        public static void CreateSparseBinaryTrainingAlgorithm(
            string generatedSourceFolder,
            bool computeModelEvidence,
            bool useCompoundWeightPriorDistributions)
        {
            // Create the model
            var model = new SparseBinaryModel(computeModelEvidence, useCompoundWeightPriorDistributions);

            // Add the observed variables
            model.Labels.ObservedValue = default(bool[]);

            // Add the inferred variables
            var queryVariables = new List <IVariable> {
                model.Weights
            };

            model.Weights.AddAttribute(QueryTypes.Marginal);
            model.Weights.AddAttribute(QueryTypes.MarginalDividedByPrior);

            if (useCompoundWeightPriorDistributions)
            {
                queryVariables.Add(model.WeightPrecisionRates);
                model.WeightPrecisionRates.AddAttribute(QueryTypes.MarginalDividedByPrior);

                if (computeModelEvidence)
                {
                    // This is required to compute evidence corrections
                    model.WeightPrecisionRates.AddAttribute(QueryTypes.Marginal);
                }
            }

            if (computeModelEvidence)
            {
                queryVariables.Add(model.ModelSelector);
                model.ModelSelector.AddAttribute(QueryTypes.Marginal);
            }

            // Apply the query to the model and compile the inference algorithm
            string queryName =
                (useCompoundWeightPriorDistributions ? "Compound" : "Gaussian")
                + "SparseBinaryBpmTraining"
                + (computeModelEvidence ? "Evidence" : string.Empty);

            GetCompiledInferenceAlgorithm(queryName, generatedSourceFolder, queryVariables.ToArray());
        }