public static void Initialize(string instance) { var defaultBehaviorWeights = new Dictionary <string, float> { { BehaviorTypes.View, .5f }, { BehaviorTypes.AddToCart, .7f }, { BehaviorTypes.Purchase, 1f } }; foreach (var behaviorType in BehaviorTypes.All()) { BehaviorStores.Register(instance, behaviorType, new SqlceBehaviorStore(instance, behaviorType)); float weight = defaultBehaviorWeights[behaviorType]; var config = BehaviorConfig.Load(instance, behaviorType); if (config != null) { weight = config.Weight; } var matrix = new SqlceSimilarityMatrix(instance, behaviorType, "Similarity_" + behaviorType); SimilarityMatrixes.Register(instance, behaviorType, matrix); RelatedItemsProviders.Register(instance, new ItemToItemRelatedItemsProvider(matrix), weight); } BehaviorReceivers.Set(instance, new BufferedBehaviorReceiver(new BehaviorReceiver(instance), 1000, TimeSpan.FromSeconds(5))); RecommendationEngines.Register(instance, CreateRecommendationEngines(instance)); Schedulers.Start(instance); ScheduleJobs(instance); }
public ActionResult Behaviors(IList <BehaviorConfig> configs) { foreach (var config in configs) { BehaviorConfig.Update(CurrentInstance.Name, config); } var weights = configs.ToDictionary(c => c.BehaviorType, c => c.Weight); RecommendationEngineConfiguration.ChangeBehaviorWeights(CurrentInstance.Name, weights); return(AjaxForm().ReloadPage()); }
private void AdvTree1_AfterNodeSelect(object sender, DevComponents.AdvTree.AdvTreeNodeEventArgs e) { Behavior = e.Node?.Tag as BehaviorConfig; buttonX_Select.Enabled = Behavior != null; }