示例#1
0
        private TOut Predict <TIn, TOut>(Guid modelInstanceUId, IList <Dictionary <string, object> > dataList,
                                         string methodName, int timeoutSec, bool predictContributions)
            where TIn : PredictionRequest <PredictionInput>, new()
        {
            modelInstanceUId.CheckArgumentEmpty(nameof(modelInstanceUId));
            dataList.CheckArgumentNullOrEmpty(nameof(dataList));
            var request = new TIn {
                ApiKey  = _apiKey,
                ModelId = modelInstanceUId,
                Data    = new List <PredictionInput>(),
                PredictContributions = predictContributions
            };

            foreach (Dictionary <string, object> data in dataList)
            {
                var input = new PredictionInput();
                data.ForEach(keyValue => input.Add(keyValue.Key, keyValue.Value));
                request.Data.Add(input);
            }
            TOut response = Post <TOut>(methodName, request, timeoutSec);

            return(response);
        }