Update direct.cpp

This commit is contained in:
bjyb 2023-09-20 11:42:24 +08:00
parent 93ace67b06
commit 04af05a859
1 changed files with 18 additions and 1 deletions

View File

@ -42,6 +42,12 @@ Results = Determine the parameter configuration and achieve high recognition rat
#include "db4ai/db4ai_api.h"
/*Function: model_ Fit
Formal parameters: (const char * name, AlgorithmML algorithm, const Hyperparameter * hyperparameters, int nhyperp,
Oid * typid, bool * typbyval, int16 * typlen, int ncolumns, callback_ Ml_ Fetch fetch,
Callback_ Ml_ Rescan rescan, void * callback_ Data)
Return value: Model*
model training*/
Model *model_fit(const char *name, AlgorithmML algorithm, const Hyperparameter *hyperparameters, int nhyperp,
Oid *typid, bool *typbyval, int16 *typlen, int ncolumns, callback_ml_fetch fetch,
callback_ml_rescan rescan, void *callback_data)
@ -119,6 +125,10 @@ ModelPredictor model_prepare_predict(const Model* model)
pred->predictor = pred->palgo->prepare_predict(pred->palgo, &model->data, model->return_type);
return (ModelPredictor)pred;
}
/*Function: model_ Predict
Formal parameters: (ModelPredictor predictor, Datum * values, bool * isnull, Oid * typid, int num_columns)
Return value: Datum
model prediction*/
Datum model_predict(ModelPredictor predictor, Datum *values, bool *isnull, Oid *typid, int num_columns)
{
@ -126,11 +136,18 @@ Datum model_predict(ModelPredictor predictor, Datum *values, bool *isnull, Oid *
return pred->palgo->predict(pred->palgo, pred->predictor, values, isnull, typid, num_columns);
}
/*Function: model_ Store
Parameter: (const Model * model)
Return value: None
Model Storage*/
void model_store(const Model *model)
{
store_model(model);
}
/*Function: model_ Load
Formal parameter: (const char * modelname)
Return value: Model*
Model loading*/
const Model *model_load(const char *model_name)
{
return get_model(model_name, false);