Exemple #1
0
    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);
    }
Exemple #2
0
    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);
    }