const result = { "indicator": [{ "indicator_name": "平均绝对误差(MAE)", "indicator_value": "0.08101189881563187" }, { "indicator_name": "平均平方吴差(MSE)", "indicator_value": "0.012648699805140495" }, { "indicator_name": "平均绝对百分比误差(MAPE)", "indicator_value": "0.10916599631309509" }, { "indicator_name": "相对平方误差(RSE)", "indicator_value": "0.1145000010728836" }, { "indicator_name": "相对绝对误差(RAE)", "indicator_value": "0.1704999953508377" }], "actualvsfitted": [{ "project_id": "C1093416A0GR", "fitted_name": "转资率", "fitted_value": "0.7853289842605591", "actual_value": "0.862529993057251", "mape": "0.08950509876012802", "correctRate": "0.910494901239872", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.07720080018043518" }, { "project_id": "C1093417A00V", "fitted_name": "转资率", "fitted_value": "0.6753730177879333", "actual_value": "0.6881459951400757", "mape": "0.018560800701379776", "correctRate": "0.9814391992986202", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.012772499583661556" }, { "project_id": "C1093417A05S", "fitted_name": "转资率", "fitted_value": "0.7237169742584229", "actual_value": "0.7263259887695312", "mape": "0.003592390101402998", "correctRate": "0.9964076136238873", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.0026092398911714554" }, { "project_id": "C1093416A0LP", "fitted_name": "转资率", "fitted_value": "0.6970229744911194", "actual_value": "0.7569590210914612", "mape": "0.07918059825897217", "correctRate": "0.9208193719387054", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.05993650108575821" }, { "project_id": "C1093416A0P4", "fitted_name": "转资率", "fitted_value": "0.7441400289535522", "actual_value": "0.8284509778022766", "mape": "0.10176999866962433", "correctRate": "0.8982304260134697", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.0843110978603363" }, { "project_id": "C1093416A0PU", "fitted_name": "转资率", "fitted_value": "0.8445169925689697", "actual_value": "0.8471180200576782", "mape": "0.0030712399166077375", "correctRate": "0.9969287647400051", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.0026016999036073685" }, { "project_id": "C1093416A0TB", "fitted_name": "转资率", "fitted_value": "0.7737159729003906", "actual_value": "0.7846720218658447", "mape": "0.013962400145828724", "correctRate": "0.986037565395236", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.010955899953842163" }, { "project_id": "C1093416A0A3", "fitted_name": "转资率", "fitted_value": "0.7680439949035645", "actual_value": "0.7590360045433044", "mape": "0.011868099682033062", "correctRate": "0.9881319403648376", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.009008280001580715" }, { "project_id": "C1093417A007", "fitted_name": "转资率", "fitted_value": "0.8479539752006531", "actual_value": "0.65556800365448", "mape": "0.2934649884700775", "correctRate": "0.7065349519252777", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.19238600134849548" }, { "project_id": "C1093416A0U0", "fitted_name": "转资率", "fitted_value": "0.8790789842605591", "actual_value": "0.7881860136985779", "mape": "0.11531800031661987", "correctRate": "0.8846815377473831", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.09089239686727524" }, { "project_id": "C1093417A00T", "fitted_name": "转资率", "fitted_value": "0.8443269729614258", "actual_value": "0.8639410138130188", "mape": "0.022702999413013458", "correctRate": "0.9772969987243414", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.019613999873399734" }, { "project_id": "C1093416A0SS", "fitted_name": "转资率", "fitted_value": "0.6755639910697937", "actual_value": "0.6296219825744629", "mape": "0.07296759635210037", "correctRate": "0.9270323514938354", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.04594210162758827" }, { "project_id": "C1093416A0RK", "fitted_name": "转资率", "fitted_value": "0.5426380038261414", "actual_value": "0.6102200150489807", "mape": "0.1107499971985817", "correctRate": "0.8892500847578049", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.06758180260658264" }, { "project_id": "C1093417A0AV", "fitted_name": "转资率", "fitted_value": "0.4515799880027771", "actual_value": "0.7240300178527832", "mape": "0.3762960135936737", "correctRate": "0.6237035989761353", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.2724500000476837" }, { "project_id": "C1093417A04D", "fitted_name": "转资率", "fitted_value": "0.8682270050048828", "actual_value": "0.8129349946975708", "mape": "0.0680147036910057", "correctRate": "0.9319853186607361", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.05529149994254112" }, { "project_id": "C1093417A00F", "fitted_name": "转资率", "fitted_value": "0.943759024143219", "actual_value": "0.7929779887199402", "mape": "0.19014599919319153", "correctRate": "0.8098542839288712", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.15078100562095642" }, { "project_id": "C1093416A0R7", "fitted_name": "转资率", "fitted_value": "0.7958329916000366", "actual_value": "0.8188289999961853", "mape": "0.028084799647331238", "correctRate": "0.9719151742756367", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.022996699437499046" }, { "project_id": "C1093417A052", "fitted_name": "转资率", "fitted_value": "0.9502859711647034", "actual_value": "0.9722660183906555", "mape": "0.02260719984769821", "correctRate": "0.9773927759379148", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.021980199962854385" }, { "project_id": "C1093417A04Q", "fitted_name": "转资率", "fitted_value": "0.8013280034065247", "actual_value": "0.9310529828071594", "mape": "0.13933099806308746", "correctRate": "0.8606685549020767", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.12972499430179596" }, { "project_id": "C1093417A00P", "fitted_name": "转资率", "fitted_value": "0.8668079972267151", "actual_value": "0.7895799875259399", "mape": "0.09780950099229813", "correctRate": "0.9021905213594437", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.07722839713096619" }, { "project_id": "C1093417A012", "fitted_name": "转资率", "fitted_value": "0.7392269968986511", "actual_value": "0.5809980034828186", "mape": "0.27233999967575073", "correctRate": "0.7276604175567627", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.15822899341583252" }, { "project_id": "C1093417A08J", "fitted_name": "转资率", "fitted_value": "0.7699919939041138", "actual_value": "0.8282949924468994", "mape": "0.0703883022069931", "correctRate": "0.9296116977930069", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.058302201330661774" }, { "project_id": "C1093417A045", "fitted_name": "转资率", "fitted_value": "0.8161810040473938", "actual_value": "0.7767720222473145", "mape": "0.05073399841785431", "correctRate": "0.9492660090327263", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.03940879926085472" }, { "project_id": "C1093416A0TN", "fitted_name": "转资率", "fitted_value": "0.814365029335022", "actual_value": "0.8158569931983948", "mape": "0.0018286199774593115", "correctRate": "0.9981713789748028", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.0014918900560587645" }, { "project_id": "C1093416A0PV", "fitted_name": "转资率", "fitted_value": "0.5420699715614319", "actual_value": "0.7873520255088806", "mape": "0.3115279972553253", "correctRate": "0.6884720921516418", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.24528199434280396" }, { "project_id": "C1093416A0NP", "fitted_name": "转资率", "fitted_value": "0.8103709816932678", "actual_value": "0.8068000078201294", "mape": "0.00442609004676342", "correctRate": "0.9955739094875753", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.0035709699150174856" }, { "project_id": "C1093417A002", "fitted_name": "转资率", "fitted_value": "0.7061949968338013", "actual_value": "0.7159169912338257", "mape": "0.0135799003764987", "correctRate": "0.9864200819283724", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.0097220903262496" }, { "project_id": "C1093417A03B", "fitted_name": "转资率", "fitted_value": "0.8671759963035583", "actual_value": "0.8741139769554138", "mape": "0.007937019690871239", "correctRate": "0.9920629793778062", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.006937860045582056" }, { "project_id": "C1093417A042", "fitted_name": "转资率", "fitted_value": "0.9019709825515747", "actual_value": "0.6864449977874756", "mape": "0.313975989818573", "correctRate": "0.6860244870185852", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.2155269980430603" }, { "project_id": "C1093417A06S", "fitted_name": "转资率", "fitted_value": "0.694989025592804", "actual_value": "0.7645019888877869", "mape": "0.09092549979686737", "correctRate": "0.9090744629502296", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.06951270252466202" }, { "project_id": "C1093417A0J8", "fitted_name": "转资率", "fitted_value": "0.6714649796485901", "actual_value": "0.7320460081100464", "mape": "0.08275560289621353", "correctRate": "0.9172443747520447", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.06058090180158615" }, { "project_id": "C1093417A082", "fitted_name": "转资率", "fitted_value": "0.6310989856719971", "actual_value": "0.5879340171813965", "mape": "0.07341670244932175", "correctRate": "0.9265833348035812", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.0431642010807991" }, { "project_id": "C1093416A0T5", "fitted_name": "转资率", "fitted_value": "0.757224977016449", "actual_value": "0.8019090294837952", "mape": "0.055721499025821686", "correctRate": "0.9442785307765007", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.04468350112438202" }, { "project_id": "C1093417A0AX", "fitted_name": "转资率", "fitted_value": "0.7245609760284424", "actual_value": "0.5603749752044678", "mape": "0.2929919958114624", "correctRate": "0.7070080935955048", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.16418500244617462" }, { "project_id": "C1093417A03Y", "fitted_name": "转资率", "fitted_value": "0.9102389812469482", "actual_value": "0.909529983997345", "mape": "7.789420196786523E-4", "correctRate": "0.999221058038529", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "7.084709941409528E-4" }, { "project_id": "C1093417A00Z", "fitted_name": "转资率", "fitted_value": "0.7455250024795532", "actual_value": "0.7433099746704102", "mape": "0.002980950055643916", "correctRate": "0.9970190520398319", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.002215770073235035" }, { "project_id": "C1093417A04G", "fitted_name": "转资率", "fitted_value": "0.7153580188751221", "actual_value": "0.8402600288391113", "mape": "0.1486469954252243", "correctRate": "0.8513526618480682", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.12490200251340866" }, { "project_id": "C1093417A043", "fitted_name": "转资率", "fitted_value": "0.550819993019104", "actual_value": "0.8216590285301208", "mape": "0.3296239972114563", "correctRate": "0.6703756749629974", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.27083900570869446" }, { "project_id": "C1093416A0SU", "fitted_name": "转资率", "fitted_value": "0.7717700004577637", "actual_value": "0.725583016872406", "mape": "0.06365569680929184", "correctRate": "0.9363443031907082", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.04618750140070915" }, { "project_id": "C1093417A01P", "fitted_name": "转资率", "fitted_value": "0.6737679839134216", "actual_value": "0.612076997756958", "mape": "0.10079000145196915", "correctRate": "0.8992096856236458", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.06169139966368675" }, { "project_id": "C1093416A0TA", "fitted_name": "转资率", "fitted_value": "0.7272400259971619", "actual_value": "0.8737969994544983", "mape": "0.16772399842739105", "correctRate": "0.8322759568691254", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.1465570032596588" }, { "project_id": "C1093416A0R6", "fitted_name": "转资率", "fitted_value": "0.6524069905281067", "actual_value": "0.6930400133132935", "mape": "0.05863010138273239", "correctRate": "0.9413699209690094", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.04063300043344498" }, { "project_id": "C1093417A00A", "fitted_name": "转资率", "fitted_value": "0.5792700052261353", "actual_value": "0.7490500211715698", "mape": "0.22666099667549133", "correctRate": "0.7733393758535385", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.16978000104427338" }, { "project_id": "C1093417A027", "fitted_name": "转资率", "fitted_value": "0.9016410112380981", "actual_value": "0.8753160238265991", "mape": "0.0300757996737957", "correctRate": "0.9699241537600756", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "0.026325900107622147" }, { "project_id": "C1093417A0AS", "fitted_name": "转资率", "fitted_value": "0.5844709873199463", "actual_value": "0.8133010268211365", "mape": "0.281360000371933", "correctRate": "0.7186398506164551", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "residuals": "-0.2288309931755066" }], "paramId": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a", "distribution": [{ "project_id": "3", "actual_value": "[0.5604 - 0.6016)", "percent": "0.06666666666666667" }, { "project_id": "3", "actual_value": "[0.6016 - 0.6428)", "percent": "0.06666666666666667" }, { "project_id": "1", "actual_value": "[0.6428 - 0.6839)", "percent": "0.02222222222222222" }, { "project_id": "5", "actual_value": "[0.6839 - 0.7251)", "percent": "0.1111111111111111" }, { "project_id": "8", "actual_value": "[0.7251 - 0.7663)", "percent": "0.1777777777777778" }, { "project_id": "8", "actual_value": "[0.7663 - 0.8075)", "percent": "0.1777777777777778" }, { "project_id": "9", "actual_value": "[0.8075 - 0.8487)", "percent": "0.2" }, { "project_id": "5", "actual_value": "[0.8487 - 0.8899)", "percent": "0.1111111111111111" }, { "project_id": "2", "actual_value": "[0.8899 - 0.9311)", "percent": "0.04444444444444444" }, { "project_id": "1", "actual_value": "[0.9311 - 0.9723]", "percent": "0.02222222222222222" }], "feature_importance": [{ "feature_weight": "0.9933106899261475", "feature_name": "变更后预算金额", "predicted_name": "转资率", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a" }, { "feature_weight": "0.9903746843338013", "feature_name": "监理费用", "predicted_name": "转资率", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a" }, { "feature_weight": "0.984813928604126", "feature_name": "甲供材料费", "predicted_name": "转资率", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a" }, { "feature_weight": "0.9840520620346069", "feature_name": "设计费用", "predicted_name": "转资率", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a" }, { "feature_weight": "0.9330044388771057", "feature_name": "测绘费用", "predicted_name": "转资率", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a" }, { "feature_weight": "0.7640959024429321", "feature_name": "分项工程个数", "predicted_name": "转资率", "param_id": "4d2a272f-fadf-4f48-bcbf-2ccf134e0e8a" }] }; var series = []; const importanceData = {}; const importanceIndex = new Set(); for (const item of result.feature_importance) { if (importanceData[item.predicted_name] == null) { importanceData[item.predicted_name] = []; } importanceData[item.predicted_name].push(item.feature_weight); importanceIndex.add(item.feature_name); } for (const key in importanceData) { series.push({ type: 'bar', xAxisIndex: 0, yAxisIndex: 0, data: importanceData[key], itemStyle: { color: '#3399FF' }, animationDelay: function(idx) { return idx * 10; }, }); } const actualvsfittedData = []; const correctRateData = []; const correctRateIndex = []; for (const item of result.actualvsfitted) { actualvsfittedData.push([item.actual_value, item.fitted_value]); correctRateIndex.push(item.project_id); correctRateData.push(item.correctRate); } series.push({ name: '工程转资率', type: 'scatter', xAxisIndex: 1, yAxisIndex: 1, data: actualvsfittedData, itemStyle: { color: '#FF8A00' }, markLine: { animation: false, lineStyle: { normal: { type: 'solid' } }, data: [ [{ x: '7%', y: '91%', symbol: 'none' }, { x: '45%', y: '58%', symbol: 'none' }] ] } }); series.push({ name: '工程个数', type: 'line', xAxisIndex: 2, yAxisIndex: 2, data: correctRateData, smooth: true, itemStyle: { color: '#3399FF' }, showSymbol: false, animationDelay: function(idx) { return idx * 10; } }); var indicator = [{ indicator_name: '指标名称', indicator_value: '指标值' }]; if (result.indicator) { for (const iterator of result.indicator) { indicator.push({ indicator_name: iterator.indicator_name, indicator_value: parseFloat(iterator['indicator_value']).toFixed(3) }); } } series.push({ name: '模型拟合评估指标', type: 'custom', data: indicator, coordinateSystem: 'none', renderItem: function renderItem(params, api) { const style = api.style({ stroke: 'black', fill: params.dataIndex === 0 ? '#dcdcdc' : null }); const apiWidth = api.getWidth(); const apiHeight = api.getHeight(); let font; let height; let y0; if (params.dataIndex === 0) { font = 'bolder 1.5em "Microsoft YaHei", sans-serif'; height = apiHeight * 0.07; y0 = apiHeight * 0.07 + 1; } else { font = '1.1em "Microsoft YaHei", sans-serif'; height = apiHeight * 0.052; y0 = apiHeight * 0.088 + params.dataIndex * height + 1; } const x0 = apiWidth * 0.54; const value = indicator[params.dataIndex]; return { type: 'group', children: [{ type: 'rect', shape: { x: x0, y: y0, width: 0.29 * apiWidth, height: height, }, style: style }, { type: 'text', style: { text: value['indicator_name'], font: font, x: x0 + 3, y: y0 + height / 3, } }, { type: 'rect', shape: { x: x0 + 0.29 * apiWidth, y: y0, width: 0.1 * apiWidth, height: height }, style: style }, { type: 'text', style: { text: value.indicator_value, font: font, x: x0 + 0.29 * apiWidth + 3, y: y0 + height / 3 } }] }; } }); option = { title: [ { text: '工程转资率真实值vs预测值', x: '23%', y: '50%', textAlign: 'center' } ], grid: [{ x: '7%', y: '7%', width: '38%', height: '33%' }, { x: '7%', y2: '9%', width: '38%', height: '33%' }, { x2: '7%', y2: '9%', width: '38%', height: '33%' }], tooltip: { formatter: '{a}: {c}' }, xAxis: [{ gridIndex: 0, min: 0, boundaryGap: ['0', '5%'] }, { gridIndex: 1, type: 'value', scale: true, name: '实际值', nameLocation: 'middle', nameGap: 27, }, { gridIndex: 2, type: 'category', data: correctRateIndex, axisPointer: { type: 'shadow' }, axisLabel: { rotate: 30 } }], yAxis: [{ gridIndex: 0, type: 'category', data: Array.from(importanceIndex), axisPointer: { type: 'shadow' }, axisLabel: { rotate: 40 } }, { gridIndex: 1, type: 'value', scale: true, name: '预测值', nameLocation: 'middle', nameGap: 30, nameRotate: 90 }, { gridIndex: 2, type: 'value', scale: true, axisLabel: { formatter: (value, index) => { return `${value * 100}%`; } }, splitLine: { show: false } }], series: series };