dev-QQq
qinzhenpen 2 years ago
commit 4eed38bd2a

@ -28,8 +28,11 @@
"fuse.js": "6.6.2",
"highlight.js": "^11.10.0",
"html2canvas": "^1.4.1",
"html2canvas": "^1.4.1",
"js-cookie": "3.0.1",
"jsencrypt": "3.3.1",
"jspdf": "^2.5.1",
"jszip": "^3.10.1",
"marked": "^14.0.0",
"md-editor-v3": "^4.18.1",
"nprogress": "0.2.0",

@ -89,3 +89,11 @@ export function downloadClusterAnalysisForm(data) {
data:data,
})
}
//回归分析--逻辑回归
export function logisticRegression(data) {
return request({
url: '/api/model/logistic',
method: 'post',
data:data,
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

@ -199,13 +199,13 @@ aside {
text-align: center;
.el-button:nth-child(1) {
background: url("../../assets/images/确定222.png") no-repeat;
background-size: 100% 100%;
background: url("../../assets/images/确定222.png") no-repeat !important;
background-size: 100% 100% !important;
}
.el-button:nth-child(2) {
background: url("../../assets/images/取消.png") no-repeat;
background-size: 100% 100%;
background: url("../../assets/images/取消.png") no-repeat !important;
background-size: 100% 100% !important;
}
.el-button--large.is-round {
@ -222,9 +222,37 @@ aside {
}
.app-container2 {
position: relative;
padding: 20px;
background: #FFFFFF;
box-shadow: 0px 0px 13px 0px #D6E0FE;
margin: 10px;
box-shadow: 0px 0px 13px 0px #0452C6;
border-radius: 10px;
padding: 25px 25px 10px 25px;
}
.dialogClass{
background:url('@/assets/images/弹框.png') !important;
background-size: 100% 100% !important;
.el-dialog__header{
padding: 5px 0px;
margin-right: 5px !important;
.gbImg{
cursor: pointer;
width: 51px;
height: 31px;
background-size: 100% 100%;
}
}
.xtImg{
margin-left: 18px;
width: 530px;
}
}
.my-header {
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 16px;
text-align: center;
span{
color: #FFFFFF;
padding: 38px 20px 0;
}
}

@ -66,7 +66,7 @@ export const constantRoutes = [
path: "/index",
component: () => import("@/views/index"),
name: "Index",
meta: { title: "首页", icon: "dashboard", affix: true },
meta: { title: "首页", icon: "首页", affix: true },
},
],
},

@ -0,0 +1,94 @@
import html2Canvas from 'html2canvas'
import JsPDF from 'jspdf'
var noTableHeight = 0 //table外的元素高度
export const htmlPdf = (title, html, fileList, type) => {
return new Promise((resolve, reject) => {
if (fileList) {
const pageHeight = Math.floor(277 * html.scrollWidth / 190) + 20 // 计算pdf高度
for (let i = 0; i < fileList.length; i++) { // 循环获取的元素
const multiple = Math.ceil((fileList[i].offsetTop + fileList[i].offsetHeight) / pageHeight) // 元素的高度
if (isSplit(fileList, i, multiple * pageHeight)) { // 计算是否超出一页
var _H = '' // 向pdf插入空白块的内容高度
if (fileList[i].localName !== 'tr') { // 判断是不是表格里的内容
_H = multiple * pageHeight - (fileList[i].offsetTop + fileList[i].offsetHeight)
} else {
_H = multiple * pageHeight - (fileList[i].offsetTop + fileList[i].offsetHeight + noTableHeight) + 20
}
var newNode = getFooterElement(_H) // 向pdf插入空白块的内容
const divParent = fileList[i].parentNode // 获取该div的父节点
const next = fileList[i].nextSibling // 获取div的下一个兄弟节点
// 判断兄弟节点是否存在
if (next) {
// 存在则将新节点插入到div的下一个兄弟节点之前即div之后
divParent.insertBefore(newNode, next)
} else {
// 否则向节点添加最后一个子节点
divParent.appendChild(newNode)
}
}
}
}
html2Canvas(html, {
allowTaint: false,
taintTest: false,
logging: false,
useCORS: true,
dpi: window.devicePixelRatio * 1,
scale: 1 // 按比例增加分辨率
}).then(canvas => {
var pdf = new JsPDF('l', 'mm', 'a4') // A4纸横向或纵向
var ctx = canvas.getContext('2d')
var a4w = type ? 277 : 190; var a4h = type ? 190 : 277 // A4大小
var imgHeight = Math.floor(a4h * canvas.width / a4w) // 按A4显示比例换算一页图像的像素高度
var renderedHeight = 0
while (renderedHeight < canvas.height) {
var page = document.createElement('canvas')
page.width = canvas.width
page.height = Math.min(imgHeight, canvas.height - renderedHeight)// 可能内容不足一页
// 用getImageData剪裁指定区域并画到前面创建的canvas对象中
page.getContext('2d').putImageData(ctx.getImageData(0, renderedHeight, canvas.width, Math.min(imgHeight, canvas.height - renderedHeight)), 0, 0)
pdf.addImage(page.toDataURL('image/jpeg', 1.0), 'JPEG', 10, 10, a4w, Math.min(a4h, a4w * page.height / page.width)) // 添加图像到页面
renderedHeight += imgHeight
if (renderedHeight < canvas.height) {
pdf.addPage()// 如果后面还有内容,添加一个空页
}
}
// 返回Blob对象而不是直接下载文件
const pdfBlob = pdf.output('blob');
resolve(pdfBlob);
}).catch(error => {
reject(error);
});
});
}
// pdf截断需要一个空白位置来补充
const getFooterElement = (remainingHeight, fillingHeight = 0) => {
const newNode = document.createElement('div')
newNode.style.background = '#ffffff'
newNode.style.width = 'calc(100% + 8px)'
newNode.style.marginLeft = '-4px'
newNode.style.marginBottom = '0px'
newNode.classList.add('divRemove')
newNode.style.height = (remainingHeight + fillingHeight) + 'px'
return newNode
}
const isSplit = (nodes, index, pageHeight) => {
if (nodes[index].localName !== 'tr') { // 判断元素是不是tr
noTableHeight += nodes[index].clientHeight
}
if (nodes[index].localName !== 'tr') {
return nodes[index].offsetTop + nodes[index].offsetHeight < pageHeight && nodes[index + 1] && nodes[index + 1].offsetTop + nodes[index + 1].offsetHeight > pageHeight
} else {
return nodes[index].offsetTop + nodes[index].offsetHeight + noTableHeight < pageHeight && nodes[index + 1] && nodes[index + 1].offsetTop + nodes[index + 1].offsetHeight + noTableHeight > pageHeight
}
}

@ -1,36 +1,22 @@
<template>
<div>
<el-dialog
title="任务知识导入"
style="width: 1108px; height: 798px"
custom-class="dialogClass"
:show-close="false"
class="dialog"
:title="title"
style="width: 1308px; height: 838px"
custom-class="dialog"
v-model="props.showModel"
:close-on-click-modal="false"
:before-close="close"
>
<template #header="{ titleId, titleClass }">
<div class="my-header">
<span :id="titleId" :class="titleClass">任务知识导入</span>
<img
class="gbImg"
src="@/assets/images/关闭.png"
@click="close"
alt=""
/>
</div>
<img class="xtImg" src="@/assets/images/线条.png" alt="" />
</template>
<div
class="diaMain"
style="
color: #fff;
margin-top: -35px;
padding: 10px;
padding-left: 20px;
"
>
<el-scrollbar height="650px">
<slot name="content"></slot>
<el-scrollbar height="730px">
<slot name="content" class="main"></slot>
</el-scrollbar>
</div>
<!-- <template #footer>
@ -75,39 +61,52 @@ const submit = () => {
};
</script>
<style lang="scss" scoped>
::v-deep .el-dialog {
background: url("@/assets/images/弹框@2x.png") !important;
background-size: 1108px 798px !important;
.el-dialog__header {
padding: 5px 0px;
margin-right: 5px !important;
.gbImg {
cursor: pointer;
margin-top: 3px;
// margin-left: -30px;
width: 51px;
height: 35px;
background-size: 100% 100%;
}
</style>
<style lang="scss">
.diaMain{
img{
max-height: 1200px;
max-width: 1200px;
}
.xtImg {
margin-left: 18px;
width: 530px;
p{
font-size: 15px;
}
}
.my-header {
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 16px;
text-align: center;
margin-right: 9px;
margin-bottom: 0;
.dialog {
border-radius: 12px;
.el-dialog__header {
background: url("@/assets/images/szjj/弹窗标题.png") !important;
background-size: 100% 100% !important;
margin-right: 0 !important;
span {
font-size: 14px;
font-weight: 400;
color: #ffffff;
padding: 38px 20px 0;
margin-top: 10px;
margin-left: 20px;
}
}
.el-dialog__headerbtn {
top: 8px !important;
background: url("@/assets/images/szjj/关闭2.png") no-repeat;
background-size: 100% 100% !important;
width: 16px;
height: 16px;
margin-right: 15px;
margin-top: 7px;
}
.el-dialog__headerbtn i {
content: "1";
font-size: 13px;
visibility: hidden;
}
.el-dialog__footer {
text-align: center;
}
.tj{
color: #FFFFFF;
}
.cxks{
background: url('@/assets/images/szjj/重新开始.png') no-repeat;
}
}
</style>

@ -1,115 +0,0 @@
<template>
<el-dialog
class="testDialog"
append-to-body
v-model="props.showModel"
title=""
align-center
draggable
:modal="false"
:show-close="false"
:style="{ borderRadius: 12 + 'px', width: props.width + 'px' }"
:close-on-click-modal="false"
custom-class="dialog"
>
<template #header>
<div
class="my-header"
:style="{
width: props.width + 'px',
backgroundSize: props.width + 'px ' + 43 + 'px',
}"
>
<span>{{ props.title }}</span>
<span style="cursor: pointer" @click="close()"
><img
style="width: 13px; height: 13px"
src="@/assets/images/关闭.png"
alt=""
/></span>
</div>
</template>
<slot name="content"></slot>
</el-dialog>
</template>
<script setup>
const emits = defineEmits(["closePop", "submit"]);
const dialogVisible = ref(false);
const props = defineProps({
modelValue: [String, Object, Array],
//
showModel: {
type: Boolean,
default: false,
},
title: {
type: String,
default: "Title",
},
width: {
type: String,
default: "673",
},
showOprBtn: {
type: Boolean,
default: true,
},
});
const close = () => {
emits("closePop");
};
const submit = () => {
emits("submit");
};
</script>
<style lang="scss" scoped>
.my-header {
display: flex;
justify-content: space-between;
padding-left: 25px;
padding-top: 15px;
padding-right: 15px;
position: absolute;
left: 0;
top: 0;
// background: url("@/assets/images/popHeader.png") no-repeat;
background-color: #ff6100;
width: 673px;
height: 53px;
background-size: 673px 43px;
color: white;
border-radius: 10px 10px 0 0;
}
.dialog-footer {
display: block;
text-align: center;
.okBtn {
width: 118px;
height: 40px;
// background: url("@/assets/images/popOkBtn.png");
background-color: #ff6100;
border: none;
color: white;
// padding-left: 40px;
text-align: center;
// margin-right: 50px;
}
.cancelBtn {
width: 118px;
height: 40px;
// background: url("@/assets/images/popCancelBtn.png");
border: none;
color: white;
padding-left: 40px;
}
}
</style>
<style>
.dialog_class {
pointer-events: none;
}
.el-dialog {
pointer-events: auto;
}
</style>

@ -1,9 +1,9 @@
<template>
<div class="app-container">
<div class="app-container2">
<div class="img-centent">
<div class="left" style=" width: 100%" >
<el-scrollbar height="650px" style="height:96%">
<el-scrollbar height="610px" style="height:94%">
<el-row>
<el-col :span="24">
<div class="title-back">
@ -108,9 +108,9 @@
</div>
</div>
</el-scrollbar>
<div class="dialog-footer">
<el-button type="primary" round plain size="large" @click="submitTask" >提交任务</el-button>
<el-button type="primary" round plain size="large" @click="reset"></el-button>
<div class="dialog-footer" style="margin-top:10px">
<el-button type="primary" class="tj" plain size="large" @click="submitTask" >提交任务</el-button>
<el-button type="primary" class="cxks" plain size="large" @click="reset"></el-button>
</div>
</div>
<div class="Case">
@ -365,8 +365,8 @@ dialogShowbtn()
// }
.Case {
position: absolute;
top: 150px;
right: 15px;
top: 180px;
right: 40px;
width: 216px;
padding-left: 60px;
span{

@ -1,13 +1,13 @@
<template>
<div class="app-container">
<div class="app-container2">
<div class="Naturallanguageprocessing">
<div class="left">
<el-scrollbar height="650px" style="height: 93%;">
<el-scrollbar height="620px" style="height: 93%;">
<el-row>
<el-col :span="24">
<div class="TaskBackground">
<span>任务背景</span>
<span style="color:#000000;">任务背景</span>
</div>
</el-col>
</el-row>
@ -169,8 +169,8 @@
</div>
</el-scrollbar>
<div class="dialog-footer">
<el-button @click="submit"></el-button>
<el-button type="primary" @click="restart"></el-button>
<el-button @click="submit" class="tj">提交任务</el-button>
<el-button type="primary" class="tj" @click="restart"></el-button>
</div>
</div>
<div class="right">
@ -526,8 +526,8 @@ onBeforeUnmount(()=>{
}
.right {
position: absolute;
top: 150px;
right: 15px;
top: 180px;
right: 41px;
width: 216px;
padding-left: 60px;
span {
@ -670,4 +670,7 @@ onBeforeUnmount(()=>{
.dialog-footer{
margin-top: 5px;
}
.tj{
--el-button-hover-text-color:#000000;
}
</style>

@ -1,10 +1,10 @@
<template>
<div class="app-container">
<div class="app-container2">
<div class="Robot-learning">
<div class="left">
<div class="gdialog">
<el-scrollbar height="650px" style="height: 93%;">
<el-scrollbar height="620px" style="height: 93%;">
<el-row>
<el-col :span="24">
<div class="TaskBackground">
@ -163,8 +163,8 @@
</p>
</el-scrollbar>
<div class="dialog-footer" style="margin-top: 7px;">
<el-button @click="submit"></el-button>
<el-button type="primary" @click="restart"></el-button>
<el-button class="tj" @click="submit"></el-button>
<el-button class="tj" type="primary" @click="restart"></el-button>
</div>
</div>
@ -632,8 +632,8 @@ onBeforeUnmount(() => {
}
.right {
position: absolute;
top: 150px;
right: 15px;
top: 180px;
right: 41px;
width: 216px;
padding-left: 60px;
span {
@ -875,4 +875,7 @@ onBeforeUnmount(() => {
}
}
}
.tj{
--el-button-hover-text-color:#000000;
}
</style>

@ -1,9 +1,9 @@
<template>
<div class="app-container">
<div class="app-container2">
<div class="text-centent">
<div class="left">
<el-scrollbar height="650px" style="height:96%">
<el-scrollbar height="625px" style="height:94%">
<el-row>
<el-col :span="24">
<div class="title-back">
@ -57,9 +57,9 @@
</div>
</div>
</el-scrollbar>
<div class="dialog-footer">
<el-button type="primary" round plain size="large" @click="submit"></el-button>
<el-button type="primary" round plain size="large" @click='reStart'>重新开始</el-button>
<div class="dialog-footer" style="margin-top:5px">
<el-button type="primary" class="tj" size="large" @click="submit"></el-button>
<el-button type="primary" size="large" @click='reStart'>重新开始</el-button>
</div>
</div>
<div class="right">
@ -273,8 +273,8 @@ CharacterRecognitionCase()
}
.right {
position: absolute;
right: 15px;
top: 150px;
right: 30px;
top: 180px;
width: 216px;
padding-left: 60px;
span {
@ -344,12 +344,12 @@ div {
background: url("@/assets/images/szjj/提交任务.png") no-repeat !important;
background-size: 100% 100%;
}
.el-button--primary:nth-child(2) {
width: 140px !important;
padding-left: 60px;
background: url("@/assets/images/szjj/重新开始.png") no-repeat !important;
background-size:cover;
}
// .el-button--primary:nth-child(2) {
// width: 140px !important;
// padding-left: 60px;
// background: url("@/assets/images/szjj/.png") no-repeat !important;
// background-size:cover;
// }
.Identify {
margin-top: 20px;
width: calc(100% - 20%);
@ -387,4 +387,7 @@ div {
// // margin-left: 20px;
// }
}
.tj{
--el-button-hover-text-color:#000000;
}
</style>

@ -1,9 +1,9 @@
<template>
<div class="app-container">
<div class="app-container2">
<div class="Face-recognition">
<div class="left">
<el-scrollbar height="650px" style="height:96%">
<el-scrollbar height="620px" style="height:94%">
<el-row>
<el-col :span="24">
<div class="title-back">
@ -81,8 +81,8 @@
</div>
</el-scrollbar>
<div class="dialog-footer">
<el-button type="primary" round plain size="large" @click="submit"></el-button>
<el-button type="primary" round plain size="large" @click="restart"></el-button>
<el-button type="primary" class="tj" plain size="large" @click="submit"></el-button>
<el-button type="primary" class="tj" plain size="large" @click="restart"></el-button>
</div>
</div>
<div class="right">
@ -435,8 +435,8 @@ getList()
}
.right {
position: absolute;
top: 150px;
right: 15px;
top: 180px;
right: 40px;
width: 216px;
padding-left: 60px;
span {
@ -642,5 +642,8 @@ getList()
justify-content: center;
margin-top: 32px;
}
.tj{
--el-button-hover-text-color:#000000;
}
</style>

@ -1,12 +1,12 @@
<template>
<div class="app-container">
<div class="app-container2">
<div class="voice-technology">
<div class="left">
<el-scrollbar height="650px" style="height: 93%;">
<el-scrollbar height="620px" style="height: 93%;">
<el-row>
<el-col :span="24">
<div class="TaskBackground">
<span>任务背景</span>
<span style="color: #000000;">任务背景</span>
</div>
</el-col>
</el-row>
@ -300,9 +300,9 @@
</p>
</div>
</el-scrollbar>
<div class="dialog-footer">
<el-button @click="submit"></el-button>
<el-button type="primary" @click="reStart"></el-button>
<div class="dialog-footer" style="margin-top:10px">
<el-button class="tj" @click="submit"></el-button>
<el-button class="tj" type="primary" @click="reStart"></el-button>
</div>
</div>
<div class="right">
@ -860,8 +860,8 @@ onMounted(()=>{
}
.right {
position: absolute;
right: 15px;
top:150px;
right: 42px;
top: 180px;
width: 216px;
padding-left: 60px;
span {
@ -1065,4 +1065,7 @@ canvas,
color: #FFFFFF;
}
}
.tj{
--el-button-hover-text-color:#000000;
}
</style>

@ -2,7 +2,7 @@
<div class="app-container">
<div class="HadoophDFS">
<div class="left">
<el-scrollbar height="660px" style="height:96%">
<el-scrollbar height="610px" style="height:96%">
<p>
本案例通过搭建服务器集群安装Hadoop组件实训演练Hadoop的核心组件HDFS分布式文件系统的读写流程和原理
</p>
@ -2143,6 +2143,7 @@ p {
}
.cxks{
background: url('@/assets/images/szjj/重新开始.png') no-repeat;
--el-button-hover-text-color:#000000;
}
.el-dialog__body {
padding: 20px 20px;
@ -2162,10 +2163,11 @@ p {
border-color:none;
}
.tj{
color: #FFFFFF;
color: #000000;
}
.cxks{
background: url('@/assets/images/szjj/重新开始.png') no-repeat;
--el-button-hover-text-color:#000000;
}
}
.clientAbs{

@ -1,9 +1,9 @@
<template>
<div class="app-container">
<el-scrollbar height="650px">
<div class="app-container2">
<!-- <el-scrollbar height="650px"> -->
<div style="width:100%">
<div class="digital_main">
<el-scrollbar height="680px">
<el-scrollbar height="610px">
<div class="left_main">
<p style="font-weight: bold; font-size: 15px">
本任务以案例数据形式介绍Apriori算法下的实现步骤假设有四名客户1234购买了编号为ABCDE若干
@ -347,16 +347,16 @@
</div>
</div>
</el-scrollbar>
<div class="dialog-footer">
<div class="dialog-footer" style="margin-top:10px">
<el-button @click="sendTask" class="tj">提交任务</el-button>
<el-button type="primary" @click="dialogVisible = false" class="cxks">
关闭
<el-button @click="startOver" class="cxks">
重新开始
</el-button>
</div>
</div>
<span class="imgSpan" @click="dialogVisible=true"></span>
</div>
</el-scrollbar>
<!-- </el-scrollbar> -->
</div>
@ -1220,8 +1220,8 @@ onBeforeUnmount(() => {
}
.imgSpan {
position: absolute;
top: 28px;
right: 30px;
top: 180px;
right: 90px;
width: 110px;
height: 143px;
background: url("@/assets/images/szjj/案例任务.png") no-repeat;
@ -1518,6 +1518,7 @@ onBeforeUnmount(() => {
}
.cxks{
background: url('@/assets/images/szjj/重新开始.png') no-repeat;
--el-button-hover-text-color:#000000;
}
}
// .el-dialog:not(.is-fullscreen) {

@ -1,8 +1,8 @@
<template>
<div class="app-container">
<div class="app-container2">
<div class="Hadoop">
<div class="left">
<el-scrollbar height="650px" style="height:96%">
<el-scrollbar height="625px" style="height:93%">
<p>以下是Hadoop的技术框架图请选择相应的组件填入其中</p>
<div class="Module">
<div class="title">
@ -952,10 +952,11 @@ echoHaop()
border-color:none;
}
.tj{
color: #FFFFFF;
color: #000000;
}
.cxks{
background: url('@/assets/images/szjj/重新开始.png') no-repeat;
--el-button-hover-text-color:#000000;
}
}
</style>

@ -1,8 +1,8 @@
<template>
<div class="app-container">
<div class="app-container2">
<div class="frame">
<div class="left">
<el-scrollbar height="650px" style="height:96%">
<el-scrollbar height="620px" style="height:92%">
<div style="width: calc(100% - 216px);">
<p class="test">大数据之所以称为大数据因其和小数据比较起来有显著的特征:</p>
<div class="topic" v-for="(item, index) in data" :key="item">
@ -21,7 +21,7 @@
</div>
</div>
</el-scrollbar>
<div class="dialog-footer">
<div class="dialog-footer" style="margin-top: 10px;">
<el-button @click="sendTitle()" class="tj">提交任务</el-button>
<el-button type="primary" @click="startOver" class="cxks">
重新开始
@ -268,8 +268,8 @@ import { getUserInfo } from '@/utils/auth'
}
.right{
position: absolute;
top: 145px;
right: 20px;
top: 180px;
right: 30px;
width: 216px;
padding-left: 60px;
span {
@ -333,12 +333,24 @@ import { getUserInfo } from '@/utils/auth'
border:none;
border-color:none;
}
}
.tj{
color: #FFFFFF;
width: 136px;
height: 40px;
color: #000000 !important;
// background: url('@/assets/images/szjj/.png') !important;
--el-button-border-color: #ffffff00;
--el-button-hover-border-color: #ffffff00;
--el-button-active-border-color: #ffffff00;
}
.cxks{
background: url('@/assets/images/szjj/重新开始.png') no-repeat;
}
width: 136px;
height: 40px;
// background: url('@/assets/images/szjj/.png') !important;
color: #000000 !important;
--el-button-border-color: #ffffff00;
--el-button-hover-border-color: #ffffff00;
--el-button-active-border-color: #ffffff00;
}
.tsRight{
color: green;

@ -1,8 +1,8 @@
<template>
<div class="app-container">
<div class="app-container2">
<div class="Whatbigdata">
<div class="left">
<el-scrollbar height="650px">
<el-scrollbar height="620px">
<p class="test">大数据之所以称为大数据因其和小数据比较起来有显著的特征:</p>
<div class="eval_main" v-for="(item, index) in mlist" :key="index" :class="['eval_main' + index]" >
<div class="eval_main_title">
@ -39,7 +39,7 @@
</div>
</div>
</el-scrollbar>
<div class="dialog-footer">
<div class="dialog-footer" style="margin-top:5px">
<el-button @click="taskAnswer" class="tj">提交任务</el-button>
<el-button type="primary" @click="answerAgain" class="cxks">
重新开始
@ -97,7 +97,7 @@ import { getUserInfo } from '@/utils/auth'
try{
const newArray = [];
const sendData={
module:'人工智能',
module:'什么是大数据',
userId:JSON.parse(getUserInfo()).userId
}
const res = await getTopic(sendData);
@ -522,7 +522,7 @@ import { getUserInfo } from '@/utils/auth'
.tj{
width: 136px;
height: 40px;
color: #FFFFFF;
color: #000000 !important;
background: url('@/assets/images/szjj/提交任务.png');
--el-button-border-color: #ffffff00;
--el-button-hover-border-color: #ffffff00;
@ -532,6 +532,7 @@ import { getUserInfo } from '@/utils/auth'
width: 136px;
height: 40px;
background: url('@/assets/images/szjj/重新开始.png') no-repeat;
color: #000000 !important;
--el-button-border-color: #ffffff00;
--el-button-hover-border-color: #ffffff00;
--el-button-active-border-color: #ffffff00;

@ -7,7 +7,7 @@
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="rgzn_top app-container">
<div class="rgzn_top app-container2">
<div class="top_item">
<el-button :class="{'active':isActive===1}" @click="activeIndex(1)"><img src="@/assets/images/大数据.png">大数据</el-button>
<el-button :class="{'active':isActive===2}" @click="activeIndex(2)"><img src="@/assets/images/人工智能.png">人工智能</el-button>

@ -5,20 +5,7 @@
<p style="font-weight: 400;font-size: 12px;color: #E6E6E6;">给出任务清单参考做哪些数据的统计分析Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar sic tempor. Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus pronin sapien nunc accuan eget.</p>
</div>
<div class="main-but">
<el-upload
ref="uploadRef"
class="upload-demo"
:file-list="fileList"
:auto-upload="false"
:on-change="handleChange"
:show-file-list="false"
multiple="multiple"
>
<template #trigger>
<el-button><img src="../../../assets/images/导入.png" alt="">算法知识导入</el-button>
</template>
<!-- <div class="reportPromptFile" v-html="item[`${index}`].path"></div> -->
</el-upload>
<el-button @click="runResultShow=true"><img src="../../../assets/images/导入.png" alt="">算法知识导入</el-button>
<el-button @click="taskSubmit"><img src="../../../assets/images/提交.png" alt="">实训任务提交</el-button>
</div>
<div class="app-main">
@ -113,15 +100,15 @@
<el-table :data="tableData2" style="width: 94%;margin-top:10px" :header-cell-style="headerCellStyle" height="350">
<el-table-column v-for="column in tableLabel" :key="column.prop" :prop="column.prop" :label="column.label" align="center"/>
</el-table>
<el-pagination style="margin-top:10px" background layout="prev, pager, next" :total="1000" />
<!-- <el-pagination style="margin-top:10px" background layout="prev, pager, next" :total="1000" /> -->
</div>
<div class="analysisResults" style="margin-top: 20px">
<span style="font-weight: bold;font-size: 18px;color: #3596EB;display: block;">分析结果</span>
<el-button>下载</el-button>
<el-table :data="tableData3" row-key="TSuid" style="width: 94%;margin-top:10px" :header-cell-style="headerCellStyle" height="350">
<el-button v-if="uplodFlag" @click="upload"></el-button>
<el-table ref="exportTableRef" :data="tableData3" row-key="TSuid" style="width: 94%;margin-top:10px" :header-cell-style="headerCellStyle" height="350">
<el-table-column v-for="column in tableLabel2" :key="column.prop" :prop="column.prop" :label="column.label" align="center"/>
</el-table>
<el-pagination style="margin-top:10px" background layout="prev, pager, next" :total="1000" />
<!-- <el-pagination style="margin-top:10px" background layout="prev, pager, next" :total="1000" /> -->
</div>
</div>
</div>
@ -175,22 +162,114 @@
</div>
</template>
</el-dialog>
<pop-model
:showModel="runResultShow"
title="关联规则挖掘"
@closePop="runResultShow = false"
>
<template v-slot:content>
<div>
<p style="font-weight: 700;font-size:22px">简介</p><p>Apriori算法是一种用于挖掘数据集中频繁项集的算法进而用于生成关联规则这种算法在数据挖掘机器学习市场篮子分析等多个领域都有广泛的应用</p><p style="font-size:19px;font-weight:600">什么是关联规则挖掘</p><p>关联规则挖掘是数据挖掘中的一个重要分支其目标是发现在一个数据集中变量间存在的有趣的关联或模式<br />例子 假设在一个零售商的交易数据中如果客户购买了啤酒他们也很有可能购买薯片这里的啤酒薯片就形成了一个关联规则</p><p style="font-size:19px;font-weight:600">什么是频繁项集</p><p>频繁项集是在数据集中出现次数大于或等于最小支持度Minimum Support Threshold的项的集合<br />例子 在超市购物数据中如果牛奶面包这一组合经常一起出现在同一个购物篮里并且出现的次数超过了最小支持度那么{"牛奶", "面包"}就是一个频繁项集</p><p style="font-size:19px;font-weight:600">什么是支持度与置信度</p><li>支持度Support: 是某个项集在所有交易中出现的频率它用于衡量一个项集的普遍性<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;例子 如果我们有100笔交易其中有30笔交易包含了牛奶那么牛奶的支持度就是30%</li><li>置信度Confidence: 是在A出现的情况下B出现的条件概率<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;例子 如果在包含牛奶的所有交易中有70%的交易也包含了面包那么从牛奶面包的置信度就是70%</li>
<p style="font-size:19px;font-weight:600">Apriori算法的重要性</p><p>Apriori算法由于其简单高效的特性在数据挖掘中有着广泛的应用它不仅能用于挖掘数据中的隐藏模式还能用于诸如产品推荐用户行为分析网络安全等多个应用场景<br />例子 在电子商务网站中Apriori算法可以用于分析用户购买历史数据进而实现个性化推荐提升销售额和用户满意度</p><p style="font-size:19px;font-weight:600">应用场景</p><p>由于其广泛的用途和灵活性Apriori算法在以下几个主要领域内有着广泛的应用</p><li>市场篮子分析: 了解哪些产品经常被一起购买以进行有效的产品布局或优惠策略</li><li>医疗诊断: 分析病人的历史数据找出病症和治疗方案之间的关联</li><li>网络安全: 通过分析网络日志找出异常模式以预防或检测安全威胁</li><p>通过这些定义和例子我们可以更全面地了解Apriori算法的基本概念重要性和应用范围为后续的技术解析和实战应用打下坚实的基础</p><p style="font-weight: 700;font-size:22px">理论基础</p><p>在深入探讨Apriori算法之前理解其背后的理论基础是非常重要的本节将详细介绍关联规则挖掘的基础概念包括项集支持度置信度提升度以及如何使用这些概念来挖掘有用的关联规则</p><p style="font-size:19px;font-weight:600">项和项集</p><li>Item: 在关联规则挖掘中项通常指数据集中的一个元素<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;例子 在一个超市的购物篮数据中"牛奶""面包""啤酒"等都是单个的项</li><li>项集Itemset: 是一个项的集合可以包含一个或多个项<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;例子 {"牛奶", "面包"} {"啤酒", "薯片", "面包"} 都是项集</li><p style="font-size:19px;font-weight:600">支持度Support</p>
<p>支持度是一个度量用于表示一个项集在整个数据集中出现的频率<br />!file</p><p style="font-size:19px;font-weight:600">置信度Confidence</p><p>置信度表示在包含项集X的所有事务中也包含项集Y的事务的概率</p><img src="@/assets/images/f2001.png" alt=""><p style="font-size:19px;font-weight:600">提升度Lift</p><p>提升度用于衡量项集X和Y的出现是否相互独立</p><img src="@/assets/images/f2002.png" alt=""><p style="font-size:19px;font-weight:600">Apriori原理</p><p>Apriori原理是Apriori算法的核心它基于一个简单但重要的观察一个项集是频繁的那么它的所有子集也必须是频繁的<br />例子 如果{"牛奶", "面包", "啤酒"}是一个频繁项集那么{"牛奶", "面包"}{"牛奶", "啤酒"}{"面包", "啤酒"}也必须是频繁项集<br />通过以上的概念和例子我们应该对关联规则挖掘的基础理论有了更深入的了解这为我们后续详解Apriori算法以及实际应用提供了坚实的基础</p><p style="font-weight: 700;font-size:22px">Apriori算法概述</p><p>Apriori算法是由Agrawal和Srikant于1994年提出的用于高效地挖掘频繁项集和生成关联规则其名字Apriori来源于拉丁语意为从先验知识这很好地反映了算法的核心思想利用已知的频繁项集即先验知识来更有效地找到更大的频繁项集</p><p style="font-size:19px;font-weight:600">算法步骤</p><img src="@/assets/images/f2004.png" alt=""><p>Apriori算法的执行流程主要包含两个步骤<br />&nbsp;&nbsp;1.频繁项集生成Frequent Itemset Generation: 找出满足最小支持度阈值的所有频繁项集<br />&nbsp;&nbsp;2.关联规则生成Association Rule Generation: 从频繁项集中生成高置信度的关联规则</p>
<p style="font-size:19px;font-weight:600">频繁项集生成</p><p>&nbsp;&nbsp;1.扫描数据集找出所有单一项的支持度并筛选出满足最小支持度的项<br />&nbsp;&nbsp;2.使用满足最小支持度的项生成新的候选项集<br />&nbsp;&nbsp;3.计算新生成的候选项集的支持度并再次筛选<br />&nbsp;&nbsp;4.重复上述步骤直到不能生成新的频繁项集<br />例子 假设有一个购物交易数据集其中包括5笔交易第一步是计算所有单一商品牛奶面包在这5笔交易中的出现次数并筛选出那些出现次数达到最小支持度的商品</p><p style="font-size:19px;font-weight:600">关联规则生成</p><p>&nbsp;&nbsp;1.对于每一个频繁项集生成所有可能的非空子集<br />&nbsp;&nbsp;2.对每一条生成的规则 ( A \Rightarrow B )计算其置信度<br />&nbsp;&nbsp;3.如果规则的置信度满足最小置信度要求则该规则为有效关联规则</p><p>例子 对于频繁项集 {"牛奶", "面包", "黄油"}可能的规则有 "牛奶, 面包 -> 黄油", "牛奶, 黄油 -> 面包" 计算这些规则的置信度并筛选出满足最小置信度的规则</p><p style="font-size:19px;font-weight:600">优缺点</p><p style="font-size:19px;font-weight:600">优点</p><li>简单易懂: Apriori算法基于直观的原理并且计算过程简单</li><li>可扩展性强: 算法可以应用于大规模的数据集</li><p style="font-size:19px;font-weight:600">缺点</p><li>计算量大: 在大数据集上可能需要生成大量的候选项集</li><li>多次扫描数据: 算法需要多次扫描数据集以计算项集的支持度这在数据集很大时可能是低效的</li><p>例子 在一个包含百万级交易数据的电子商务网站中使用Apriori算法可能需要消耗大量计算资源和时间<br />通过以上的详细描述和例子我们应该对Apriori算法有了全面而深入的理解这为我们后续的技术解析和实战应用奠定了基础</p>
<p style="font-weight: 700;font-size:22px">实战应用</p><p>在理解了Apriori算法的理论基础和工作原理之后现在我们将进一步探讨其在实际场景中的应用特别是在购物篮分析和推荐系统中Apriori算法被广泛应用<br />为了更好地说明这一点下面将通过Python展示如何实现Apriori算法并用一个简单的购物数据集进行演示</p><p style="font-size:19px;font-weight:600">购物篮分析</p><p>购物篮分析Market Basket Analysis是一种在零售业非常流行的技术用于发现顾客购买产品之间的关联规则</p><p style="font-size:19px;font-weight:600">输入和输出</p><li>输入 一组交易数据每一笔交易包含多个购买的商品</li><li>输出 满足最小支持度和最小置信度的关联规则</li><p style="font-size:19px;font-weight:600">Python实现代码</p>
<MdPreview v-model="text" /><p style="font-weight: 700;font-size:22px">五、性能优化与扩展</p><p>Apriori算法虽然在多个领域有着广泛的应用但其在大数据集上的性能表现并不尽如人意。这是由于它需要多次扫描数据集以及生成大量的候选项集。在这一节中我们将讨论针对这些问题的性能优化方案和扩展方法。</p><p style="font-size:19px;font-weight:600">优化策略</p><p>优化Apriori算法的主要方法包括</p><p style="font-size:19px;font-weight:600">减少数据扫描次数</p><p>由于Apriori算法在每一轮都需要扫描整个数据集以计算支持度因此一个直观的优化方式就是减少数据扫描的次数。<br />例子: 通过构建一个事务-项倒排索引,你可以在单次数据集扫描后立即找到任何项集的支持度。</p><p style="font-size:19px;font-weight:600">采用数据压缩技术</p><p>可以通过压缩事务数据来减少计算量,例如使用位向量来表示事务。<br />例子: 若数据集中有100个商品每一笔交易都可以通过一个100位的位向量来表示。这种方式可以显著减少数据的存储需求。</p><p style="font-size:19px;font-weight:600">使用Hashing技术</p><p>通过使用哈希表来存储候选项集和它们的计数,可以加速支持度的计算。<br />例子: 在生成候选项集时,可以使用哈希函数来将项集映射到哈希表的一个位置,并在该位置增加相应的计数。</p><p style="font-size:19px;font-weight:600">扩展方法</p><p style="font-size:19px;font-weight:600">并行化</p><p>Apriori算法可以通过数据或任务并行化进行扩展以利用多处理器或分布式计算环境。<br />例子: 在一个分布式系统中,可以将数据集划分为多个子集,并在各个节点上并行计算支持度和生成频繁项集。</p><p style="font-size:19px;font-weight:600"></p><p>对于一些应用场景完全精确的频繁项集挖掘可能不是必需的在这种情况下可以使用近似算法来加速计算<br />例子 使用Monte Carlo方法或其他随机抽样技术通过部分数据来估计整个数据集的频繁项集</p>
<p style="font-size:19px;font-weight:600">集成其他数据挖掘算法</p><p>Apriori算法可以与其他数据挖掘或机器学习算法结合使用以解决更复杂的问题<br />例子 在一个推荐系统中除了使用Apriori算法找出频繁项集外还可以使用聚类算法对用户进行分群从而实现更个性化的推荐<br />通过这些优化和扩展方法我们不仅可以提升Apriori算法在大数据环境下的性能还可以拓宽其应用范围这些都为进一步的研究和应用提供了有益的方向</p><p style="font-weight: 700;font-size:22px">总结</p><p>通过本文的探讨我们不仅对Apriori算法有了全面且深入的了解而且掌握了它在实际问题中的应用特别是在购物篮分析和推荐系统方面然而我们也注意到了这一算法在面对大规模数据时存在的局限性</p><li>支持度与置信度的平衡 在实际应用中选择合适的支持度和置信度阈值是一门艺术过低的阈值可能会导致大量不显著的关联规则而过高的阈值可能会漏掉一些有用的规则</li><li>实时性问题 在动态变化的数据集上如何实现Apriori算法的实时或近实时分析也是一个值得关注的问题这在电子商务等快速响应的场景中尤为重要</li><li>多维多层分析 现有的Apriori算法主要集中在单一的项集层面未来可以考虑如何将其扩展到多维或多层的关联规则挖掘</li><li>算法与模型的集成 未来的研究趋势可能会更多地集中在将关联规则挖掘与其他机器学习模型如神经网络决策树等集成以解决更为复杂的问题</li>
<p>在今后的工作中探究这些技术洞见的相关性和应用价值以及将Apriori算法与现代计算架构如GPU分布式计算等更紧密地结合将是关键的研究方向<br />总之Apriori算法在数据挖掘和关联分析领域有着广阔的应用前景然而为了使其能够更好地适应现代数据的规模和复杂性还需要在算法优化和应用扩展方面进行更多的研究和探索希望本文能为您在这一领域的学习和应用提供有用的信息和启示</p>
</div>
</template>
</pop-model>
</template>
<script setup>
import * as echarts from 'echarts';
import * as XLSX from 'xlsx';
import { MdEditor,MdPreview } from 'md-editor-v3';
import 'md-editor-v3/lib/style.css';
import ecStat from 'echarts-stat';
import * as API from '@/api/AI.js'
import { getUserInfo } from "@/utils/auth";
import { onMounted } from 'vue';
import { onMounted, reactive } from 'vue';
import popModel from "@/views/components/popModal.vue";
const { proxy } = getCurrentInstance()
const dialogVisible=ref(false)
const runResultShow=ref(false)
const tableLabel=reactive([
{prop:'date',label:''},
])
const tableLabel2=reactive([
{prop:'date',label:''},
])
const text = ref(`首先导入必要的库:
\`\`\`python
from itertools import chain, combinations
\`\`\`
接着定义几个辅助函数
\`\`\`python
# 生成候选项集的所有非空子集
def powerset(s):
return chain.from_iterable(combinations(s, r) for r in range(1, len(s)))
# 计算支持度
def calculate_support(itemset, transactions):
return sum(1 for transaction in transactions if itemset.issubset(transaction)) / len(transactions)
\`\`\`
现在我们来实现Apriori算法
\`\`\`python
def apriori(transactions, min_support, min_confidence):
# 初始化频繁项集和关联规则列表
frequent_itemsets = []
association_rules = []
# 第一步找出单项频繁项集
singletons = {frozenset([item]) for transaction in transactions for item in transaction}
singletons = {itemset for itemset in singletons if calculate_support(itemset, transactions) >= min_support}
frequent_itemsets.extend(singletons)
# 迭代找出所有其他频繁项集
prev_frequent_itemsets = singletons
while prev_frequent_itemsets:
# 生成新的候选项集
candidates = {itemset1 | itemset2 for itemset1 in prev_frequent_itemsets for itemset2 in prev_frequent_itemsets if len(itemset1 | itemset2) == len(itemset1) + 1}
# 计算支持度并筛选
new_frequent_itemsets = {itemset for itemset in candidates if calculate_support(itemset, transactions) >= min_support}
frequent_itemsets.extend(new_frequent_itemsets)
# 生成关联规则
for itemset in new_frequent_itemsets:
for subset in powerset(itemset):
subset = frozenset(subset)
diff = itemset - subset
if diff:
confidence = calculate_support(itemset, transactions) / calculate_support(subset, transactions)
if confidence >= min_confidence:
association_rules.append((subset, diff, confidence))
prev_frequent_itemsets = new_frequent_itemsets
return frequent_itemsets, association_rules
\`\`\`
### 示例和输出
假设我们有以下简单的购物数据集
\`\`\`python
transactions = [
{'牛奶', '面包', '黄油'},
{'啤酒', '面包'},
{'牛奶', '啤酒', '黄油'},
{'牛奶', '鸡蛋'},
{'面包', '鸡蛋', '黄油'}
]
\`\`\`
调用Apriori算法
\`\`\`python
min_support = 0.4
min_confidence = 0.5
frequent_itemsets, association_rules = apriori(transactions, min_support, min_confidence)
print("频繁项集:", frequent_itemsets)
print("关联规则:", association_rules)
\`\`\`
输出可能如下
\`\`\`python
频繁项集 [{'牛奶'}, {'面包'}, {'黄油'}, {'啤酒'}, {'鸡蛋'}, {'牛奶', '面包'}, {'牛奶', '黄油'}, {'面包', '黄油'}, {'啤酒', '黄油'}, {'面包', '啤酒'}]
关联规则 [(('牛奶',), ('面包',), 0.6666666666666666), (('面包',), ('牛奶',), 0.6666666666666666), ...]
\`\`\`
通过这个实战应用我们不仅学习了如何在Python中实现Apriori算法还了解了它在购物篮分析中的具体应用这为进一步的研究和实际应用提供了有用的指导`);
const getList=()=>{
API.selectionMetrics({userId:JSON.parse(getUserInfo()).userId}).then((res)=>{
res.data.forEach(element => {
@ -211,7 +290,6 @@ const flag=ref(false)
onMounted(()=>{
getList()
})
const optionData=()=>{
API.viewingMetrics({userId:JSON.parse(getUserInfo()).userId,tableName:input.value,algorithmName:'关联规则挖掘'}).then((res)=>{
tableData.value=[]
@ -312,6 +390,8 @@ const optionData2=()=>{
}
//
const exportTableRef = ref(null);
const uplodFlag=ref(false)
const computation=()=>{
if(input5.value&&input6.value&&input4.value){
const sendData={
@ -321,15 +401,28 @@ const computation=()=>{
deduplicatedDataList:resTable2.value
}
API.associationRuleMining(sendData).then((res)=>{
uplodFlag.value=true
tableData3.value=[]
res.data.forEach(element=>{
tableData3.value.push({
date:element
})
tableLabel2.length=0
for (const key in res.data[0]) {
tableLabel2.push({
label:key,
prop:key
})
}
tableData3.value=res.data
})
}
}
const upload=()=>{
const tableDom = exportTableRef.value?.$el;
if (!tableDom) {
return;
}
const wb = XLSX.utils.table_to_book(tableDom);
XLSX.writeFile(wb, '关联规则挖掘.xlsx');
}
const startOver=()=>{
input.value=''
tableData.value=[]
@ -342,6 +435,7 @@ const startOver=()=>{
input6.value=''
tableLabel.length=0
tableLabel2.length=0
uplodFlag.value=false
}
</script>
@ -504,34 +598,3 @@ margin: 20px 20px 0;
}
}
</style>
<style lang="scss">
.dialogClass{
background:url('../../../assets/images/弹框.png') !important;
background-size: 100% 100% !important;
.el-dialog__header{
padding: 5px 0px;
margin-right: 5px !important;
.gbImg{
cursor: pointer;
width: 51px;
height: 31px;
background-size: 100% 100%;
}
}
.xtImg{
margin-left: 18px;
width: 530px;
}
}
.my-header {
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 16px;
text-align: center;
span{
color: #FFFFFF;
padding: 38px 20px 0;
}
}
</style>

@ -5,7 +5,7 @@
<p style="font-weight: 400;font-size: 12px;color: #E6E6E6;">给出任务清单参考做哪些数据的统计分析Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar sic tempor. Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus pronin sapien nunc accuan eget.</p>
</div>
<div class="main-but">
<el-button @click="runResultShow = true"><img src="../../../assets/images/导入.png" alt="">算法知识导入</el-button>
<el-button @click="algorithmicKnowledge()"><img src="../../../assets/images/导入.png" alt="">算法知识导入</el-button>
<el-button @click="taskSubmit"><img src="../../../assets/images/提交.png" alt="">实训任务提交</el-button>
</div>
<div class="app-main">
@ -97,20 +97,20 @@
<div class="main-right">
<div>
<span style="font-weight: bold;font-size: 18px;color: #3596EB;">分析数据</span>
<el-table :data="tableData2" style="width: 94%;margin-top:10px" :header-cell-style="headerCellStyle" height="350">
<el-table ref="exportTableRef" :data="tableData2" style="width: 94%;margin-top:10px" :header-cell-style="headerCellStyle" height="350">
<el-table-column v-for="column in tableLabel" :key="column.prop" :prop="column.prop" :label="column.label" align="center"/>
</el-table>
<el-pagination style="margin-top:10px" background layout="prev, pager, next" :total="1000" />
<!-- <el-pagination style="margin-top:10px" background layout="prev, pager, next" :total="1000" /> -->
</div>
<div class="analysisResults" style="margin-top: 20px">
<span style="font-weight: bold;font-size: 18px;color: #3596EB;display: block;">分析结果</span>
<el-button @click="upLoad"></el-button>
<el-button @click="upLoad" v-if="showChart"></el-button>
<el-table :data="tableData3" row-key="TSuid" style="width: 94%;margin-top:10px" :header-cell-style="headerCellStyle" height="350">
<el-table-column v-for="column in tableLabel" :key="column.prop" :prop="column.prop" :label="column.label" align="center"/>
</el-table>
<el-pagination style="margin-top:10px" background layout="prev, pager, next" :total="1000" />
<!-- <el-pagination style="margin-top:10px" background layout="prev, pager, next" :total="1000" /> -->
</div>
<div style="margin-top:20px;gap:25px;display: flex;" v-show="showChart">
<div class="pdfRef" id="pdfRef" style="margin-top:20px;gap:25px;display: flex;" v-show="showChart">
<!-- <img src="../../../assets/images/图1.png" alt=""> -->
<div style="background:#FFFFFF;">
<div id="main" style="width: 500px;height: 500px;"></div>
@ -176,24 +176,28 @@
<pop-model
:showModel="runResultShow"
title="运行结果"
title="聚类分析"
@closePop="runResultShow = false"
width="960"
@submit="runResultShow = false"
>
<template v-slot:content>
<div
v-html="
`<p>0 &nbsp; &nbsp;23364</p><p>1 &nbsp; &nbsp; 6636</p><p >Name: default.payment.next.month, dtype: int64</p>`
"
></div>
<div>
<p style="font-weight: 700;font-size:22px">聚类分析的定义及原理</p><p style="font-size:19px">1.定义</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;所谓物以类聚人以群分聚类分析即是基于研究对象的特征将他们分门别类以让同类别的个体之间差异相对小相似度相对大不同类别之间的个体差异大相似度小<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;聚类分析是一种探索性分析方法与判别分析不同聚类分析事先并不知道分类的标准甚至不知道应该分成几类而是会根据样本数据的特征自动进行分类</p><img src="@/assets/images/f1001.png" />
<p>聚类与分类的不同在于聚类所要求划分的类是未知的</p><img src="@/assets/images/f1002.png" /><img src="@/assets/images/f1003.png" /><img src="@/assets/images/f1005.png" /><p style="font-size:19px">2.原理</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;假定研究对象均用所谓的来表示<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在聚类分析中一般的规则是将距离较小的点归为同一类距离较大的点归为不同的类常见的是对个案分类也可以对变量分类但对于变量分类此时一般使用相似系数作为距离测量指标<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;一般的规则</p><img src="@/assets/images/f10010.png" /><br /><img src="@/assets/images/f10011.png" />
<br /><img src="@/assets/images/f10012.png" /><p style="font-weight: 700;font-size:22px">聚类方法及其在SPSS中的实现</p><p style="font-size:19px">1.主要的聚类方法</p><img src="@/assets/images/f10013.png" /><p style="font-size:19px">2.方法详解</p><p style="font-size:17px">1K-means聚类</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;又称为快速聚类K-Means Cluster是在聚类的类别数已确定的情况下快速将其他个案归类到相应的类别适合大样本数据的聚类<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;具体步骤如下</p><img src="@/assets/images/f10014.png" /><img src="@/assets/images/f10015.png" /><p>距离计算规则欧几里得距离公式</p><img src="@/assets/images/f10016.png" /><p>图解</p><img src="@/assets/images/f10017.png" /><img src="@/assets/images/f10018.png" />
<p>K-means的优缺点<br />优势<br /> 1原理比较简单实现也很容易收敛速度快<br /> 2在对大规模数据集进行聚类分析时算法聚类较高效且聚类效果较好<br /> 3簇与簇之间区别明显时它的聚类效果很好<br />不足<br /> 1分类数从初始分类开始就确定不变了所以要求事先要对样本有足够的了解<br />2仅限于个案间的聚类Q型聚类不能对变量进行聚类<br /> 3个案间的距离的测量方法使用的是欧式距离的平方因此只能对连续变量进行聚类<br />案例分析SPSS<br />通过查询整理出了2018年我国各省份的20项基本情况根据这些指标把这31个省市或地区分成3类</p><img src="@/assets/images/f10019.png" /><p> 分析步骤分析>>分类>>K-均值聚类>>迭代>>次数>>选项>>勾选统计>>确认</p><img src="@/assets/images/f10020.png" /><img src="@/assets/images/f10021.png" /><p>结果分析</p>
<img src="@/assets/images/f10022.png" /><img src="@/assets/images/f10023.png" /><p>若不收敛则调大迭代次数</p><img src="@/assets/images/f10024.png" /><p>方差分析表</p><img src="@/assets/images/f10025.png" /><p> 其中聚类均方对应组间均方差误差均方对应组内均方差显著性p&lt;0.05时说明此变量分类效果好由表可知大部分变量的p&lt;0.05,且组间均方差大于组内均方差说明各变量在三个类别中的差异大分类结果可信度高</p><img src="@/assets/images/f10026.png" /><br /><img src="@/assets/images/10027.png" /><p>聚类结果解读</p>
<div class="table-box"><table cellspacing="0" style="width:355pt;"><tbody><tr><td style="text-align:center;vertical-align:middle;width:355pt;"> <p style="margin-left:0in;text-align:center;"><strong>第一类</strong><strong>1</strong><strong>个省份广东省经济发达</strong></p> </td></tr><tr><td style="background-color:#e7e7e7;text-align:center;vertical-align:middle;width:355pt;"> <p style="margin-left:0in;text-align:center;"><strong>第二类</strong><strong>19</strong><strong>个省份云南西藏等地区经济一般</strong></p> </td></tr><tr><td style="text-align:center;vertical-align:middle;width:355pt;"> <p style="margin-left:0in;text-align:center;"><strong>第三类</strong><strong>11</strong><strong>个省份上海北京等地区经济较发达</strong></p> </td></tr></tbody></table></div>
</div>
</template>
</pop-model>
</template>
<script setup>
import popModel from "@/views/components/popModel.vue";
import popModel from "@/views/components/popModal.vue";
import {htmlPdf} from "@/utils/pdf.js"
import * as echarts from 'echarts';
import * as XLSX from 'xlsx'
import JSZip from 'jszip';
import ecStat from 'echarts-stat';
import * as API from '@/api/AI.js'
import { getUserInfo } from "@/utils/auth";
@ -204,6 +208,10 @@ const { proxy } = getCurrentInstance()
const tableLabel=reactive([
{prop:'date',label:''},
])
const isFlag=ref(false)
const algorithmicKnowledge=()=>{
runResultShow.value = true
}
const getList=()=>{
API.selectionMetrics({userId:JSON.parse(getUserInfo()).userId}).then((res)=>{
res.data.forEach(element => {
@ -214,7 +222,6 @@ const { proxy } = getCurrentInstance()
})
})
}
const showChart=ref(false)
const scrollbar = ref(null);
const fileList=ref([])
const handleChange=(info)=>{
@ -394,6 +401,7 @@ const resTable2=ref()
}
}
const showChart=ref(false)
//
const nowData=ref([])
const computation=()=>{
@ -473,25 +481,23 @@ const nowData=ref([])
});
}
}
const exportTableRef = ref(null);
const upLoad=()=>{
const formData={
field:tableLabel.map(item=>item.label).join(','),
lists:nowData.value
}
// const formBody = Object.keys(formData)
// .map(key => encodeURIComponent(key) + '=' + encodeURIComponent(formData[key]))
// .join('&');
// fetch('http://192.168.2.28:9868/api/analysis/cAMExport', {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded'
// },
// body: formBody
// })
API.downloadClusterAnalysisForm(formData).then(()=>{
})
const tableDom = exportTableRef.value?.$el;
if (!tableDom) {
return;
}
const wb = XLSX.utils.table_to_book(tableDom);
// XLSX.writeFile(wb, '.xlsx');
const zip = new JSZip();
const excelBlob = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
zip.file('聚类分析.xlsx', new Blob([excelBlob], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }));
zip.file('聚类分析图表.pdf', handleExport());
zip.generateAsync({ type: 'blob' }).then((content) => {
saveAs(content, '聚类分析.zip');
});
}
const startOver=()=>{
myChart.setOption({
series: [
@ -520,6 +526,13 @@ const nowData=ref([])
tableLabel.length=0
nowData.value=[]
}
//pdf
const handleExport = async(name) => {
var fileName= '聚类分析图表'
const fileList = document.getElementsByClassName('pdfRef') //
const pdfBlob = await htmlPdf(fileName, document.querySelector('#pdfRef'), fileList,true)
return pdfBlob
}
</script>
<style lang="scss" scoped>
@ -681,34 +694,3 @@ const nowData=ref([])
}
}
</style>
<style lang="scss">
.dialogClass{
background:url('../../../assets/images/弹框.png') !important;
background-size: 100% 100% !important;
.el-dialog__header{
padding: 5px 0px;
margin-right: 5px !important;
.gbImg{
cursor: pointer;
width: 51px;
height: 31px;
background-size: 100% 100%;
}
}
.xtImg{
margin-left: 18px;
width: 530px;
}
}
.my-header {
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 16px;
text-align: center;
span{
color: #FFFFFF;
padding: 38px 20px 0;
}
}
</style>

@ -154,6 +154,39 @@
</div>
</template>
</el-dialog>
<pop-model
:showModel="runResultShow"
title="关联规则挖掘"
@closePop="runResultShow = false"
>
<template v-slot:content>
<div>
<p style="font-weight: 700;font-size:22px">什么是描述性统计分析</p><p>描述性统计分析是数据分析的一种方法旨在对数据进行总结和描述以便更好地理解数据的特征和趋势它主要通过统计指标和图表来呈现数据的基本特征包括中心趋势离散程度分布形态等<br />常用的描述性统计指标包括</p><li>中心趋势用于描述数据集的集中程度常见的指标有均值中位数和众数</li><li>离散程度用于描述数据的分散程度常见的指标有方差标准差和极差</li><li>分布形态用于描述数据的分布形态常见的指标有偏度和峰度</li><p>描述性统计分析还可以通过图表来展示数据的特征常见的图表包括</p>
<li>频数分布表和直方图用于展示数据的分布情况可以观察数据的集中程度和离散程度</li><li>箱线图用于展示数据的分布情况和离群值可以观察数据的中位数四分位数和异常值</li><li>散点图用于展示两个变量之间的关系可以观察数据的相关性和趋势</li><p>描述性统计分析可以帮助我们对数据有一个直观的了解发现数据中的规律和异常情况为后续的数据分析和决策提供基础</p><p style="font-size:19px;font-weight:600">描述性统计分析的优势和局限性</p><p>描述性统计分析的优势和局限性如下<br />优势</p><li>简单易懂描述性统计分析使用简单的统计指标和图表可以直观地呈现数据的特征使人们更容易理解和解释数据</li>
<li>提供概览通过描述性统计分析可以获得数据的整体概览包括数据的中心趋势如均值中位数数据的分布情况如标准差百分位数</li><li>发现异常值描述性统计分析可以帮助我们发现数据中的异常值或离群点从而帮助我们识别数据质量问题或异常情况</li><p>局限性</p><li>缺乏深入分析描述性统计分析主要关注数据的基本特征无法深入挖掘数据背后的关联和因果关系</li><li>无法进行推断描述性统计分析只是对已有数据的总结和描述并不能进行推断或预测</li><li>受数据限制描述性统计分析的结果受到数据本身的限制如果数据质量不好或数据量较小可能会导致结果不准确或不可靠</li><p>综上所述描述性统计分析是数据分析的重要工具可以帮助我们了解数据的基本特征和趋势但在深入分析和推断方面有一定的局限性</p>
<p style="font-size:19px;font-weight:600">描述性统计分析的常用方法</p><p>描述性统计分析是对数据进行总结和描述的过程常用的方法包括</p><li>中心趋势度量包括均值mean中位数median和众数mode用于描述数据的集中程度</li><li>离散程度度量包括方差variance标准差standard deviation和极差range用于描述数据的离散程度</li><li>分布形状度量包括偏度skewness和峰度kurtosis用于描述数据的分布形状</li><li>频数统计通过频数表频率分布表和直方图等方式统计数据的频数和频率</li><li>百分位数用于描述数据中某个特定百分比的位置如中位数四分位数等</li><li>相关性分析通过计算相关系数如Pearson相关系数来衡量两个变量之间的相关性</li>
<p style="font-size:19px;font-weight:600">描述性统计分析的应用场景</p><p>描述性统计分析在许多领域和应用场景中都有重要的作用以下是一些常见的应用场景</p><li>提供概览描述性统计分析可以提供数据的概览帮助我们了解数据的整体特征和规律通过计算中心趋势测量如均值中位数众数离散程度测量如方差标准差极差和分布形态测量如偏度峰度我们可以得到数据的集中趋势离散程度和分布形态等信息</li><li>数据比较描述性统计分析可以帮助我们比较不同组或不同时间点的数据通过比较不同组的中心趋势离散程度和分布形态等我们可以了解不同组之间的差异和相似之处从而得出结论或提出假设</li><li>发现异常值描述性统计分析可以帮助我们发现数据中的异常值通过观察离群点如极端值和异常值如异常观测值我们可以发现数据中的异常情况进而进行进一步的分析和处理</li>
<li>数据可视化描述性统计分析可以通过可视化方法如直方图散点图箱线图等将数据转化为图形使得数据更加直观和易于理解数据可视化可以帮助我们发现数据的分布模式趋势和关联关系从而更好地理解数据</li><li>数据摘要描述性统计分析可以通过频数和频率分布表百分位数等方式对数据进行摘要和概括这些摘要信息可以帮助我们对数据进行快速的了解和比较从而支持后续的决策和分析</li><li>假设检验描述性统计分析可以为假设检验提供依据通过对样本数据的描述性统计分析我们可以判断样本数据是否符合某种假设分布从而进行假设检验</li><li>数据报告和展示描述性统计分析可以提供数据的概括性描述用于撰写数据报告和展示帮助他人更好地理解数据的特征和趋势</li><li>数据清洗描述性统计分析可以帮助我们发现数据中的问题和错误通过观察数据的分布情况和异常值我们可以判断数据的质量并进行必要的数据清洗和修正</li>
<li>数据探索描述性统计分析是探索性数据分析的一部分它可以帮助我们发现数据中的模式关联和趋势通过观察数据的分布散点图相关系数等我们可以发现数据中的隐藏信息和规律</li><li>决策支持描述性统计分析可以为决策提供支持通过对数据的摘要和可视化我们可以获取有关数据的重要信息帮助决策者做出基于数据的决策</li><p style="font-size:19px;font-weight:600">如何进行描述性统计分析</p><p>开展描述性统计分析可以按照以下步骤进行</p><li>收集数据首先需要收集所需的数据可以是通过调查问卷实验观察或从现有数据源获取</li><li>数据清洗对收集到的数据进行清洗包括处理缺失值异常值和错误数据等</li><li>描述性统计使用统计方法计算数据的基本统计量如平均值中位数标准差等以了解数据的集中趋势离散程度和分布情况</li><li>可视化展示将统计结果以图表的形式进行可视化展示如直方图箱线图散点图等以更直观地呈现数据的特征和趋势</li>
<li>解读分析结果根据统计分析的结果解读数据的含义和趋势提取有用的信息和洞察并进行合理的解释和推断</li><p style="font-size:19px;font-weight:600">描述性统计分析的注意事项</p><p>在进行描述性统计分析时有以下几个注意事项</p><li>数据质量确保数据的准确性和完整性进行数据清洗处理缺失值异常值和重复值等以保证分析结果的可靠性</li><li>数据类型根据数据的类型选择合适的统计方法和图表对于定量数据可以使用均值标准差等统计量对于定性数据可以使用频数和百分比等统计量</li><li>样本大小考虑样本大小对统计结果的影响样本较小可能导致统计结果不够准确而样本较大可能会增加计算复杂度</li><li>数据分布了解数据的分布情况选择合适的统计方法和图表例如对于正态分布的数据可以使用均值和标准差进行描述对于偏态分布的数据可以使用中位数和四分位数等进行描述</li><li>上下文和目的考虑数据分析的上下文和目的根据具体的问题和需求选择合适的统计方法和图表以便更好地解读数据和提取有价值的信息</li>
<li>解读和推断描述性统计分析主要是对数据进行概括和描述不能进行推断和因果分析在解读结果时要注意避免过度解读和误导</li><li>可视化呈现使用合适的图表和图形将数据可视化以便更好地传达数据的特征和趋势选择简洁明了的图表避免图表过于复杂和混乱</li>
</div>
<!-- 情感分析 -->
<!-- <div>
<p style="font-weight: 700;font-size:22px">总览</p><p>文本分析指对文本数据进行表示 (representation)处理(processing)和建模(modeling)来获得有用的见解(insight)<br />文本分析的一个挑战是高维度(high dimensionality)<br /><br />语料库: 指在自然语言处理中用于各种目的的大量文本(文档)集合<br /><br />另一个挑战是: 大多数情况下文本是非结构化数据(not structured)</p><img src="@/assets/images/f4001.png" alt=""><p style="font-weight: 700;font-size:22px">文本分析步骤</p><p>&nbsp;&nbsp;&nbsp;&nbsp;1.句法分析(Parsing): 是指处理非结构化文本使其具有一定的结构供将来分析的过程句法分析将文本进行解构然后以一种更为结构化的方式来呈现(unsturctured -> sturctured)<br />&nbsp;&nbsp;&nbsp;&nbsp;2.搜索和检索 (Search and retrieval): 在一个语料库中识别包含例如特殊单词短语主题或者实体(如人或组织)等搜索项(search items)的文档这些搜索项通常称为关键术语 (key term)<br />&nbsp;&nbsp;&nbsp;&nbsp;3.文本挖掘 (text mining): 指使用前两步产生的术语和索引来发现与感兴趣领域或问题相关的有意义的见解(discover meaningful insights)<br />聚类(clustering) 分类 (classification) 都可以应用于文本挖掘比如将文档聚化成簇 或者 分类文本以进行情感分析(sentiment analysis)<br />文本挖掘可以利用来自各个研究领域的方法和技术如统计分析(statistical analysis)信息检索(information retrieval)数据挖掘(data mining)和自然语言处理(natural language processing)</p>
<p style="font-weight: 700;font-size:22px">挑战</p><li>语法(syntax): 涉及句子结构和语法规则</li><li>语义(semantics): 是对句子含义的研究</li><li>语用(pragmatic): 关注特定上下文中句子的含义</li><li>同义词(homonyms): 具有相同拼写但含义不同的单词</li><li>缩写词(acronyms): 是单词的缩写形式</li><p>对于计算机来说文本只是编码和数字的字符序列(sequence of characters)它不了解语法语义(semantic meanings)和其实用含义(pragmatic meaning)<br />同时在原始形式中单词或者文本之间没有自然相似性度量(nature similarity metric)(因此难以执行聚类或分类)<br />因此我们需要以适合用于聚类和分类的形式来表示和处理文本</p><p style="font-weight: 700;font-size:22px">第一步收集原始文本数据(Collecting Raw Text)</p><p>对于文本分析来说进行任何事情之前必须先收集数据</p>
<li>可以在许多网站上对用户生成的内容(user-generated contents)开始积极的监控可以使用公开的API, 网页爬虫 web scraper/crawler</li><li>准备处理非结构化或者半结构化数据</li><p style="font-weight: 700;font-size:22px">第二步表示文本 (Representing Text)</p><p>使用文本规范化的技术(text normalization techniques)对原始文本进行转化</p><li>分词 (tokenization): 指从文本正文中分离(也叫做标记)单词 (seperating words)</li><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.按空格(spaces)来分词(可能会把标点符号也给分出来比如 day. )<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.基于标点符号和空格来分词 (可能会把 well, cant, state-of-the-art 等直接分开)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;分词比想象中更困难 (résumé resume)<br />没有一个分词器适用于每一种情形(no one-size-fits-all)</p><li>大小写转换 (case folding): 将所有的字母都变成小写(或者都变成大写)</li>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.但是在一些情况下可能会出错: 如专有名词缩写公司名等(General Motors; WHO; US;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.减少错误的方法是对不进行大小写转换的单词建立一个查找表(lookup table)</p><li>停止词(stop word): 在给定语言中并非所有的单词都需要被考虑(比如the, a, of, and, to等这些不太可能有助于语义的理解)</li><li>词根法(Lemmatization)和词干法(Stemming): 词根法看单词的意义(: Goose, geese, goose, gander, ganders)词干法看单词的组成(walk, walking, Walk, walks, walked)最受欢迎的是"Porter stemmer", WordNet</li><li>词袋法(Bag-of-words representation): 将文档转化成高维向量(high-dimensional vector)向量指示了文档中各个单词的 存在/不存在/出现频率(presence/absence/frequency)</li><img src="@/assets/images/f4002.png" alt=""><p>词袋法足够简单(朴素且过分简化问题 naive and over-simplified) 并被广泛应用于文本分析问题中 (是入门的好方法)其将文档表示为一组词语(单词)而忽略了其他信息(如顺序 order上下文 context推论 inferences和语义 semantics)比如a dog bites a man "a man bites a dog"意思完全不同但是他们在词袋法里是同一种表示</p>
<li>语料库的表示(Representation of a corpus): 语料库可以大到包括一种或者多种语言的所有文档也可以小到仅限于特定领域(focused on a specific domains)</li><p>大多数语料库都具有元数据比如语料库的大小以及文本提取的领域某些语料库包含了文本中出现的每个词的信息内容(Information content, IC)信息内容是用来表示语料库中词语重要性(importance of a term)的度量IC值较高的词语的重要性要比IC值较低的词语高<br />然而信息内容无法满足分析动态改变的非结构化数据的需求问题传统语料库和IC元数据都无法随着时间改变因此任何语料库中不存在的词汇和任何新发明的词汇都会自动得到0的IC值其次传统语料库限制了用于文本分析算法 (text analysis algorithm) 的全部知识(语料库代表了整个知识库)</p><p style="font-weight: 700;font-size:22px">第三步词频-逆文档频率(TFIDF - Term Frequency - Inverse Document Frequency)</p><p style="font-weight: 600;font-size:18px">词频 (Term Frequency)</p><p>我们需要一个适应文本上下文(context)和性质(nature)的度量标准 metric (不像IC一样)<br />TFIDF直接作用于所有获取的文档(fetched documents)一旦获取的文档发生更改TFIDF可以被轻松更新TFIDF是一种广泛用于文本分析的措施TFIDF对动态内容的处理也是相当强大且有效的因为文档的变化只需要更新频率计数<br />
给定一个单词 t 以及一个包含 n 个词的文档 d = {t1, t2, , tn} d t 最简单的词频形式可以定义为 t d 中出现的次数</p><img src="@/assets/images/f4003.png" alt=""><p>可以对词频函数取对数以获得更多数据细节</p><img src="@/assets/images/f4005.png" alt=""><p>对于长文档因为其包含的词语数量和种类多因此往往有更高的词频值这些因素导致了长文档的词频值的提升以至于人们对长文档产生了偏见为了解决这个问题可以对词频进行规范化</p><img src="@/assets/images/f4006.png" alt=""><p>Zipfs Law i 个最常见的单词出现在最常见词的 1/i </p><p style="font-weight: 600;font-size:18px">Term Frequency 问题</p><p>词语的重要性仅取决于其在特定文档中的存在如果该词语频繁出现在每个文档中怎么办这个词还重要吗我们需要拓宽我们的视野不仅要在单个文档中而是要在整个语料库中考虑一个词语的重要性</p><p style="font-weight: 600;font-size:18px">词语的文档频率 (Document Frequency of a term)</p><p>文档频率被定义为语料库中包含一个词语的文档的数目假设语料库D包含N个文档语料库D={d1, d2, , dn}中词语 t 的文档频率的定义为</p><img src="@/assets/images/f4007.png" alt=""><p style="font-weight: 600;font-size:18px">逆文档频率 (Inverse Document Frequency)</p><p>逆文档频率的定义N代表了语料库的总文档数DF(t) 代表单词 t 的文档频率逆文档频率就是他们的商取对数得到</p>
<img src="@/assets/images/f4008.png" alt=""><p>如果词语不在语料库内会导致分母为零快速解决的方法是在分母上加个1</p><img src="@/assets/images/f4009.png" alt=""><p>拥有较高IDF的词往往在整个语料库中更重要罕见单词的IDF会很高高频单词的IDF会很低<br />警告因为语料库中所有文档数目(N)是保持恒定的因此IDF仅取决于DF那些DF值最低的词获得相同的最高IDF因此有必要引入更多权重词来对文档中出现次数相同的词进行区分</p><p style="font-weight: 600;font-size:18px">TFIDF</p><p>是一种既考虑词在单个文档中的普及率 prevalence (TF)也考虑他在整个语料库中的稀缺程度 scarcity (IDF)的评估方法词语 t 在文档 d 中的TFIDF 定义为 d t 的词频 乘以语料库中 t 的文档频率如下公式</p><img src="@/assets/images/f4010.png" alt=""><p>一个词的TFIDF值越高它在一个文档中出现的就越频繁但在语料库的所有文档中出现得就越少<br />TFIDF在简单和直接的计算中是很有效的因为它不需要文本含义的相关知识文档 d 被表示为 TFIDF(t, d) 的高维向量 (high-dimensional vector)<br /><br />TFIDF方法减少描述长度的数量相对较少同时其很难揭示文档内或文档之间(intra-document or inter-document)的统计结构<br />主题建模(Topic Modelling)能够解决这个问题主题(topic): 经常在一起出现的具有相关含义的单词簇(a cluster of words)每个词在主题中都有权重</p>
<p style="font-weight: 700;font-size:22px">第四步主题建模(Topic Modelling)</p><p>主题建模提供了文档的简短描述同时它也提供了自动组织搜索理解并汇总大量信息的工具主题建模是统计模型它研究一组文档中的单词确定文档主题并发现主题是如何相关(associated)或者如何随时间变化的(change over time)</p><p style="font-weight: 600;font-size:18px">流程</p><p>&nbsp;&nbsp;&nbsp;&nbsp;1.揭开(uncover)语料库中隐藏的主题模式(hidden topical patterns)<br />&nbsp;&nbsp;&nbsp;&nbsp;2.根据这些主题来注释文档(annotate document)<br />&nbsp;&nbsp;&nbsp;&nbsp;3.使用注释来组织搜索汇总文档(organize, search, summarise)</p><p style="font-weight: 600;font-size:18px">主题(topic)</p><p>一个主题被正式定义为固定单词词汇分布(a distribution over a fixed vocabulary of words)不同的主题在相同的词汇上会有不同的分布词汇中的某个词可以在多个主题中有不同的权重<br />一个文档通常由多个主题以不同的比例贯穿文本</p><p style="font-weight: 600;font-size:18px">LDA</p><p>最简单的主题模型是Latent Dirichlet Allocation(LDA)这是一个语料库的生成概率模型(generative probabilistic model of a corpus)在生成概率模型中从概率密度函数 (probability density function) 得出模型观测值 (model observation)在LDA中文档被视为生成过程 (generative process) 的结果(带有隐藏变量 hidden variables)<br />LDA假设了<br /></p><li>有一个固定的词汇表 (fixed vocabulary of words)</li>
<li>潜在主题 (latent topics) 的数目是预定义的</li><li>每个潜在主题的特征都是词汇表中单词的分布(Dirichlet distribution)</li><li>每个文档表示潜在主题的一个随机混合(random mixture)</li><p style="font-weight: 600;font-size:18px">LDA流程</p><p>&nbsp;&nbsp;&nbsp;&nbsp;1.选择文档的长度N<br />&nbsp;&nbsp;&nbsp;&nbsp;2.每个文档有一个在主题上的分布<br />&nbsp;&nbsp;&nbsp;&nbsp;3.为文档中的每个词分配一个主题并选择相应的主题中的单词<br /><br />在现实中只有文档是可用(available)LDA的目标是为每一个文档推断潜在的主题(underlying topic)主题比例 (topic proportion) 以及主题分配 (topic assignment)</p><p style="font-weight: 600;font-size:18px">算法</p><p>&nbsp;&nbsp;&nbsp;&nbsp;1.选择一个值 k<br />&nbsp;&nbsp;&nbsp;&nbsp;2.对于每个文档将文档中的每个单词随机分配给k个主题之一<br />&nbsp;&nbsp;&nbsp;&nbsp;对于每个文档 d遍历每个单词 w然后计算 d 中分配给主题 t 的单词所占的比例通常会应用平滑(smoothing)处理</p><img src="@/assets/images/f4011.png" alt=""><p>&nbsp;&nbsp;&nbsp;&nbsp;4.计算从单词w来的所有文档中对主题 t 的分配比例 P(w | t)<br />&nbsp;&nbsp;&nbsp;&nbsp;5.计算属于主题 t 的单词 w 的概率</p><img src="@/assets/images/f4012.png" alt=""> <p style="font-weight: 600;font-size:18px">注意事项</p> <p>LDA将文档视为主题的混合体<br />LDA将主题视为单词的混合体<br />如果单词 w 很有可能出现在主题 t 则所有带有 w 的文档将与主题 t 的关联更为紧密<br />
如果单词 w 不太可能出现在主题 t 则包含 w 的文档出现在 t 中的可能性将会很小因为文档 d 中剩余的单词将出现在其他主题中因此 d 有更高的可能性属于那些主题因此就算我们将 w 添加到 t 也不会将很多该类文档带到 t </p><p style="font-weight: 600;font-size:18px">应用</p><p>主题模型可以被用于文档建模(document modelling)文档分类(document classification)与协同过滤(collaborative filtering)<br />主题模型不仅可以应用于文本数据它还可以用于注释图像</p><p style="font-weight: 700;font-size:22px">情感分析 (Sentiment Analysis)</p><p>情感分析使用统计和自然语言处理来从文本中挖掘观点来识别并抽取主观信息<br />应用 检测产品或者电影的评论的极性(polarity of reviews)<br /><br />分析层面包括了文档层面(document)语句层面(sentence)短语层面(phrase)和短文层面(short-text)<br /><br />分类方法(朴素贝叶斯最大熵或者支持向量机SVM) 经常被用来提取语料库统计以用于情感分析</p><img src="@/assets/images/f4013.png" alt=""><p>分类器仅基于对其进行训练的数据集来确定情感</p><li>词义随着领域不同而改变</li><li>因此模型无法直接应用于其他领域</li><p>绝对的情感水平无法提供信息应该建立一条基线然后将其与观察值比较比如一个产品拥有40%正面推文60%负面推文貌似是不成功的但是如果其他类似的成功产品也有类似的正负面百分比那么不应该认为该产品是不成功的<br /><br />如何对大量评论添加标签(积极消极中立):<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;1.使用表情符号 (小心阴阳怪气)<br />
&nbsp;&nbsp;&nbsp;&nbsp;2.使用 Amazon Mechanical Turk 互联网众包市场将上标签工作外包出去</p><p style="font-weight: 700;font-size:22px">获得结果(gaining insights)</p><p style="font-weight: 600;font-size:18px">词云(word cloud)</p><p>五星好评的词云</p><img src="@/assets/images/f4015.png" alt=""><p>一星差评的词云</p><img src="@/assets/images/f4016.png" alt=""><p>TFIDF能够用来凸显评论中有信息量的单词</p> <img src="@/assets/images/f4017.png" alt=""><p>LDA可以把评论归类为主题圆盘的大小代表了词的权重</p><img src="@/assets/images/f4018.png" alt=""><p>另一种可视化方式</p><img src="@/assets/images/f4019.png" alt="">
</div> -->
</template>
</pop-model>
</template>
<script setup>
import * as portraitModel from "@/api/portraitModel";
@ -163,6 +196,7 @@ import * as marketingAlgorithmApi from "@/api/marketing-algorithm.js";
import useAlgorithmStore from "@/store/modules/algorithm.js";
import useUserStore from "@/store/modules/user";
import { getUserInfo } from "@/utils/auth";
import popModel from "@/views/components/popModal.vue";
const userInfo = JSON.parse(getUserInfo());
const loading = ref(false);
const { proxy } = getCurrentInstance();
@ -170,6 +204,7 @@ const userStore = useUserStore();
const algorithmStore = useAlgorithmStore();
const multipleTableRef = ref(null);
const b_introductionOfAlgorithmKnowledge = ref(false);
const runResultShow=ref(false)
const n_dataTableQuery = ref({
index: 1,
size: 5,
@ -358,7 +393,7 @@ const getIndicator = () => {
};
//
const knowledgeImport = () => {
b_introductionOfAlgorithmKnowledge.value = true;
runResultShow.value=true
};
//
const submitTask = () => {
@ -587,37 +622,3 @@ const download = () => {
margin-bottom: 20px;
}
</style>
<style lang="scss">
.el-dialog {
background: url("../../../assets/images/弹框.png") !important;
background-size: 100% 100% !important;
.el-dialog__header {
padding: 5px 0px;
margin-right: 5px !important;
.gbImg {
cursor: pointer;
width: 51px;
height: 31px;
background-size: 100% 100%;
}
}
.xtImg {
margin-left: 18px;
width: 530px;
}
}
.my-header {
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 16px;
text-align: center;
span {
color: #ffffff;
padding: 38px 20px 0;
}
}
.el-table__body-wrapper {
// background: #020620 !important;
}
</style>

@ -5,20 +5,7 @@
<p style="font-weight: 400;font-size: 12px;color: #E6E6E6;">给出任务清单参考做哪些数据的统计分析Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar sic tempor. Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus pronin sapien nunc accuan eget.</p>
</div>
<div class="main-but">
<el-upload
ref="uploadRef"
class="upload-demo"
:file-list="fileList"
:auto-upload="false"
:on-change="handleChange"
:show-file-list="false"
multiple="multiple"
>
<template #trigger>
<el-button><img src="../../../assets/images/导入.png" alt="">算法知识导入</el-button>
</template>
<!-- <div class="reportPromptFile" v-html="item[`${index}`].path"></div> -->
</el-upload>
<el-button @click="runResultShow=true"><img src="../../../assets/images/导入.png" alt="">算法知识导入</el-button>
<el-button @click="taskSubmit"><img src="../../../assets/images/提交.png" alt="">实训任务提交</el-button>
</div>
<div class="app-main">
@ -133,8 +120,8 @@
</div>
<div class="analysisResults" style="margin-top: 20px">
<span style="font-weight: bold;font-size: 18px;color: #3596EB;display: block;">分析结果</span>
<el-button class="imgBtn">下载</el-button>
<el-table :data="tableData3" row-key="TSuid" style="width: 94%;margin-top:10px" :header-cell-style="headerCellStyle" height="350">
<el-button class="imgBtn" v-if="flagUP" @click="upLoad"></el-button>
<el-table :data="tableData3" ref="exportTableRef" row-key="TSuid" style="width: 94%;margin-top:10px" :header-cell-style="headerCellStyle" height="350">
<el-table-column v-for="column in tableLabel2" :key="column.prop" :prop="column.prop" :label="column.label" align="center"/>
<el-table-column v-if="flagColumn" label="预测" align="center">
<template #default="scope">
@ -224,18 +211,41 @@
</div>
</template>
</el-dialog>
<pop-model
:showModel="runResultShow"
title="关联规则挖掘"
@closePop="runResultShow = false"
>
<template v-slot:content>
<div>
<p style="font-weight: 700;font-size:22px">变量间的关系的度量</p><p style="font-size:19px;font-weight:600">变量间的关系</p><li>函数关系设有两个x和yy随x一起变化并完全依赖于xy是x的函数y = f ( x ) y = f(x)y=f(x)x为自变量y为因变量</li><li>相关关系变量之前存在的不确定的关系称为相关关系</li><p>&nbsp;&nbsp;&nbsp;1.一个变量的取值不能由另一个变量唯一确定<br />&nbsp;&nbsp;&nbsp;2.当变量x 取某个值时变量y 的取值对应着一个分布<br />&nbsp;&nbsp;&nbsp;3.各观测点分布在直线周围</p><p style="font-size:19px;font-weight:600">相关关系的描述与测量</p><li>散点图可以通过散点图判断两个变量之间有无相关关系并对变量间的关系形态做出大致的描述</li><img src="@/assets/images/f3001.png" alt="">
<li>相关系数是度量变量之间线性关系强度的一个统计量</li><p>若相关系数是根据总体全部数据计算的称为总体相关系数记为ρ<br />若是根据样本数据计算的则称为样本相关系数简称为相关系数记为 r rr也称为Pearson \textbf{Pearson}Pearson相关系数或者线性相关系数</p><img src="@/assets/images/f3002.png" alt=""><br /><p>相关系数r rr 的性质<br />&nbsp;&nbsp;&nbsp;r 的取值范围为 [ 0 , 1 ] [0,1][0,1];</p><img src="@/assets/images/f3003.png" alt=""><p>&nbsp;&nbsp;&nbsp;r 具有对称性即x与y之间的相关系数和y与x之间的相关系数相等即r x y = r y x r_{xy}= r_{yx}r <br />&nbsp;&nbsp;&nbsp;r 数值大小与x和y原点及尺度无关即改变x和y的数据原点及计量尺度并不改变r数值大小<br />&nbsp;&nbsp;&nbsp;r 仅仅是x与y之间线性关系的一个度量它不能用于描述非线性关系这意味着 r=0只表示两个变量之间不存在线性相关关系并不说明变量之间没有任何关系
&nbsp;&nbsp;&nbsp;r 虽然是两个变量之间线性关系的一个度量却不一定意味着x与y一定有因果关系</p><img src="@/assets/images/f3005.png" alt="" /><p style="font-size:19px;font-weight:600">相关关系的显著性检验</p><p>检验两个变量之间是否存在线性相关关系通常将 r rr 作为 ρ ρρ 的估计值<br />&nbsp;&nbsp;&nbsp;r 的抽样分布不写<br />&nbsp;&nbsp;&nbsp;r 的显著性检验</p><img src="@/assets/images/f3006.png" alt=""><p style="font-size:19px;font-weight:600">一元线性回归的估计和检验</p><li>相关分析目的在于用相关系数测度变量之间的关系强度</li><li>而回归分析侧重于考察变量之间的数量关系并通过一定的数学表达式将这种关系描述出来从而确定一个或几个变量自变量的变化对另一个特定变量因变量的影响程度具体来说回归分析具体解决以下几个方面的问题</li><p>&nbsp;&nbsp;&nbsp;1.从一组样本数据出发确定变量之间的数学关系式<br />&nbsp;&nbsp;&nbsp;2.对这些关系式的可信程度进行各种统计检验并从影响因变量的诸多变量中找出哪些变量的影响是显著的哪些是不显著的<br />&nbsp;&nbsp;&nbsp;3.利用所求的关系式根据一个或几个自变量的取值来估计或预测因变量的取值并给出这种估计或预测的可靠程度</p><li>在回归分析中</li><p>被预测或被解释的变量称为因变量用y表示<br />用来预测或被解释的一个或多个变量称为自变量用x表示</p>
<p style="font-size:16px;font-weight:600">相关关系的显著性检验</p><p>检验两个变量之间是否存在线性相关关系通常将 r rr 作为 ρ ρρ 的估计值</p><img src="@/assets/images/f3007.png" alt="" /><p style="font-size:19px;font-weight:600">一元线性回归的估计和检验</p><li>相关分析目的在于用相关系数测度变量之间的关系强度</li><li>而回归分析侧重于考察变量之间的数量关系并通过一定的数学表达式将这种关系描述出来从而确定一个或几个变量自变量的变化对另一个特定变量因变量的影响程度具体来说回归分析具体解决以下几个方面的问题</li><p>&nbsp;&nbsp;&nbsp;1.从一组样本数据出发确定变量之间的数学关系式<br />&nbsp;&nbsp;&nbsp;2.对这些关系式的可信程度进行各种统计检验并从影响因变量的诸多变量中找出哪些变量的影响是显著的哪些是不显著的<br />&nbsp;&nbsp;&nbsp;3.利用所求的关系式根据一个或几个自变量的取值来估计或预测因变量的取值并给出这种估计或预测的可靠程度</p><li>在回归分析中</li>
<p>&nbsp;&nbsp;&nbsp;被预测或被解释的变量称为因变量用y表示<br />&nbsp;&nbsp;&nbsp;用来预测或被解释的一个或多个变量称为自变量用x表示</p><p style="font-size:19px;font-weight:600"> 一元线性回归模型</p><p>涉及一个自变量的回归</p><li>回归模型描述因变量y 如何依赖于自变量x 和误差项 ε εε 的方程称为回归模型一元线性回归模型可表示为</li><img src="@/assets/images/f3008.png" alt=""><li>上述模型称为理论回归模型对于这一模型有以下几个假定</li><p>&nbsp;&nbsp;&nbsp;1.因变量y与自变量x之间具有线性关系<br />&nbsp;&nbsp;&nbsp;2.在重复抽样中自变量x的取值是固定的即假定x是非随机的<br />&nbsp;&nbsp;&nbsp;3.对于满足</p><img src="@/assets/images/f3009.png" alt=""><li>回归方程 描述因变量y的期望值如何依赖于自变量x的方程称为回归方程一元线性回归方程的形式为</li>
<img src="@/assets/images/f3010.png" alt="" /><img src="@/assets/images/f3011.png" alt="" /><p style="font-size:19px;font-weight:600">参数的最小二乘估计</p><img src="@/assets/images/f3012.png" alt="" /><br /><img src="@/assets/images/f3013.png" alt="" /><br /><img src="@/assets/images/f3014.png" alt="" /><p style="font-size:19px;font-weight:600">回归直线的拟合优度</p><p>估计或预测的精度如何将取决于回归直线对观测数据的拟合程度各观测点越是紧密围绕直线说明对观测数据的拟合程度越好反之越差</p><img src="@/assets/images/f3015.png" alt=""><li>总平方和S S T SSTSST反映因变量的n 个观察值与其均值的总误差</li><img src="@/assets/images/f3016.png" alt=""><li>残差平方和又称误差平方和反映除x 以外的其他因素对y 取值的影响也称为不可解释的平方和或剩余平方和</li>
<img src="@/assets/images/f3017.png" alt="" /><li>回归平方和SSR反映自变量x 的变化对因变量y 取值变化的影响或者说是由于x 与y 之间的线性关系引起的y 的取值变化也称为可解释的平方和</li><img src="@/assets/images/f3018.png" alt="" /><li>三者的关系为</li><img src="@/assets/images/f3019.png" alt="" /><li>估计标准误差s<sub>e</sub>反映实际观察值在回归直线周围的分散状况是均方残差MSE的平方根</li><img src="@/assets/images/f3020.png" alt=""><p style="font-size:19px;font-weight:600">显著性检验</p><img src="@/assets/images/f3021.png" alt=""><img src="@/assets/images/f3022.png" alt=""><p style="font-size:19px;font-weight:600">利用回归方程进行预测</p><p style="font-size:16px;font-weight:600">平均值的置信区间</p><li>置信区间(confidence interval)利用估计的回归方程对于自变量x 的一个给定值x<sub>0</sub>求出因变量y yy的平均值的估计区间这一估计区间称为置信区间</li>
<p>比平均值的公式根号内多了个1而已</p><img src="@/assets/images/f3023.png" alt="" /><p style="font-size:19px;font-weight:600">残差分析</p><p style="font-size:16px;font-weight:600">残差与残差图检验方差齐性</p><li>残差因变量的观测值与根据估计的回归方程求出的预测值之差用e表示反映了用估计的回归方程去预测而引起的误差</li><img src="@/assets/images/f3024.png" alt=""><img src="@/assets/images/f3025.png" alt=""><p style="font-size:19px;font-weight:600">标准化残差检验正态性</p><li>标准化残差也称为Pearson 残差或半学生化残差(semistudentized residuals)</li><img src="@/assets/images/f3026.png" alt="">
</div>
</template>
</pop-model>
</template>
<script setup>
import popModel from "@/views/components/popModal.vue";
import * as echarts from 'echarts';
import ecStat from 'echarts-stat';
import * as API from '@/api/AI.js'
import { getUserInfo } from "@/utils/auth";
import * as XLSX from 'xlsx'
import { onMounted, reactive } from 'vue';
const { proxy } = getCurrentInstance()
const dialogVisible=ref(false)
const dialogVisible2=ref(false)
const flagColumn=ref(false)
const runResultShow=ref(false)
const exportTableRef = ref(null);
const tableLabel=reactive([
{prop:'date',label:''},
])
@ -245,6 +255,7 @@
const formInline2=reactive({
user:''
})
const flagUP=ref(false)
const option5=ref([])
const option6=ref([])
const getList=()=>{
@ -408,6 +419,7 @@
let data=res.data
data.slopes=data.slopes.join(',')
tableData3.value=[data]
predictionResults.value=''
})
}else{
if(input5.value.length>1){
@ -418,17 +430,35 @@
proxy.$modal.msgError("x变量数量有误");
return
}
}
flagColumn.value=true
// API.associationRuleMining(sendData).then((res)=>{
// tableData3.value=[]
// res.data.forEach(element=>{
// tableData3.value.push({
// date:element
// })
// })
// })
if(input6.value.length===1){
tableData2.value.forEach(item=>{
sendData.y.push(item[input5.value[0]])
sendData.x.push([item[input6.value[0]]])
})
}else{
tableData2.value.forEach(item=>{
sendData.y.push(item[input5.value[0]])
sendData.x.push([item[input6.value[0]],item[input6.value[1]]])
})
}
API.logisticRegression(sendData).then((res)=>{
tableLabel2.length=0
for (const key in res.data) {
tableLabel2.push({
label:key,
prop:key
})
}
let data=res.data
data.slope=data.slope
tableData3.value=[data]
predictionResults.value=''
})
}
}
flagUP.value=true
}
const nowData=ref([])
const handleClick=(item)=>{
@ -449,6 +479,27 @@
predictionResults.value=res.data
})
}
if(nowData.value.type==='逻辑回归'){
const sendData={
intercept:nowData.value.intercept,
type:nowData.value.type,
slope:nowData.value.slope,
lx:formInline2.user
}
API.logisticRegressionPrediction(sendData).then((res)=>{
dialogVisible2.value=false
predictionResults.value=res.data
})
}
}
const upLoad=()=>{
const tableDom = exportTableRef.value?.$el;
if (!tableDom) {
return;
}
const wb = XLSX.utils.table_to_book(tableDom);
XLSX.writeFile(wb, '回归分析.xlsx');
}
const startOver=()=>{
input.value=''
@ -466,6 +517,7 @@
nowData.value=[]
formInline2.user=''
predictionResults.value=''
flagUP.value=false
}
</script>
@ -645,34 +697,3 @@
}
}
</style>
<style lang="scss">
.dialogClass{
background:url('../../../assets/images/弹框.png') !important;
background-size: 100% 100% !important;
.el-dialog__header{
padding: 5px 0px;
margin-right: 5px !important;
.gbImg{
cursor: pointer;
width: 51px;
height: 31px;
background-size: 100% 100%;
}
}
.xtImg{
margin-left: 18px;
width: 530px;
}
}
.my-header {
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 16px;
text-align: center;
span{
color: #FFFFFF;
padding: 38px 20px 0;
}
}
</style>

@ -91,7 +91,7 @@ const activeIndex = (index) => {
background: url("../../assets/images/66.png");
color: #ffffff;
border-color: #ffffff00;
padding: 8px 5px 8px 30px;
padding: 8px 20px 8px 30px;
background-size: 100% 100%;
}
.el-button:nth-child(7) {

Loading…
Cancel
Save