1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590 |
- import tkinter
- import webbrowser
- from tkinter.filedialog import askopenfilename, asksaveasfilename, askdirectory
- import tkinter.messagebox
- import os
- import chardet
- from tkinter.scrolledtext import ScrolledText
- from Machine_learning_analysis import Learn_Numpy
- def Main():
- global top, ML, Form_List, PATH, bg, bbg, fg, Merge_list, Cul_list, Cul_Type
- Cul_list = []
- Cul_Type = []
- PATH = os.getcwd()
- Form_List = []
- Merge_list = []
- ML = Learn_Numpy.Machine_Learner()
- top = tkinter.Tk()
- bg = '#FFFAFA' # 主颜色
- bbg = '#FFFAFA' # 按钮颜色
- fg = '#000000' # 文字颜色
- top["bg"] = bg
- FONT = ('黑体', 11) # 设置字体
- top.title('CoTan机器学习')
- top.resizable(width=False, height=False)
- top.geometry('+10+10') # 设置所在位置
- width_B = 13 # 标准宽度
- height_B = 2
- a_y = 0
- a_x = 0
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='导入CSV',
- command=Add_CSV,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='导入Py',
- command=Add_Python,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='导出CSV',
- command=to_CSV,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- global name_Input
- a_y += 1
- tkinter.Label(
- top,
- text='表格名称:',
- bg=bg,
- fg=fg,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y) # 设置说明
- name_Input = tkinter.Entry(top, width=width_B)
- name_Input.grid(
- column=a_x +
- 1,
- row=a_y,
- columnspan=2,
- sticky=tkinter.E +
- tkinter.W)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='删除表格',
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='查看表格',
- command=Show,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='查看单一表格',
- command=Show_One,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- global Form_BOX, Index_BOX, Column_BOX, to_HTML_Type, Seq_Input, Code_Input, str_must
- a_y += 1
- to_HTML_Type = tkinter.IntVar() # 正,负,0
- lable = ['选项卡型', '可移动型', '自适应型'] # 复选框
- for i in range(3):
- tkinter.Radiobutton(
- top,
- bg=bg,
- fg=fg,
- activebackground=bg,
- activeforeground=fg,
- selectcolor=bg,
- text=lable[i],
- variable=to_HTML_Type,
- value=i).grid(
- column=a_x + i,
- row=a_y,
- sticky=tkinter.W)
- str_must = tkinter.IntVar()
- a_y += 1
- tkinter.Label(
- top,
- text='编码方式:',
- bg=bg,
- fg=fg,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y) # 设置说明
- Code_Input = tkinter.Entry(top, width=width_B)
- Code_Input.grid(column=a_x + 1, row=a_y, sticky=tkinter.E + tkinter.W)
- buttom = tkinter.Checkbutton(
- top,
- bg=bg,
- fg=fg,
- activebackground=bg,
- activeforeground=fg,
- selectcolor=bg,
- text='字符串类型',
- variable=str_must)
- buttom.grid(column=a_x + 2, row=a_y, sticky=tkinter.W)
- a_y += 1
- tkinter.Label(
- top,
- text='CSV分隔符:',
- bg=bg,
- fg=fg,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y) # 设置说明
- Seq_Input = tkinter.Entry(top, width=width_B)
- Seq_Input.grid(
- column=a_x +
- 1,
- columnspan=2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W)
- a_y += 1
- Form_BOX = tkinter.Listbox(
- top,
- width=width_B *
- 3,
- height=height_B *
- 10) # 显示符号
- Form_BOX.grid(
- column=a_x,
- row=a_y,
- columnspan=3,
- rowspan=10,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- # 422
- a_y += 10
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='添加数据',
- command=Merge_Add,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='删除数据',
- command=Merge_Del,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='组合数据',
- command=Merge,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- global Processing_type, Shape_Input, Merge_BOX
- a_y += 1
- Merge_BOX = tkinter.Listbox(
- top,
- width=width_B *
- 3,
- height=height_B *
- 3) # 显示符号
- Merge_BOX.grid(
- column=a_x,
- row=a_y,
- columnspan=3,
- rowspan=3,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 3
- Processing_type = tkinter.IntVar() # 正,负,0
- lable = ['横向处理', '纵向处理', '深度处理'] # 复选框
- for i in range(3):
- tkinter.Radiobutton(
- top,
- bg=bg,
- fg=fg,
- activebackground=bg,
- activeforeground=fg,
- selectcolor=bg,
- text=lable[i],
- variable=Processing_type,
- value=i).grid(
- column=a_x + i,
- row=a_y,
- sticky=tkinter.W)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='数据切片',
- command=Two_Split,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='数据分割',
- command=Split,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- columnspan=2,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Label(
- top,
- text='重塑形状:',
- bg=bg,
- fg=fg,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y)
- Shape_Input = tkinter.Entry(top, width=width_B)
- Shape_Input.grid(column=a_x + 1, row=a_y, sticky=tkinter.E + tkinter.W)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='矩阵重塑',
- command=Reshape,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='矩阵伸展',
- command=Reval,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='矩阵降维',
- command=Del_Ndim,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='矩阵转置',
- command=T,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_x += 3
- tkinter.Label(
- top,
- text='',
- bg=bg,
- fg=fg,
- font=FONT,
- width=1).grid(
- column=a_x,
- row=a_y) # 设置说明
- a_x += 1
- a_y = 0
- tkinter.Label(
- top,
- text='【机器学习】',
- bg=bg,
- fg=fg,
- font=FONT,
- width=width_B *
- 3,
- height=height_B).grid(
- column=a_x,
- columnspan=3,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N) # 设置说明
- global ML_BOX, ML_OUT, X_OUT, Y_OUT
- a_y += 1
- X_OUT = tkinter.StringVar()
- Put = tkinter.Entry(top, width=width_B * 2, textvariable=X_OUT)
- Put.grid(column=a_x, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
- Put['state'] = 'readonly'
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='选用X集',
- command=set_Feature,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W)
- Y_OUT = tkinter.StringVar()
- a_y += 1
- Put = tkinter.Entry(top, width=width_B * 2, textvariable=Y_OUT)
- Put.grid(column=a_x, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
- Put['state'] = 'readonly'
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='选用Y集',
- command=set_Label,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W)
- ML_OUT = tkinter.StringVar()
- a_y += 1
- Put = tkinter.Entry(top, width=width_B * 2, textvariable=ML_OUT)
- Put.grid(column=a_x, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
- Put['state'] = 'readonly'
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='选用学习器',
- command=set_Learner,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W)
- global Split_Input
- a_y += 1
- tkinter.Label(
- top,
- text='测试数据分割:',
- bg=bg,
- fg=fg,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y)
- Split_Input = tkinter.Entry(top, width=width_B * 2)
- Split_Input.grid(
- column=a_x +
- 1,
- row=a_y,
- columnspan=2,
- sticky=tkinter.E +
- tkinter.W)
- a_y += 1
- ML_BOX = tkinter.Listbox(top, width=width_B * 3, height=height_B * 5)
- ML_BOX.grid(
- column=a_x,
- row=a_y,
- columnspan=3,
- rowspan=5,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 5
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='导入学习器',
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='查看数据',
- command=Show_Args,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='删除学习器',
- command=Del_Leaner,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='训练机器',
- command=Fit_Learner,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='测试机器',
- command=Score_Learner,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='数据预测',
- command=Predict_Learner,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='单一变量特征选择',
- command=Add_SelectKBest,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- columnspan=2,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='映射标准化',
- command=Add_Mapzoom,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='方差特征选择',
- command=Add_Variance,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='使用学习器筛选',
- command=Add_SelectFrom_Model,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='模糊量化标准化',
- command=Add_Fuzzy_quantization,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='Z-score',
- command=Add_Z_Score,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='离差标准化',
- command=Add_MinMaxScaler,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='Log变换',
- command=Add_LogScaler,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='atan变换',
- command=Add_atanScaler,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='小数定标准化',
- command=Add_decimalScaler,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='Sigmod变换',
- command=Add_sigmodScaler,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='正则化',
- command=Add_Regularization,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='二值离散',
- command=Add_Binarizer,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='多值离散',
- command=Add_Discretization,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='独热编码',
- command=Add_OneHotEncoder,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='数字编码',
- command=Add_Label,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='缺失填充',
- command=Add_Missed,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='PCA降维',
- command=Add_PCA,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='RPCA降维',
- command=Add_RPCA,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='KPCA升维',
- command=Add_KPCA,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='LDA降维',
- command=Add_LDA,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='NMF降维',
- command=Add_NMF,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='t-SNE',
- command=Add_TSNE,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='线性回归',
- command=Add_Line,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='岭回归',
- command=Add_Ridge,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='Lasso',
- command=Add_Lasso,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='逻辑回归',
- command=Add_LogisticRegression,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='K邻近预测',
- command=Add_Knn,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='K邻近分类',
- command=Add_Knn_Class,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='梯度回归树回归',
- command=Add_GradientTree,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='决策树回归',
- command=Add_Tree,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='决策树分类',
- command=Add_Tree_Class,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='梯度回归树分类',
- command=Add_GradientTree_class,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='随机森林回归',
- command=Add_Forest,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='随机森林分类',
- command=Add_Forest_class,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_x += 3
- tkinter.Label(
- top,
- text='',
- bg=bg,
- fg=fg,
- font=FONT,
- width=1).grid(
- column=a_x,
- row=a_y) # 设置说明
- a_x += 1
- a_y = 0
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='多层感知机回归',
- command=Add_MLP,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='多层感知机分类',
- command=Add_MLP_class,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='随机森林分类',
- command=Add_Forest_class,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='支持向量机分类:SVC',
- command=Add_SVC,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- columnspan=2,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='回归:SVR',
- command=Add_SVR,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='k-means',
- command=Add_KMeans,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='凝聚聚类',
- command=Add_Agglomerative,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='DBSCAN',
- command=Add_DBSCAN,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='特征分类图',
- command=Add_ClassBar,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='临近特征回归图',
- command=Add_FeatureScatter,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='临近特征分类图',
- command=Add_FeatureScatterClass,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='所有特征回归图',
- command=Add_FeatureScatter_all,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='所有特征分类图',
- command=Add_FeatureScatterClass_all,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='临近特征预测图',
- command=Add_Predictive_HeatMap,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='所有特征预测图',
- command=Add_Predictive_HeatMap_More,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='矩阵热力图',
- command=Add_Numpy_To_HeatMap,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='数据y-x散点图',
- command=Add_FeatureY_X,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='聚类树状图',
- command=Add_ClusterTree,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='获取数据',
- command=Add_View_data,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='矩阵散点图',
- command=Add_MatrixScatter,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='特征相关性',
- command=Add_corr,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='曲线拟合',
- command=Curve_fitting,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='快速傅里叶',
- command=Add_Fast_Fourier,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='数据统计',
- command=Add_Des,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='双逆向傅里叶',
- command=Add_Reverse_Fast_Fourier2,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='逆向傅里叶',
- command=Add_Reverse_Fast_Fourier,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='分类模型评估',
- command=Show_Class_Score,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='回归模型评估',
- command=Show_Regression_Score,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='聚类模型评估',
- command=Show_Clustering_Score,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Label(
- top,
- text='【学习器配置】',
- bg=bg,
- fg=fg,
- font=FONT,
- width=width_B *
- 3,
- height=height_B).grid(
- column=a_x,
- columnspan=3,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N) # 设置说明
- global Global_Type
- a_y += 1
- Global_Type = []
- lable = ['聚类仅邻近特征', '导出单独页面', '导出表格CSV'] # 复选框
- for i in range(3):
- Global_Type.append(tkinter.IntVar())
- tkinter.Checkbutton(top,
- bg=bg,
- fg=fg,
- activebackground=bg,
- activeforeground=fg,
- selectcolor=bg,
- text=lable[i],
- variable=Global_Type[-1],
- command=globalSeeting).grid(column=a_x + i,
- row=a_y,
- sticky=tkinter.W)
- a_y += 1
- lable = ['导出模型', '压缩为tar.gz', '创建新目录'] # 复选框
- for i in range(3):
- Global_Type.append(tkinter.IntVar())
- tkinter.Checkbutton(top,
- bg=bg,
- fg=fg,
- activebackground=bg,
- activeforeground=fg,
- selectcolor=bg,
- text=lable[i],
- variable=Global_Type[-1],
- command=globalSeeting).grid(column=a_x + i,
- row=a_y,
- sticky=tkinter.W)
- for i in Global_Type[1:]:
- i.set(1)
- globalSeeting()
- global Args_Learner
- a_y += 1
- Args_Learner = tkinter.Text(top, width=width_B * 3, height=height_B * 6)
- Args_Learner.grid(column=a_x, row=a_y, columnspan=3, rowspan=6,
- sticky=tkinter.E + tkinter.W + tkinter.N + tkinter.S)
- a_y += 6
- tkinter.Label(
- top,
- text='【矩阵运算】',
- bg=bg,
- fg=fg,
- font=FONT,
- width=width_B *
- 3,
- height=height_B).grid(
- column=a_x,
- columnspan=3,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N) # 设置说明
- global Cul_Box, CulType_Input, Value_Input
- a_y += 1
- Cul_Box = tkinter.Listbox(top, width=width_B * 3, height=height_B * 1)
- Cul_Box.grid(
- column=a_x,
- row=a_y,
- columnspan=3,
- rowspan=1,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- a_y += 1
- tkinter.Label(
- top,
- text='运算类型:',
- bg=bg,
- fg=fg,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y)
- CulType_Input = tkinter.Entry(top, width=width_B * 2)
- CulType_Input.grid(
- column=a_x +
- 1,
- row=a_y,
- columnspan=2,
- sticky=tkinter.E +
- tkinter.W)
- a_y += 1
- tkinter.Label(
- top,
- text='键入参数:',
- bg=bg,
- fg=fg,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y)
- Value_Input = tkinter.Entry(top, width=width_B * 2)
- Value_Input.grid(
- column=a_x +
- 1,
- row=a_y,
- columnspan=2,
- sticky=tkinter.E +
- tkinter.W)
- a_y += 1
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='选择参数',
- command=Cul_Add,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='键入参数',
- command=Cul_Input,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 1,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- tkinter.Button(
- top,
- bg=bbg,
- fg=fg,
- text='矩阵运算',
- command=Cul_Numpy,
- font=FONT,
- width=width_B,
- height=height_B).grid(
- column=a_x +
- 2,
- row=a_y,
- sticky=tkinter.E +
- tkinter.W +
- tkinter.W +
- tkinter.S +
- tkinter.N)
- top.mainloop()
- def Add_Reverse_Fast_Fourier2(): # 添加Lenear的核心
- Add_leaner('[2]Reverse_Fast_Fourier')
- def Add_Reverse_Fast_Fourier(): # 添加Lenear的核心
- Add_leaner('Reverse_Fast_Fourier')
- def Add_Fast_Fourier(): # 添加Lenear的核心
- Add_leaner('Fast_Fourier')
- def Curve_fitting():
- Dic = askopenfilename(title='导入参数')
- with open(Dic, 'r') as f:
- ML.Add_Curve_Fitting(f.read(), Text=get_Args_Learner())
- Update_Leaner()
- def Show_Clustering_Score():
- Show_Score(2)
- def Show_Regression_Score():
- Show_Score(1)
- def Show_Class_Score():
- Show_Score(0)
- def Show_Score(func):
- learner = get_Learner(True)
- Dic = askdirectory(title='选择保存位置')
- data = ML.Show_Score(
- learner, Dic, get_Name(
- False, True), get_Name(
- False, False), func)
- webbrowser.open(data[0])
- webbrowser.open(data[1]) # 还可以打开文件管理器
- Update_BOX()
- def Cul_Numpy():
- global Cul_list, Cul_Type, CulType_Input
- func = CulType_Input.get()
- if len(Cul_list) == 2 and 1 in Cul_Type:
- ML.Cul_Numpy(Cul_list, Cul_Type, func)
- Update_BOX()
- def Add_Cul(num, type_):
- global Cul_list, Cul_Type
- if len(Cul_list) == 2:
- del Cul_list[0]
- del Cul_Type[0]
- Cul_list.append(num)
- Cul_Type.append(type_)
- def Update_Cul():
- global Cul_list, Cul_Type, Cul_Box
- Cul_Box.delete(0, tkinter.END)
- a = ['第一参数', '第二参数']
- b = ['参数', '矩阵']
- Cul_Box.insert(
- tkinter.END, *[f'{a[i]} {Cul_list[i]} {b[Cul_Type[i]]}' for i in range(len(Cul_list))])
- def Cul_Input():
- global Cul_Box, CulType_Input, Value_Input
- num = eval(Value_Input.get(), {})
- Add_Cul(num, 0)
- Update_Cul()
- def Cul_Add():
- name = get_Name()
- Add_Cul(name, 1)
- Update_Cul()
- def Del_Leaner():
- Learn = get_Learner(True)
- set_Learne = get_Learner(False) # 获取学习器Learner
- if set_Learne != Learn:
- ML.Del_Leaner(Learn)
- Update_Leaner()
- def globalSeeting():
- global Global_Type
- args = [bool(i.get()) for i in Global_Type]
- Learn_Numpy.set_Global(*args)
- def Reshape():
- global ML, Processing_type
- shape = eval(f'[{Shape_Input.get()}]')[0]
- ML.reShape(get_Name(), shape)
- Update_BOX()
- def T():
- global ML, Processing_type, Shape_Input
- try:
- Func = eval(f'[{Shape_Input.get()}]')
- except BaseException:
- Func = None
- ML.transpose(get_Name(), Func)
- Update_BOX()
- def Del_Ndim():
- global ML
- ML.Del_Ndim(get_Name())
- Update_BOX()
- def Reval():
- global ML, Processing_type
- Type = Processing_type.get()
- ML.Reval(get_Name(), Type)
- Update_BOX()
- def Two_Split():
- global ML, Processing_type, Shape_Input
- Type = Processing_type.get()
- ML.Two_Split(get_Name(), Shape_Input.get(), Type)
- Update_BOX()
- def Split():
- global ML, Processing_type, Shape_Input
- Type = Processing_type.get()
- try:
- Split = eval(f'[{Shape_Input.get()}]')[0]
- except BaseException:
- Split = 2
- ML.Split(get_Name(), Split, Type)
- Update_BOX()
- def Merge():
- global Merge_list, ML, Processing_type
- if len(Merge_list) < 1:
- return False
- Type = Processing_type.get()
- ML.Merge(Merge_list, Type)
- Update_BOX()
- def Update_Merge():
- global Merge_list, Merge_BOX
- Merge_BOX.delete(0, tkinter.END)
- Merge_BOX.insert(tkinter.END, *Merge_list)
- def Merge_Del():
- global Merge_list, Merge_BOX
- del Merge_list[Merge_BOX.curselection()[0]]
- Update_Merge()
- def Merge_Add():
- global Merge_list
- name = get_Name()
- Merge_list.append(name)
- Update_Merge()
- def Show_Args():
- learner = get_Learner(True)
- Dic = askdirectory(title='选择保存位置')
- data = ML.Show_Args(learner, Dic)
- webbrowser.open(data[0])
- webbrowser.open(data[1]) # 还可以打开文件管理器
- Update_BOX()
- def get_Args_Learner():
- global Args_Learner
- return Args_Learner.get('0.0', tkinter.END)
- def Score_Learner():
- learner = get_Learner()
- socore = ML.Score(get_Name(False, True), get_Name(False, False), learner)
- tkinter.messagebox.showinfo('测试完成', f'针对测试数据评分结果为:{socore}')
- def Predict_Learner():
- learner = get_Learner()
- Data = ML.Predict(get_Name(False, True), learner)
- title = f'CoTan数据处理 学习器:{learner}'
- Creat_TextSheet(Data, title)
- Update_BOX()
- def Fit_Learner():
- learner = get_Learner()
- try:
- split = float(Split_Input.get())
- if split < 0 or 1 < split:
- raise Exception
- except BaseException:
- split = 0.3
- socore = ML.Fit(
- get_Name(
- False,
- True),
- get_Name(
- False,
- False),
- learner,
- Text=get_Args_Learner(),
- split=split)
- tkinter.messagebox.showinfo(
- '训练完成', f'针对训练数据({(1 - split) * 100}%)评分结果为:{socore[0]}\n'
- f'针对测试数据评分({split * 100}%)结果为:{socore[1]}')
- def set_Feature():
- global X_OUT
- X_OUT.set(get_Name())
- def set_Label():
- global Y_OUT
- Y_OUT.set(get_Name())
- def set_Learner():
- global ML_OUT
- ML_OUT.set(get_Learner(True))
- def get_Learner(Type=False):
- global Learn_Dic, ML_BOX, ML_OUT
- if Type:
- try:
- return list(Learn_Dic.keys())[ML_BOX.curselection()[0]]
- except BaseException:
- try:
- return list(Learn_Dic.keys)[0]
- except BaseException:
- return get_Learner(False)
- else:
- try:
- return ML_OUT.get()
- except BaseException:
- return None
- def Add_Des(): # 添加Lenear的核心
- Add_leaner('Statistics')
- def Add_corr():
- Add_leaner('Correlation')
- def Add_MatrixScatter():
- Add_leaner('MatrixScatter')
- def Add_View_data():
- ML.Add_View_data(get_Learner(), Text=get_Args_Learner())
- Update_Leaner()
- def Add_ClusterTree():
- Add_leaner('ClusterTree')
- def Add_FeatureY_X():
- Add_leaner('FeatureY-X')
- def Add_Numpy_To_HeatMap():
- Add_leaner('HeatMap')
- def Add_Predictive_HeatMap_More(): # 添加Lenear的核心
- ML.Add_Predictive_HeatMap_More(get_Learner(), Text=get_Args_Learner())
- Update_Leaner()
- def Add_Predictive_HeatMap(): # 添加Lenear的核心
- ML.Add_Predictive_HeatMap(get_Learner(), Text=get_Args_Learner())
- Update_Leaner()
- def Add_FeatureScatterClass_all():
- Add_leaner('FeatureScatterClass_all')
- def Add_FeatureScatter_all():
- Add_leaner('FeatureScatter_all')
- def Add_FeatureScatterClass():
- Add_leaner('FeatureScatterClass')
- def Add_FeatureScatter():
- Add_leaner('FeatureScatter')
- def Add_ClassBar():
- Add_leaner('ClassBar')
- def Add_DBSCAN():
- Add_leaner('DBSCAN')
- def Add_Agglomerative():
- Add_leaner('Agglomerative')
- def Add_KMeans():
- Add_leaner('k-means')
- def Add_MLP_class():
- Add_leaner('MLP_class')
- def Add_MLP():
- Add_leaner('MLP')
- def Add_SVR():
- Add_leaner('SVR')
- def Add_SVC():
- Add_leaner('SVC')
- def Add_GradientTree():
- Add_leaner('GradientTree')
- def Add_GradientTree_class():
- Add_leaner('GradientTree_class')
- def Add_TSNE():
- Add_leaner('t-SNE')
- def Add_NMF():
- Add_leaner('NMF')
- def Add_LDA():
- Add_leaner('LDA')
- def Add_KPCA():
- Add_leaner('KPCA')
- def Add_RPCA():
- Add_leaner('RPCA')
- def Add_PCA():
- Add_leaner('PCA')
- def Add_Missed():
- Add_leaner('Missed')
- def Add_Label():
- Add_leaner('Label')
- def Add_OneHotEncoder():
- Add_leaner('OneHotEncoder')
- def Add_Discretization():
- Add_leaner('Discretization')
- def Add_Binarizer():
- Add_leaner('Binarizer')
- def Add_Regularization():
- Add_leaner('Regularization')
- def Add_Fuzzy_quantization():
- Add_leaner('Fuzzy_quantization')
- def Add_Mapzoom():
- Add_leaner('Mapzoom')
- def Add_sigmodScaler():
- Add_leaner('sigmodScaler')
- def Add_decimalScaler():
- Add_leaner('decimalScaler')
- def Add_atanScaler():
- Add_leaner('atanScaler')
- def Add_LogScaler():
- Add_leaner('LogScaler')
- def Add_MinMaxScaler():
- Add_leaner('MinMaxScaler')
- def Add_Z_Score():
- Add_leaner('Z-Score')
- def Add_Forest():
- Add_leaner('Forest')
- def Add_Forest_class():
- Add_leaner('Forest_class')
- def Add_Tree_Class():
- Add_leaner('Tree_class')
- def Add_Tree():
- Add_leaner('Tree')
- def Add_SelectKBest():
- Add_leaner('SelectKBest')
- def Add_Knn_Class():
- Add_leaner('Knn_class')
- def Add_LogisticRegression():
- Add_leaner('LogisticRegression')
- def Add_Lasso():
- Add_leaner('Lasso')
- def Add_Variance():
- Add_leaner('Variance')
- def Add_Knn():
- Add_leaner('Knn')
- def Add_Ridge():
- Add_leaner('Ridge')
- def Add_Line():
- Add_leaner('Line')
- def Add_SelectFrom_Model(): # 添加Lenear的核心
- ML.Add_SelectFrom_Model(get_Learner(), Text=get_Args_Learner())
- Update_Leaner()
- def Add_leaner(Type): # 添加Lenear的核心
- ML.Add_Learner(Type, Text=get_Args_Learner())
- Update_Leaner()
- def Update_Leaner():
- global Learn_Dic, ML_BOX
- Learn_Dic = ML.Return_Learner()
- ML_BOX.delete(0, tkinter.END)
- ML_BOX.insert(tkinter.END, *Learn_Dic.keys())
- def Show_One():
- global PATH, to_HTML_Type
- Dic = f'{PATH}/$Show_Sheet.html'
- try:
- name = get_Name()
- if name is None:
- raise Exception
- ML.to_Html_One(name, Dic)
- webbrowser.open(Dic)
- except BaseException:
- # pass
- raise
- def Show():
- global PATH, to_HTML_Type
- Dic = f'{PATH}/$Show_Sheet.html'
- try:
- name = get_Name()
- if name is None:
- raise Exception
- ML.to_Html(name, Dic, to_HTML_Type.get())
- webbrowser.open(Dic)
- except BaseException:
- pass
- def to_CSV():
- global top, Seq_Input, Code_Input, str_must, Index_must
- Dic = asksaveasfilename(title='选择保存的CSV', filetypes=[("CSV", ".csv")])
- Seq = Seq_Input.get()
- name = get_Name()
- ML.to_CSV(Dic, name, Seq)
- Update_BOX()
- def Add_CSV():
- global top, Seq_Input, Code_Input, str_must, name_Input
- Dic = askopenfilename(title='选择载入的CSV', filetypes=[("CSV", ".csv")])
- if Dic == '':
- return False
- Seq = Seq_Input.get()
- Codeing = Code_Input.get()
- str_ = bool(str_must.get())
- name = name_Input.get().replace(' ', '')
- if name == '':
- name = os.path.splitext(os.path.split(Dic)[1])[0]
- print(name)
- if Codeing == '':
- with open(Dic, 'rb') as f:
- Codeing = chardet.detect(f.read())['encoding']
- if Seq == '':
- Seq = ','
- ML.read_csv(Dic, name, Codeing, str_, Seq,)
- Update_BOX()
- def Add_Python():
- global top, Seq_Input, Code_Input, str_must, Index_must
- Dic = askopenfilename(
- title='选择载入的py', filetypes=[
- ("Python", ".py"), ("Txt", ".txt")])
- name = name_Input.get().replace(' ', '')
- if name == '':
- name = os.path.splitext(os.path.split(Dic)[1])[0]
- with open(Dic, 'r') as f:
- ML.Add_Python(f.read(), name)
- Update_BOX()
- def get_Name(Type=True, x=True): # 获得名字统一接口
- global Form_List, Form_BOX, X_OUT
- if Type:
- try:
- return Form_List[Form_BOX.curselection()[0]]
- except BaseException:
- try:
- return Form_List[0]
- except BaseException:
- return None
- else:
- try:
- if x:
- return X_OUT.get()
- else:
- return Y_OUT.get()
- except BaseException:
- return None
- def Update_BOX():
- global top, Form_BOX, Form_List
- Form_List = list(ML.get_Form().keys())
- Form_BOX.delete(0, tkinter.END)
- Form_BOX.insert(tkinter.END, *Form_List)
- def Creat_TextSheet(data, name):
- global bg
- new_top = tkinter.Toplevel(bg=bg)
- new_top.title(name)
- new_top.geometry('+10+10') # 设置所在位置
- text = ScrolledText(new_top, font=('黑体', 13), height=50)
- text.pack(fill=tkinter.BOTH)
- text.insert('0.0', data)
- text.config(state=tkinter.DISABLED)
- new_top.resizable(width=False, height=False)
|