返回首页

gbase数据、南大通用产品文档:GBase8a训练函数

更新日期:2024年09月11日

语法
Logistic 回归的训练函数的语法如下:
logregr_train( source_table,
out_table,
dependent_varname,
independent_varname,
max_iter,
optimizer,
tolerance
)
参数说明

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1431

source_table:含训练数据的输入表。

out_table:保存训练结果的结果表。

dependent_varname:因变量的列名。因变量列应为布尔值,非布尔值会在处
理过程中被隐式转换为布尔值。

independent_varname:自变量的列名,数组类型。

max_iter:最大的迭代次数。

optimizer:迭代过程中使用的优化器。

tolerance:容忍度。两次迭代的对数似然差小于该值则结束迭代。
结果表说明
训练函数成功执行后,会创建保存模型信息的结果表,结果表包含如下字段用来
表示模型信息:

coef:相关系数,用于预测。

log_likelihood:对数似然值,训练中评估模型的参数。

std_err:相关系数的标准差。

z_stats:相关系数的z-统计量。

num_rows_processed:处理的数据行数。

num_missing_rows_skipped:略过的数据行数。

num_iterations:迭代次数。
摘要表说明
训练结束还会生出一个摘要表,其名为为结果表表名加上”_summary”,摘要表的
字段说明如下:

method:挖掘算法名称,为logregr。

source_table:输入表名。

out_table:结果表名。

dependent_varname:因变量名。

independent_varname:自变量名。

optimizer_params:优化器参数,最大迭代次数、容忍度等。

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1432

num_failed_groups:训练失败的分组数。

num_rows_processed:处理的数据行数。

num_missing_rows_skipped:略过的数据行数。

..............................
- 694 -

stcmpr() 函数比较两个以空终止的字符串。

语法
mint stcmpr(s1, s2)
char *s1, *s2;
s1
指向第一个以空终止的字符串的指针。
s2
指向第二个以空终止的字符串的指针。
重要: 在 ASCII 排序序列中,当 s1 出现在 s2 之后时,s1 大于 s2。

返回代码
=0
两个字符串相同。
<0
第一个字符串小于第二个字符串。
>0
第一个字符串大于第二个字符串。

示例


GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 955 -
此样例程序在 demo 目录中的 stcmpr.ec 文件中。
/*
* stcmpr.ec *

The following program displays the results of three string comparisons using stcmpr().
*/

#include

main()
{
printf("STCMPR Sample ESQL Program running.\n\n");
printf("Executing: stcmpr(\"aaa\", \"aaa\")\n");
printf(" Result = %d", stcmpr("aaa", "aaa")); /* equal */
printf("\nExecuting: stcmpr(\"aaa\", \"aaaa\")\n");
printf(" Result = %d", stcmpr("aaa", "aaaa")); /* less */
printf("\nExecuting: stcmpr(\"bbb\", \"aaaa\")\n");
printf(" Result = %d\n", stcmpr("bbb", "aaaa")); /* greater */
printf("\nSTCMPR Sample Program over.\n\n");
}

输出

STCMPR Sample ESQL Program running.

Executing: stcmpr("aaa", "aaa")
Result = 0
Executing: stcmpr("aaa", "aaaa")
Result = -1
Executing: stcmpr("bbb", "aaaa")
Result = 1

STCMPR Sample Program over.

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 956 -