Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommunityTrainingAlgorithm"/> class.
        /// </summary>
        /// <param name="iterationCount">The number of inference iterations to perform.</param>
        /// <param name="traitCount">The number of traits the algorithm will try to learn.</param>
        /// <param name="useSharedUserThresholds">Indicates whether to use shared user thresholds.</param>
        /// <param name="noiseHyperparameters">The noise-related hyper-parameters.</param>
        /// <param name="userHyperparameters">The user-related hyper-parameters.</param>
        /// <param name="itemHyperparameters">The item-related hyper-parameters.</param>
        /// <param name="userFeatureHyperparameters">The user feature related hyper-parameters.</param>
        /// <param name="itemFeatureHyperparameters">The item feature related hyper-parameters.</param>
        public CommunityTrainingAlgorithm(
            int iterationCount,
            int traitCount,
            bool useSharedUserThresholds,
            NoiseHyperparameters noiseHyperparameters,
            UserHyperparameters userHyperparameters,
            ItemHyperparameters itemHyperparameters,
            FeatureHyperparameters userFeatureHyperparameters,
            FeatureHyperparameters itemFeatureHyperparameters)
        {
            this.inferenceAlgorithm = new MatchboxCommunityTraining_EP();

            Debug.Assert(iterationCount > 0, "The number of iterations must be positive.");
            this.iterationCount = iterationCount;

            Debug.Assert(traitCount > 0, "The number of traits must be positive.");
            this.inferenceAlgorithm.TraitCount = traitCount;

            this.inferenceAlgorithm.UseSharedUserThresholds = useSharedUserThresholds;

            this.SetNoiseHyperparameters(noiseHyperparameters);
            this.SetUserHyperparameters(userHyperparameters);
            this.SetItemHyperparameters(itemHyperparameters);
            this.SetUserFeatureHyperparameters(userFeatureHyperparameters);
            this.SetItemFeatureHyperparameters(itemFeatureHyperparameters);
        }
Beispiel #2
0
        /// <summary>
        /// Sets the user hyper-parameters.
        /// </summary>
        /// <param name="userHyperparameters">The user hyper-parameters.</param>
        private void SetUserHyperparameters(UserHyperparameters userHyperparameters)
        {
            Debug.Assert(userHyperparameters != null, "Valid noise hyperparameters must be provided.");

            this.inferenceAlgorithm.UserTraitVariance          = userHyperparameters.TraitVariance;
            this.inferenceAlgorithm.UserBiasVariance           = userHyperparameters.BiasVariance;
            this.inferenceAlgorithm.UserThresholdPriorVariance = userHyperparameters.ThresholdPriorVariance;
        }