/// <summary> /// Sets the item feature related hyper-parameters for a given inference algorithm. /// </summary> /// <param name="itemFeatureHyperparameters">The user feature related hyper-parameters.</param> private void SetItemFeatureHyperparameters(FeatureHyperparameters itemFeatureHyperparameters) { Debug.Assert(itemFeatureHyperparameters != null, "Valid item feature hyperparameters must be provided."); this.inferenceAlgorithm.ItemTraitFeatureWeightPriorVariance = itemFeatureHyperparameters.TraitWeightPriorVariance; this.inferenceAlgorithm.ItemBiasFeatureWeightPriorVariance = itemFeatureHyperparameters.BiasWeightPriorVariance; }
/// <summary> /// Sets the user feature related hyper-parameters. /// </summary> /// <param name="userFeatureHyperparameters">The user feature related hyper-parameters.</param> private void SetUserFeatureHyperparameters(FeatureHyperparameters userFeatureHyperparameters) { Debug.Assert(userFeatureHyperparameters != null, "Valid user feature hyperparameters must be provided."); this.inferenceAlgorithm.UserTraitFeatureWeightPriorVariance = userFeatureHyperparameters.TraitWeightPriorVariance; this.inferenceAlgorithm.UserBiasFeatureWeightPriorVariance = userFeatureHyperparameters.BiasWeightPriorVariance; }
/// <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); }