diff --git a/pythonProject1/.idea/.gitignore b/pythonProject1/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..13566b81b018ad684f3a35fee301741b2734c8f4 --- /dev/null +++ b/pythonProject1/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/pythonProject1/.idea/inspectionProfiles/Project_Default.xml b/pythonProject1/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000000000000000000000000000000000..4ebeef73e1a72b62075747eb1e5bb3b86786fd87 --- /dev/null +++ b/pythonProject1/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/pythonProject1/.idea/inspectionProfiles/profiles_settings.xml b/pythonProject1/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99 --- /dev/null +++ b/pythonProject1/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/pythonProject1/.idea/misc.xml b/pythonProject1/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..a50ac5b1ad75b566c394a7b9d198b155584f8bc9 --- /dev/null +++ b/pythonProject1/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/pythonProject1/.idea/modules.xml b/pythonProject1/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..fdd8fdfd13437ad5929c98cfa256df55ff0f5e08 --- /dev/null +++ b/pythonProject1/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/pythonProject1/.idea/pythonProject1.iml b/pythonProject1/.idea/pythonProject1.iml new file mode 100644 index 0000000000000000000000000000000000000000..74d515a027de98657e9d3d5f0f1831882fd81374 --- /dev/null +++ b/pythonProject1/.idea/pythonProject1.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/pythonProject1/.idea/vcs.xml b/pythonProject1/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..1eafc925c9da320fd56bfb55fd155f3fda19e717 --- /dev/null +++ b/pythonProject1/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pythonProject1/abc.markdown b/pythonProject1/abc.markdown new file mode 100644 index 0000000000000000000000000000000000000000..d07e1dfffae56e3abd58c5ef464da6d4c85c2f67 --- /dev/null +++ b/pythonProject1/abc.markdown @@ -0,0 +1,34 @@ +### 安装vue的过程 +1. 安装nodejs +> 进入官网下载安装nodejs +> 2.测试nodejs是否安装成功 +``` +node -v +npm -v +``` +3.通过npm安装vue +```angular2html +npm install -g @vue/cli +``` +4.测试vue是否安装成功 +```angular2html +vue --version +``` +5.使用vue 创建前端项目 +```angular2html +vue create my-project +``` +6.配置vue的项目 +- 选择vue的版本 +```angular2html +Manually select features +``` +- 选择vue 的插件 +```angular2html +Babel Router +``` +- 启动vue的项目 +```angular2html +cd vue 的项目里面 +npm run serve +``` \ No newline at end of file diff --git a/pythonProject1/abcd b/pythonProject1/abcd new file mode 160000 index 0000000000000000000000000000000000000000..4b1b1f26614f133800861a1c78228f60865ba018 --- /dev/null +++ b/pythonProject1/abcd @@ -0,0 +1 @@ +Subproject commit 4b1b1f26614f133800861a1c78228f60865ba018 diff --git a/pythonProject1/abcd.zip b/pythonProject1/abcd.zip new file mode 100644 index 0000000000000000000000000000000000000000..31349acaa32558bdc07e760f37664e6ff96f0e05 Binary files /dev/null and b/pythonProject1/abcd.zip differ diff --git a/pythonProject1/main.py b/pythonProject1/main.py new file mode 100644 index 0000000000000000000000000000000000000000..5596b44786f04e4810aefe9f8d712f08ed310f71 --- /dev/null +++ b/pythonProject1/main.py @@ -0,0 +1,16 @@ +# This is a sample Python script. + +# Press Shift+F10 to execute it or replace it with your code. +# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. + + +def print_hi(name): + # Use a breakpoint in the code line below to debug your script. + print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. + + +# Press the green button in the gutter to run the script. +if __name__ == '__main__': + print_hi('PyCharm') + +# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/pythonProject1/package-lock.json b/pythonProject1/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..66118aea0c919f70f6bd964758ea6a822c2ee296 --- /dev/null +++ b/pythonProject1/package-lock.json @@ -0,0 +1,34 @@ +{ + "name": "pythonProject1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "echarts": "^5.5.1" + } + }, + "node_modules/echarts": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/echarts/-/echarts-5.5.1.tgz", + "integrity": "sha512-Fce8upazaAXUVUVsjgV6mBnGuqgO+JNDlcgF79Dksy4+wgGpQB2lmYoO4TSweFg/mZITdpGHomw/cNBJZj1icA==", + "dependencies": { + "tslib": "2.3.0", + "zrender": "5.6.0" + } + }, + "node_modules/tslib": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", + "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==" + }, + "node_modules/zrender": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.6.0.tgz", + "integrity": "sha512-uzgraf4njmmHAbEUxMJ8Oxg+P3fT04O+9p7gY+wJRVxo8Ge+KmYv0WJev945EH4wFuc4OY2NLXz46FZrWS9xJg==", + "dependencies": { + "tslib": "2.3.0" + } + } + } +} diff --git a/pythonProject1/package.json b/pythonProject1/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6b65e74629a4610713a1ef4a4217b1d61707a4b2 --- /dev/null +++ b/pythonProject1/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "echarts": "^5.5.1" + } +} diff --git a/pythonProject1/server/__pycache__/theta.cpython-312.pyc b/pythonProject1/server/__pycache__/theta.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..464f616febb0cc276ba1b867cdc098f2e45ce3a5 Binary files /dev/null and b/pythonProject1/server/__pycache__/theta.cpython-312.pyc differ diff --git a/pythonProject1/server/linear.py b/pythonProject1/server/linear.py new file mode 100644 index 0000000000000000000000000000000000000000..30e522b7bbaa50425ce9546b2d3ba507f4451905 --- /dev/null +++ b/pythonProject1/server/linear.py @@ -0,0 +1,104 @@ +import pymysql.cursors +import numpy as np +import re +from collections import Counter +connection = pymysql.connect(host='localhost', + user='root', + password='123456', + database='test', + cursorclass=pymysql.cursors.DictCursor) +cursor=connection.cursor() + +sql="select * from salary where type=1" + +cursor.execute(sql) +result=cursor.fetchall() +def getScore(): + results=[] + for item in result: + results.append(item["skill"].replace(" ","").split("\n")) + + temp=[] + for item in results: + temp+=item + temps=[] + + for item in temp: + if item: + temps.append(item) + + counInfo=Counter(temps) + print(counInfo) + counInfo=counInfo.most_common() + + counInfoList=[] + + for item in counInfo: + counInfoList.append(list(item)) + + sums=0 + + for item in counInfoList: + sums+=item[1] + for item in counInfoList: + item[1]=item[1]/sums + + counInfoDict={} + for item in counInfoList: + counInfoDict[item[0]]=item[1] + + return counInfoDict + +# 以字典的方式来记录技能对应的权重(分值) +score=getScore() + + +X=[] +Y=[] +cityMark={"太原":1,"北京":2} + +eduMark={"大专":1,"本科":2,"硕士":3,"博士":4,"不限专业":0} + +for item in result: + str1 = item["salary"] + if not (re.findall("天", str1)) and re.findall("(千|万)", str1): + a=[] + a.append(1) + # 城市 + a.append(cityMark[item["city"]]) + #学历 + edu=item["education"].replace(" ","").replace("\n","") + a.append(eduMark.get(edu,0)) + #工作年限 + workage=item["workage"].replace(" ","").replace("\n","") + if re.findall("\d",workage): + workage=workage[:1] + else: + workage=1 + a.append(workage) + #技能值 + scores=0 + for i in item["skill"].replace(" ","").split("\n"): + if i: + scores+=score[i] + print(scores) + a.append(scores) + X.append(a) + + nums=re.findall("\d+\.{0,1}\d*",str1) + flag=re.findall("(千|万)",str1) + num1=float(nums[0])*1000 if flag[0]=="千" else float(nums[0])*10000 + num2=float(nums[1])*1000 if flag[1]=="千" else float(nums[1])*10000 + avg=(num1+num2)/2 + Y.append(avg) + +X=np.array(X).astype(float) +Y=np.array(Y) +print(X) +print(Y) +theta=np.linalg.pinv(X.T.dot(X)).dot(X.T).dot(Y) +print(theta) +f=open("theta.py","w") +f.write("import numpy as np \ntheta="+str(list(theta))) + + diff --git a/pythonProject1/server/server.py b/pythonProject1/server/server.py new file mode 100644 index 0000000000000000000000000000000000000000..e03ae4f318f0b2a13ccca45923996e24a6c0ec89 --- /dev/null +++ b/pythonProject1/server/server.py @@ -0,0 +1,161 @@ +from flask import Flask,request +from flask_cors import CORS +import pymysql.cursors +from collections import Counter +import re +connection = pymysql.connect(host='localhost', + user='root', + password='123456', + database='test', + cursorclass=pymysql.cursors.DictCursor) +cursor = connection.cursor() +app=Flask(__name__) +CORS(app, resources={r'/*':{'origins':'*'}}) +@app.route('/getJiqiXueData') +def getJiqiXueData(): + sql = "select * from salary " + cursor.execute(sql) + result = cursor.fetchall() + connection.commit() + return result +@app.route('/getAIData') +def getAIData(): + sql = "select * from clothes " + cursor.execute(sql) + result = cursor.fetchall() + connection.commit() + return result +# @app.route('/getAIData') +# def getAIData(): +# sql = "select * from clothes " +# cursor.execute(sql) +# result = cursor.fetchall() +# connection.commit() +# return result +@app.route('/getJiqiXueSkillEcharts') +def getJiqiXueSkillEcharts(): + sql = "select skill from salary " + # sql = "select * from salary " + cursor.execute(sql) + result = cursor.fetchall() + connection.commit() + # infos=[] + # for item in result: + # print(item["skill"].replace(" ","").split("\n")) + # return result + infos=[] + for item in result: + infos+=(item["skill"].replace(" ","").split("\n")) + infos=(Counter(infos)) + infos=infos.most_common() + print(infos) + X=[] + Y=[] + for item in infos: + if item[0]: + X.append(item[0]) + Y.append(item[1]) + + return [X[:10],Y[:10]] +@app.route('/getJiqiXueEduEcharts') +def getJiqiXueEduEcharts(): + sql = "select education from salary where type=1" + + cursor.execute(sql) + result = cursor.fetchall() + connection.commit() + infos=[] + for item in result: + if item["education"].replace(" ","").replace("\n",""): + infos.append(item["education"].replace(" ","").replace("\n","")) + infos=(Counter(infos).most_common()) + arr=[] + for item in infos: + obj={} + obj["value"]=item[1] + obj["name"]=item[0] + arr.append(obj) + return arr +@app.route("/getJiqiXueEduAndSalaryEcharts") +def getJiqiXueEduAndSalaryEcharts(): + sql = "select education,salary from salary where type=1" + cursor.execute(sql) + result = cursor.fetchall() + connection.commit() + + total={} + totalnum={} + for item in result: + if item["education"]: + edu=item["education"].replace(" ","").replace("\n","") + price=item["salary"].replace(" ","").replace("\n","") + + if not(re.findall("天",price)) and re.findall("(千|万)",price): + nums=re.findall("\d+\.{0,1}\d*",price) + flag=re.findall("(千|万)",price) + num1=float(nums[0])*1000 if flag[0]=="千" else float(nums[0])*10000 + num2=float(nums[1])*1000 if flag[1]=="千" else float(nums[1])*10000 + avg=(num1+num2)/2 + if total.get(edu): + total[edu]+=avg + totalnum[edu]+=1 + else: + total[edu]=avg + totalnum[edu]=1 + + X=[] + Y=[] + for item in total: + X.append(item) + Y.append(total[item]/totalnum[item]) + + print(X) + print(Y) + return [X,Y] +@app.route("/getSkillScore") +def getSkillScore(): + sql = "select skill from salary where type=1" + cursor.execute(sql) + result = cursor.fetchall() + connection.commit() + + infos = [] + for item in result: + infos += (item["skill"].replace(" ", "").split("\n")) + + infos = (Counter(infos)) + infos = infos.most_common() + total=0 + newinfos=[] + for item in infos: + if item[0]: + total+=item[1] + newinfos.append(list(item)) + for item in newinfos: + item[1]=item[1]/total + return newinfos + +@app.route("/predict") +def predict(): + X=[] + city=float(request.args.get("city")) + workage=float(request.args.get("workage")) + education=float(request.args.get("education")) + skill=request.args.get("skill") + nums=0 + for item in skill.split(","): + nums+=float(item) + + X.append(1) + X.append(city) + X.append(education) + X.append(workage) + X.append(nums) + + + from theta import theta + import numpy as np + X=np.array(X) + theta=np.array(theta) + return str(X.dot(theta)) +app.run() \ No newline at end of file diff --git a/pythonProject1/server/shuxuelaoshimodel.py b/pythonProject1/server/shuxuelaoshimodel.py new file mode 100644 index 0000000000000000000000000000000000000000..bb2d2958bd23b7c0e10f8078437ee73ced22fae3 --- /dev/null +++ b/pythonProject1/server/shuxuelaoshimodel.py @@ -0,0 +1,2 @@ +import numpy as np +theta=[np.float64(1506.1203949738149), np.float64(8376.074233976547), np.float64(316.66944820274193), np.float64(1168.1878279261841), np.float64(-21481.65858932624)] \ No newline at end of file diff --git a/pythonProject1/server/theta.py b/pythonProject1/server/theta.py new file mode 100644 index 0000000000000000000000000000000000000000..ae79a599b9c6d97d31332f80d886fd7e4320d43d --- /dev/null +++ b/pythonProject1/server/theta.py @@ -0,0 +1,2 @@ +import numpy as np +theta=[np.float64(3290.1417525770935), np.float64(6580.283505154761), np.float64(-4603.737113402064), np.float64(284.4716494845372), np.float64(78685.5670103087)] \ No newline at end of file diff --git "a/\347\216\213\347\220\246\346\226\21420211106331.doc" "b/\347\216\213\347\220\246\346\226\21420211106331.doc" new file mode 100644 index 0000000000000000000000000000000000000000..8f0e01004b0ad16d4807315e5feeba3e974139b2 Binary files /dev/null and "b/\347\216\213\347\220\246\346\226\21420211106331.doc" differ