# extpmml **Repository Path**: linzk/extpmml ## Basic Information - **Project Name**: extpmml - **Description**: 机器学习模型/drools规则发布和调用服务平台 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 4 - **Created**: 2019-08-01 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ####创建mysql表 ```mysql-sql CREATE TABLE `T_Pmmls` ( `Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增字段', `Name` varchar(20) NOT NULL COMMENT '模型名', `Pmml` mediumblob NOT NULL COMMENT '模型文件', `Features` text NOT NULL COMMENT '模型输入特征', `State` int(4) DEFAULT NULL COMMENT '状态 1:在线 0:待上线 -1:无效', `Source` varchar(20) NOT NULL COMMENT '模型来源类型,evaluator或booster或drools', `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `gmt_modify` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', PRIMARY KEY (`Id`), UNIQUE KEY `uq_name_key` (`Name`) ) ENGINE=InnoDB AUTO_INCREMENT=1266864 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED COMMENT='模型描述表'; ``` ####启动服务 ```text 1.确保$JAVA_HOME已设置 2.设置tar包解压目录为$EXTPMML_HOME 3. ./bin/start.sh启动 ``` ####1.模型上传页面 ```text http://localhost:8080 http://localhost:8080/index 上传成功的模型状态为0,表示待上线状态 ``` ####1.模型更新页面 ```text http://localhost:8080/update 只能更新状态非1的模型 ``` ####2.模型上线页面 ```text http://localhost:8080/up 只能上线非在线状态(0或-1)的模型 ``` ####3.模型下线页面 ```text http://localhost:8080/down 只能下线在线状态(1)的模型 ``` ####4.模型测试页面 ```text http://localhost:8080/test 只能测试非在线状态(0或-1)的模型 ``` #####4.1 模型name ```json test_model_01 ``` #####4.2 模型变量json ```json {"call_cnt_s90":892.0,"call_out_cnt_s30":45.0,"per_call_abnormal_1m":0.4,"call_in_cnt_s90":596.0,"call_out_phonenumber_cnt_s90":83.0,"call_in_phonenumber_cnt_s180":564.0,"call_phonenumber_cnt_s30":147.0,"call_early_mor_cnt_s60":1.0,"call_in_early_mor_cnt_s60":0.0,"cnt_mobile_contact":57.0,"call_out_early_mor_cnt_s180":1.0,"call_out_early_mor_cnt_s90":1.0,"call_in_cnt_m6":255.0,"call_cnt_m4":345.0,"call_in_cnt_m5":298.0,"call_cnt_m5":388.0,"call_in_cnt_m4":221.0,"call_cnt_m2":369.0,"call_in_cnt_m3":158.0,"call_cnt_1w":0.0,"call_cnt_m3":288.0,"call_in_cnt_m2":286.0,"call_in_cnt_m1":0.0,"call_cnt_m1":0.0,"call_early_morning_cnt":5.0,"call_in_phonenumber_cnt_s30":139.0,"call_phone_in_contacts_tot":38.0,"call_phonenumber_cnt_s90":337.0,"call_out_cnt_m2":83.0,"call_out_cnt_m1":0.0,"call_out_cnt_m4":124.0,"is_name_matched":1.0,"call_cnt_s30":238.0,"call_out_cnt_m3":130.0,"call_out_cnt_s90":296.0,"call_in_cnt_s180":1361.0,"call_in_phonenumber_cnt_s60":209.0,"order_call_out_cnt_s6":538.0,"rate_anonymous_call_3m":0.53,"call_out_cnt_m6":111.0,"call_out_cnt_m5":90.0,"call_out_phonenumber_cnt_s180":137.0,"call_cnt_s180":1949.0,"carrier_top10_noncontact_l3m":1.0,"order_call_in_early_mor_cnt_s6":4.0,"order_call_out_cnt_s3":213.0,"order_call_in_early_mor_cnt_s1":0.0,"order_call_out_cnt_s1":0.0,"order_call_in_early_mor_cnt_s3":0.0,"sex":1.0,"call_early_mor_cnt_m5":2.0,"call_cnt_s3":1002.0,"call_early_mor_cnt_m6":2.0,"call_out_phonenumber_cnt_s30":18.0,"call_early_mor_cnt_m3":1.0,"call_early_mor_cnt_m4":0.0,"call_out_early_mor_cnt_s30":0.0,"call_cnt_s6":2055.0,"call_early_mor_cnt_m1":0.0,"call_early_mor_phonenumber_cnt_s90":1.0,"call_early_mor_cnt_m2":0.0,"order_call_in_cnt_s3":444.0,"call_early_mor_cnt_s30":0.0,"order_call_in_cnt_s6":1218.0,"call_out_early_mor_cnt_m3":1.0,"call_out_early_mor_cnt_m2":0.0,"call_early_mor_phonenumber_cnt_s180":3.0,"call_in_early_mor_cnt_s90":0.0,"call_out_early_mor_cnt_m5":0.0,"call_out_cnt_s1":83.0,"call_out_early_mor_cnt_m4":0.0,"order_call_in_cnt_s1":0.0,"call_out_early_mor_cnt_m6":0.0,"call_in_early_mor_cnt_m6":2.0,"call_in_early_mor_cnt_m5":2.0,"call_in_early_mor_cnt_m4":0.0,"call_in_early_mor_cnt_m3":0.0,"call_out_cnt_s3":337.0,"call_out_cnt_s6":627.0,"call_out_early_mor_cnt_m1":0.0,"online_time":70.0,"order_call_cnt_s6":1756.0,"order_call_cnt_s3":657.0,"order_call_cnt_s1":0.0,"call_out_early_mor_cnt_s60":1.0,"call_in_cnt_s60":388.0,"call_phonenumber_cnt_s180":624.0,"call_cnt_s60":546.0,"call_out_cnt_s60":158.0,"call_out_phonenumber_cnt_s60":47.0,"call_in_early_mor_cnt_s180":4.0,"call_cnt":2055.0,"call_in_early_mor_cnt_m2":0.0,"call_in_early_mor_cnt_m1":0.0,"call_early_mor_cnt_s3":1.0,"call_early_mor_cnt_s90":1.0,"order_call_out_early_mor_cnt_s1":0.0,"call_early_mor_cnt_s1":0.0,"call_early_mor_phonenumber_cnt_s30":0.0,"order_call_out_early_mor_cnt_s3":1.0,"order_call_out_early_mor_cnt_s6":1.0,"call_early_mor_cnt_s6":5.0,"call_in_early_mor_cnt_s30":0.0,"call_cnt_m6":366.0,"call_out_early_mor_cnt_s1":0.0,"call_early_mor_cnt_s180":5.0,"num_phone_call_1m":192.0,"call_out_early_mor_cnt_s3":1.0,"carrier_callcnt_1m":369.0,"call_out_early_mor_cnt_s6":1.0,"num_phone_contacts_tot":57.0,"rate_carrier_moon_call_h3m":1.0,"carrier_top10_pernumber_nonmobile_cnt":0.0,"call_early_mor_phonenumber_cnt_s60":1.0,"call_in_cnt_s3":665.0,"call_in_cnt_s1":286.0,"call_phonenumber_cnt_s60":233.0,"call_out_cnt_s180":588.0,"carrier_top10_pernumber_noncall_cnt_l3m":1.0,"call_in_early_mor_cnt_s3":0.0,"call_in_early_mor_cnt_s1":0.0,"call_in_phonenumber_cnt_s90":296.0,"call_in_early_mor_cnt_s6":4.0,"call_in_cnt_s6":1428.0,"age":30.0,"call_in_cnt_s30":193.0} ``` #####4.3 模型features ```json age,call_cnt,call_cnt_1w,call_cnt_m1,call_cnt_m2,call_cnt_m3,call_cnt_m4,call_cnt_m5,call_cnt_m6,call_cnt_s180,call_cnt_s3,call_cnt_s30,call_cnt_s6,call_cnt_s60,call_cnt_s90,call_early_mor_cnt_m1,call_early_mor_cnt_m2,call_early_mor_cnt_m3,call_early_mor_cnt_m4,call_early_mor_cnt_m5,call_early_mor_cnt_m6,call_early_mor_cnt_s1,call_early_mor_cnt_s180,call_early_mor_cnt_s3,call_early_mor_cnt_s30,call_early_mor_cnt_s6,call_early_mor_cnt_s60,call_early_mor_cnt_s90,call_early_mor_phonenumber_cnt_s180,call_early_mor_phonenumber_cnt_s30,call_early_mor_phonenumber_cnt_s60,call_early_mor_phonenumber_cnt_s90,call_early_morning_cnt,call_in_cnt_m1,call_in_cnt_m2,call_in_cnt_m3,call_in_cnt_m4,call_in_cnt_m5,call_in_cnt_m6,call_in_cnt_s1,call_in_cnt_s180,call_in_cnt_s3,call_in_cnt_s30,call_in_cnt_s6,call_in_cnt_s60,call_in_cnt_s90,call_in_early_mor_cnt_m1,call_in_early_mor_cnt_m2,call_in_early_mor_cnt_m3,call_in_early_mor_cnt_m4,call_in_early_mor_cnt_m5,call_in_early_mor_cnt_m6,call_in_early_mor_cnt_s1,call_in_early_mor_cnt_s180,call_in_early_mor_cnt_s3,call_in_early_mor_cnt_s30,call_in_early_mor_cnt_s6,call_in_early_mor_cnt_s60,call_in_early_mor_cnt_s90,call_in_phonenumber_cnt_s180,call_in_phonenumber_cnt_s30,call_in_phonenumber_cnt_s60,call_in_phonenumber_cnt_s90,call_out_cnt_m1,call_out_cnt_m2,call_out_cnt_m3,call_out_cnt_m4,call_out_cnt_m5,call_out_cnt_m6,call_out_cnt_s1,call_out_cnt_s180,call_out_cnt_s3,call_out_cnt_s30,call_out_cnt_s6,call_out_cnt_s60,call_out_cnt_s90,call_out_early_mor_cnt_m1,call_out_early_mor_cnt_m2,call_out_early_mor_cnt_m3,call_out_early_mor_cnt_m4,call_out_early_mor_cnt_m5,call_out_early_mor_cnt_m6,call_out_early_mor_cnt_s1,call_out_early_mor_cnt_s180,call_out_early_mor_cnt_s3,call_out_early_mor_cnt_s30,call_out_early_mor_cnt_s6,call_out_early_mor_cnt_s60,call_out_early_mor_cnt_s90,call_out_phonenumber_cnt_s180,call_out_phonenumber_cnt_s30,call_out_phonenumber_cnt_s60,call_out_phonenumber_cnt_s90,call_phone_in_contacts_tot,call_phonenumber_cnt_s180,call_phonenumber_cnt_s30,call_phonenumber_cnt_s60,call_phonenumber_cnt_s90,carrier_callcnt_1m,carrier_top10_noncontact_l3m,carrier_top10_pernumber_noncall_cnt_l3m,carrier_top10_pernumber_nonmobile_cnt,cnt_mobile_contact,is_name_matched,num_phone_call_1m,num_phone_contacts_tot,online_time,order_call_cnt_s1,order_call_cnt_s3,order_call_cnt_s6,order_call_in_cnt_s1,order_call_in_cnt_s3,order_call_in_cnt_s6,order_call_in_early_mor_cnt_s1,order_call_in_early_mor_cnt_s3,order_call_in_early_mor_cnt_s6,order_call_out_cnt_s1,order_call_out_cnt_s3,order_call_out_cnt_s6,order_call_out_early_mor_cnt_s1,order_call_out_early_mor_cnt_s3,order_call_out_early_mor_cnt_s6,per_call_abnormal_1m,rate_anonymous_call_3m,rate_carrier_moon_call_h3m,sex ``` ####5.模型预测接口 ```text http://localhost:8080/extpmml/v1/predict ```