예제 #1
0
        /// <summary>
        /// Sets the item hyper-parameters.
        /// </summary>
        /// <param name="itemHyperparameters">The item hyper-parameters.</param>
        private void SetItemHyperparameters(ItemHyperparameters itemHyperparameters)
        {
            Debug.Assert(itemHyperparameters != null, "Valid item hyperparameters must be provided.");

            this.inferenceAlgorithm.ItemTraitVariance = itemHyperparameters.TraitVariance;
            this.inferenceAlgorithm.ItemBiasVariance  = itemHyperparameters.BiasVariance;
        }
예제 #2
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="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,
            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.SetNoiseHyperparameters(noiseHyperparameters);
            this.SetUserHyperparameters(userHyperparameters);
            this.SetItemHyperparameters(itemHyperparameters);
            this.SetUserFeatureHyperparameters(userFeatureHyperparameters);
            this.SetItemFeatureHyperparameters(itemFeatureHyperparameters);
        }