Пример #1
0
        /// <summary>
        /// Trigger a recommendation build for the given model.
        /// Note: unless configured otherwise the u2i (user to item/user based) recommendations are enabled too.
        /// </summary>
        /// <param name="modelId">the model id</param>
        /// <param name="buildDescription">a description for the build</param>
        /// <param name="operationLocationHeader">operation location header, can be used to cancel the build operation and to get status.</param>
        /// <returns>Unique indentifier of the build initiated.</returns>
        public long CreateFbtBuild(string modelId, string buildDescription, bool enableModelInsights, out string operationLocationHeader)
        {
            // only used if splitter strategy is set to RandomSplitter
            var randomSplitterParameters = new RandomSplitterParameters()
            {
                RandomSeed  = 0,
                TestPercent = 10
            };

            var parameters = new FbtBuildParameters()
            {
                MinimalScore             = 0,
                SimilarityFunction       = FbtSimilarityFunction.Lift,
                SupportThreshold         = 3,
                MaxItemSetSize           = 2,
                EnableModelingInsights   = enableModelInsights,
                SplitterStrategy         = SplitterStrategy.LastEventSplitter,
                RandomSplitterParameters = randomSplitterParameters,
            };

            var requestInfo = new BuildRequestInfo()
            {
                BuildType       = BuildType.Fbt,
                BuildParameters = new BuildParameters()
                {
                    Fbt = parameters,
                },
                Description = buildDescription
            };

            return(BuildModel(modelId, requestInfo, out operationLocationHeader));
        }
Пример #2
0
        /// <summary>
        /// Trigger a recommendation build for the given model.
        /// Note: unless configured otherwise the u2i (user to item/user based) recommendations are enabled too.
        /// </summary>
        /// <param name="modelId">the model id</param>
        /// <param name="buildDescription">a description for the build</param>
        /// <param name="enableModelInsights"> true to enable modeling insights, selects "LastEventSplitter" as the splitting strategy by default. </param>
        /// <param name="operationLocationHeader">operation location header, can be used to cancel the build operation and to get status.</param>
        /// <returns>Unique indentifier of the build initiated.</returns>
        public long CreateRecommendationsBuild(string modelId,
                                               string buildDescription,
                                               bool enableModelInsights,
                                               out string operationLocationHeader)
        {
            // only used if splitter strategy is set to RandomSplitter
            var randomSplitterParameters = new RandomSplitterParameters()
            {
                RandomSeed  = 0,
                TestPercent = 10
            };

            var parameters = new RecommendationBuildParameters()
            {
                NumberOfModelIterations  = 10,
                NumberOfModelDimensions  = 20,
                ItemCutOffLowerBound     = 1,
                EnableModelingInsights   = enableModelInsights,
                SplitterStrategy         = SplitterStrategy.LastEventSplitter,
                RandomSplitterParameters = randomSplitterParameters,
                EnableU2I              = true,
                UseFeaturesInModel     = false,
                AllowColdItemPlacement = false,
            };

            var requestInfo = new BuildRequestInfo()
            {
                BuildType       = BuildType.Recommendation,
                BuildParameters = new BuildParameters()
                {
                    Recommendation = parameters
                },
                Description = buildDescription
            };

            return(BuildModel(modelId, requestInfo, out operationLocationHeader));
        }