);
查看训练结果。
gbase> SELECT * FROM patients_logregr\G
*************************** 1. row ***************************
coef: -5.828, -0.888858, 0.108851
log_likelihood: -9.70259
std_err: 2.70859, 1.08267, 0.0461127
z_stats: -2.15168, -0.820985, 2.36054
num_rows_processed: 20
num_missing_rows_skipped: 0
num_iterations: 17
1 row in set (Elapsed: 00:00:00.00)
gbase> select * from test.patients_logregr_summary\G
*************************** 1. row ***************************
GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1434
method: logregr
source_table: test.patients
out_table: test.patients_logregr
dependent_varname: second_attack
independent_varname: array double[1, treatment, trait_anxiety]
optimizer_params: optimizer=cg, max_iter=20, tolerance=0.0001
num_all_groups: 1
num_failed_groups: 0
num_rows_processed: 20
num_missing_rows_skipped: 0
grouping_col: NULL
1 row in set (Elapsed: 00:00:00.00)
用模型进行预测。
gbase>
SELECT p.id,
mllib.logregr_predict(
coef,
array double[1, treatment, trait_anxiety]
) as predict,
p.second_attack
FROM patients p, patients_logregr m
ORDER BY p.id;
+----+---------+---------------+
| id | predict | second_attack |
+----+---------+---------------+
|
1 | 1
|
1 |
|
2 | 1
|
1 |
|
3 | 0
|
1 |
|
4 | 1
|
1 |
|
5 | 0
|
1 |
|
6 | 1
|
1 |
|
7 | 1
|
1 |
|
8 | 1
|
1 |
|
9 | 1
|
1 |
| 10 | 1
|
1 |
| 11 | 1
|
0 |
GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1435
| 12 | 0
|
0 |
| 13 | 0
|
0 |
| 14 | 0
|
0 |
| 15 | 0
|
0 |
| 16 | 0
|
0 |
| 17 | 1
|
0 |
| 18 | 0
|
0 |
| 19 | 0
|
0 |
| 20 | 1
|
0 |
+----+---------+---------------+
20 rows in set (Elapsed: 00:00:00.00)
预测语句输出的id 列代表不同的患者,
predict 列的值代表对患者是否会复发
的预测值(0 代表不复发,1 代表复发),second_attach 列的值是患者是否复发
的真实值,比较两个值可以知道使用Logistic 回归模型进行分析是比较恰当
的。