public PredictRequestTS GetPredict(string predictorId, [Required, FromBody] Dictionary <string, object?> mainKeys) { var p = Lite.ParsePrimaryKey <PredictorEntity>(predictorId); PredictorPredictContext pctx = PredictorPredictLogic.GetPredictContext(p); PredictDictionary?fromEntity = mainKeys == null ? null : pctx.GetInputsFromParentKeys(pctx.ParseMainKeys(mainKeys)); PredictDictionary inputs = fromEntity ?? pctx.GetInputsEmpty(); PredictDictionary?originalOutputs = fromEntity; PredictDictionary predictedOutputs = inputs.PredictBasic(); PredictRequestTS pmodel = pctx.CreatePredictModel(inputs, originalOutputs, predictedOutputs); return(pmodel); }
public PredictRequestTS UpdatePredict([Required, FromBody] PredictRequestTS request) { PredictorPredictContext pctx = PredictorPredictLogic.GetPredictContext(request.predictor); PredictDictionary inputs = pctx.GetInputsFromRequest(request); if (request.alternativesCount != null) { inputs.Options = new PredictionOptions { AlternativeCount = request.alternativesCount } } ; PredictDictionary predictedOutputs = inputs.PredictBasic(); request.SetOutput(predictedOutputs); return(request); }