123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298 |
- import os
- import tkinter
- from tkinter.scrolledtext import ScrolledText
- import tkinter.messagebox
- from tkinter.filedialog import askopenfilename, asksaveasfilename, askdirectory
- import chardet
- import webbrowser
- import machinelearning.controller
- import machinelearning.template
- from machinelearning import template
- calculation_list = []
- calculation_method = []
- PATH = os.getcwd()
- sheet_list = []
- merge_list = []
- learner_controller = machinelearning.controller.MachineLearner()
- SCREEN = tkinter.Tk()
- gui_width = 13 # 标准宽度
- gui_height = 2
- row = 0
- column = 0
- bg_color = "#FFFAFA" # 主颜色
- botton_color = "#FFFAFA" # 按钮颜色
- word_color = "#000000" # 文字颜色
- SCREEN["bg"] = bg_color
- FONT = ("黑体", 11) # 设置字体
- def machine_learning():
- global SCREEN
- SCREEN.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():
- file_dir = askopenfilename(title="导入参数")
- with open(file_dir, "r") as f:
- learner_controller.add_curve_fitting(f.read())
- 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)
- save_dir = askdirectory(title="选择保存位置")
- data = learner_controller.model_evaluation(
- learner, save_dir, get_name(False, True), get_name(False, False), func
- )
- webbrowser.open(data[0])
- webbrowser.open(data[1]) # 还可以打开文件管理器
- update_sheet_box()
- def calculation():
- global calculation_list, calculation_method, calculation_type
- func = calculation_type.get()
- if len(calculation_list) == 2 and 1 in calculation_method:
- learner_controller.calculation_matrix(
- calculation_list, calculation_method, func
- )
- update_sheet_box()
- def add_calculation_core(num, type_):
- global calculation_list, calculation_method
- if len(calculation_list) == 2:
- del calculation_list[0]
- del calculation_method[0]
- calculation_list.append(num)
- calculation_method.append(type_)
- def update_calculation_box():
- global calculation_list, calculation_method, calculation_box
- calculation_box.delete(0, tkinter.END)
- a = ["第一参数", "第二参数"]
- b = ["参数", "矩阵"]
- calculation_box.insert(
- tkinter.END,
- *[
- f"{a[i]} {calculation_list[i]} {b[calculation_method[i]]}"
- for i in range(len(calculation_list))
- ],
- )
- def add_calculation_number():
- global calculation_box, calculation_type, value
- num = eval(value.get(), {})
- add_calculation_core(num, 0)
- update_calculation_box()
- def add_calculation_object():
- name = get_name()
- add_calculation_core(name, 1)
- update_calculation_box()
- def del_leaner():
- learn = get_learner(True)
- set_learne = get_learner(False) # 获取学习器Learner
- if set_learne != learn:
- learner_controller.del_leaner(learn)
- update_leaner()
- def global_seeting():
- global global_settings
- args = [bool(i.get()) for i in global_settings]
- machinelearning.template.set_global(*args)
- def reshape():
- global learner_controller, processing_type, shape
- numpy_shape = eval(f"[{shape.get()}]")[0]
- learner_controller.reshape(get_name(), numpy_shape)
- update_sheet_box()
- def transpose():
- global learner_controller, processing_type, shape
- try:
- func = eval(f"[{shape.get()}]")
- except BaseException:
- func = None
- learner_controller.transpose(get_name(), func)
- update_sheet_box()
- def del_ndim():
- global learner_controller
- learner_controller.del_ndim(get_name())
- update_sheet_box()
- def reval():
- global learner_controller, processing_type
- reval_type = processing_type.get()
- learner_controller.reval(get_name(), reval_type)
- update_sheet_box()
- def two_split():
- global learner_controller, processing_type, shape
- split_type = processing_type.get()
- learner_controller.two_split(get_name(), shape.get(), split_type)
- update_sheet_box()
- def split():
- global learner_controller, processing_type, shape
- split_type = processing_type.get()
- try:
- split_shape_list = eval(f"[{shape.get()}]", {})[0]
- except BaseException:
- split_shape_list = 2
- learner_controller.split(get_name(), split_shape_list, split_type)
- update_sheet_box()
- def merge():
- global merge_list, learner_controller, processing_type
- if len(merge_list) < 1:
- return False
- merge_type = processing_type.get()
- learner_controller.merge(merge_list, merge_type)
- update_sheet_box()
- def update_merge_box():
- 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_box()
- def merge_add():
- global merge_list
- name = get_name()
- merge_list.append(name)
- update_merge_box()
- def visualization_results():
- learner = get_learner(True)
- save_dir = askdirectory(title="选择保存位置")
- data = learner_controller.model_visualization(learner, save_dir)
- webbrowser.open(data[0])
- webbrowser.open(data[1]) # 还可以打开文件管理器
- update_sheet_box()
- def get_learner_parameters():
- global learner_parameters
- return learner_parameters.get("0.0", tkinter.END)
- def score_learner():
- learner = get_learner()
- socore = learner_controller.score(
- get_name(False, True), get_name(False, False), learner
- )
- tkinter.messagebox.showinfo("测试完成", f"针对测试数据评分结果为:{socore}")
- def predict_learner():
- learner = get_learner()
- data = learner_controller.predict(get_name(False, True), learner)
- title = f"CoTan数据处理 学习器:{learner}"
- creat_text_sheet(data, title)
- update_sheet_box()
- def fit_learner():
- learner = get_learner()
- try:
- split = float(data_split.get())
- if split < 0 or 1 < split:
- raise Exception
- except BaseException:
- split = 0.3
- socore = learner_controller.fit_model(
- get_name(False, True),
- get_name(False, False),
- learner,
- Text=get_learner_parameters(),
- split=split,
- )
- tkinter.messagebox.showinfo(
- "训练完成",
- f"针对训练数据({(1 - split) * 100}%)评分结果为:{socore[0]}\n"
- f"针对测试数据评分({split * 100}%)结果为:{socore[1]}",
- )
- def set_x_data():
- global x_data
- x_data.set(get_name())
- def set_y_data():
- global y_data
- y_data.set(get_name())
- def set_learner():
- global learner_output
- learner_output.set(get_learner(True))
- def get_learner(return_box=False):
- global learn_dict, learner_box, learner_output
- if return_box:
- try:
- return list(learn_dict.keys())[learner_box.curselection()[0]]
- except BaseException:
- try:
- return list(learn_dict.keys)[0]
- except BaseException:
- return get_learner(False)
- else:
- try:
- return learner_output.get()
- except BaseException:
- return None
- def add_statistics(): # 添加Lenear的核心
- add_leaner("Statistics")
- def add_correlation():
- add_leaner("Correlation")
- def add_matrix_scatter():
- add_leaner("MatrixScatter")
- def add_view_data():
- learner_controller.add_view_data(get_learner(), parameters=get_learner_parameters())
- update_leaner()
- def add_cluster_tree():
- add_leaner("ClusterTree")
- def add_feature_y_x():
- add_leaner("FeatureY-X")
- def add_numpy_to_heatmap():
- add_leaner("HeatMap")
- def add_predictive_heatmap_more(): # 添加Lenear的核心
- learner_controller.add_predictive_heat_map_more(
- get_learner(), parameters=get_learner_parameters()
- )
- update_leaner()
- def add_predictive_heatmap(): # 添加Lenear的核心
- learner_controller.add_predictive_heat_map(
- get_learner(), parameters=get_learner_parameters()
- )
- update_leaner()
- def add_feature_scatter_class_all():
- add_leaner("FeatureScatterClass_all")
- def add_feature_scatter_all():
- add_leaner("FeatureScatter_all")
- def add_feature_scatter_class():
- add_leaner("FeatureScatterClass")
- def add_feature_scatter():
- add_leaner("FeatureScatter")
- def add_class_bar():
- add_leaner("ClassBar")
- def add_dbscan():
- add_leaner("DBSCAN")
- def add_agglomerative():
- add_leaner("Agglomerative")
- def add_k_means():
- 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_gradient_tree():
- add_leaner("GradientTree")
- def add_gradient_tree_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_one_hot_encoder():
- 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_sigmod_scaler():
- add_leaner("sigmodScaler")
- def add_decimal_scaler():
- add_leaner("decimalScaler")
- def add_atan_scaler():
- add_leaner("atanScaler")
- def add_log_scaler():
- add_leaner("LogScaler")
- def add_min_max_scaler():
- 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_select_k_best():
- add_leaner("SelectKBest")
- def add_knn_class():
- add_leaner("Knn_class")
- def add_logistic_regression():
- 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_select_from_model(): # 添加Lenear的核心
- learner_controller.add_select_from_model(
- get_learner(), parameters=get_learner_parameters()
- )
- update_leaner()
- def add_leaner(learner_type): # 添加Lenear的核心
- learner_controller.add_learner(learner_type, parameters=get_learner_parameters())
- update_leaner()
- def update_leaner():
- global learn_dict, learner_box
- learn_dict = learner_controller.return_learner()
- learner_box.delete(0, tkinter.END)
- learner_box.insert(tkinter.END, *learn_dict.keys())
- def to_html_one():
- global PATH, to_html_type
- html_dir = f"{PATH}/$Show_Sheet.html"
- try:
- name = get_name()
- if name is None:
- raise Exception
- learner_controller.to_html_one(name, html_dir)
- webbrowser.open(html_dir)
- except BaseException:
- # pass
- raise
- def to_html():
- global PATH, to_html_type
- html_dir = f"{PATH}/$Show_Sheet.html"
- try:
- name = get_name()
- if name is None:
- raise Exception
- learner_controller.to_html(name, html_dir, to_html_type.get())
- webbrowser.open(html_dir)
- except BaseException:
- pass
- def to_csv():
- global SCREEN, sep, encoding, dtype_str
- save_dir = asksaveasfilename(title="选择保存的CSV", filetypes=[("CSV", ".csv")])
- csv_sep = sep.get()
- name = get_name()
- learner_controller.to_csv(save_dir, name, csv_sep)
- update_sheet_box()
- def add_csv():
- global SCREEN, sep, encoding, dtype_str, sheet_name
- csv_dir = askopenfilename(title="选择载入的CSV", filetypes=[("CSV", ".csv")])
- if csv_dir == "":
- return False
- the_sep = sep.get()
- the_encoding = encoding.get()
- must_str = bool(dtype_str.get())
- name = sheet_name.get().replace(" ", "")
- if name == "":
- name = os.path.splitext(os.path.split(csv_dir)[1])[0]
- if the_encoding == "":
- with open(csv_dir, "rb") as f:
- the_encoding = chardet.detect(f.read())["encoding"]
- if the_sep == "":
- the_sep = ","
- learner_controller.read_csv(
- csv_dir, name, the_encoding, must_str, the_sep,
- )
- update_sheet_box()
- def add_python():
- global SCREEN, sep, encoding, dtype_str
- python_dir = askopenfilename(
- title="选择载入的py", filetypes=[("Python", ".py"), ("Txt", ".txt")]
- )
- name = sheet_name.get().replace(" ", "")
- if name == "":
- name = os.path.splitext(os.path.split(python_dir)[1])[0]
- with open(python_dir, "r") as f:
- learner_controller.add_python(f.read(), name)
- update_sheet_box()
- def get_name(get_from_box=True, is_x_data=True): # 获得名字统一接口
- global sheet_list, sheet_box, x_data
- if get_from_box:
- try:
- return sheet_list[sheet_box.curselection()[0]]
- except BaseException:
- try:
- return sheet_list[0]
- except BaseException:
- return None
- else:
- try:
- if is_x_data:
- return x_data.get()
- else:
- return y_data.get()
- except BaseException:
- return None
- def update_sheet_box():
- global SCREEN, sheet_box, sheet_list
- sheet_list = list(learner_controller.get_form().keys())
- sheet_box.delete(0, tkinter.END)
- sheet_box.insert(tkinter.END, *sheet_list)
- def creat_text_sheet(data, name):
- global bg_color
- new_top = tkinter.Toplevel(bg=bg_color)
- 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)
- SCREEN.title("CoTan机器学习")
- SCREEN.resizable(width=False, height=False)
- SCREEN.geometry("+10+10") # 设置所在位置
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="导入CSV",
- command=add_csv,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="导入Py",
- command=add_python,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="导出CSV",
- command=to_csv,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Label(
- SCREEN,
- text="表格名称:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- sheet_name = tkinter.Entry(SCREEN, width=gui_width)
- sheet_name.grid(
- column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="删除表格",
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="查看表格",
- command=to_html,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="查看单一表格",
- command=to_html_one,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- to_html_type = tkinter.IntVar() # 正,负,0
- lable = ["选项卡型", "可移动型", "自适应型"] # 复选框
- for i in range(3):
- tkinter.Radiobutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text=lable[i],
- variable=to_html_type,
- value=i,
- ).grid(column=column + i, row=row, sticky=tkinter.W)
- dtype_str = tkinter.IntVar()
- row += 1
- tkinter.Label(
- SCREEN,
- text="编码方式:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- encoding = tkinter.Entry(SCREEN, width=gui_width)
- encoding.grid(column=column + 1, row=row, sticky=tkinter.E + tkinter.W)
- buttom = tkinter.Checkbutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text="字符串类型",
- variable=dtype_str,
- )
- buttom.grid(column=column + 2, row=row, sticky=tkinter.W)
- row += 1
- tkinter.Label(
- SCREEN,
- text="CSV分隔符:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- sep = tkinter.Entry(SCREEN, width=gui_width)
- sep.grid(column=column + 1, columnspan=2, row=row, sticky=tkinter.E + tkinter.W)
- row += 1
- sheet_box = tkinter.Listbox(
- SCREEN, width=gui_width * 3, height=gui_height * 10
- ) # 显示符号
- sheet_box.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=10,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- # 422
- row += 10
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="添加数据",
- command=merge_add,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="删除数据",
- command=merge_del,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="组合数据",
- command=merge,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- merge_box = tkinter.Listbox(
- SCREEN, width=gui_width * 3, height=gui_height * 3
- ) # 显示符号
- merge_box.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=3,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 3
- processing_type = tkinter.IntVar() # 正,负,0
- lable = ["横向处理", "纵向处理", "深度处理"] # 复选框
- for i in range(3):
- tkinter.Radiobutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text=lable[i],
- variable=processing_type,
- value=i,
- ).grid(column=column + i, row=row, sticky=tkinter.W)
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="数据切片",
- command=two_split,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="数据分割",
- command=split,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- columnspan=2,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Label(
- SCREEN,
- text="重塑形状:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column, row=row)
- shape = tkinter.Entry(SCREEN, width=gui_width)
- shape.grid(column=column + 1, row=row, sticky=tkinter.E + tkinter.W)
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="矩阵重塑",
- command=reshape,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="矩阵伸展",
- command=reval,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="矩阵降维",
- command=del_ndim,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="矩阵转置",
- command=transpose,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- column += 3
- tkinter.Label(SCREEN, text="", bg=bg_color, fg=word_color, font=FONT, width=1).grid(
- column=column, row=row
- ) # 设置说明
- column += 1
- row = 0
- tkinter.Label(
- SCREEN,
- text="【机器学习】",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width * 3,
- height=gui_height,
- ).grid(
- column=column,
- columnspan=3,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- ) # 设置说明
- row += 1
- x_data = tkinter.StringVar()
- put = tkinter.Entry(SCREEN, width=gui_width * 2, textvariable=x_data)
- put.grid(column=column, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
- put["state"] = "readonly"
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="选用X集",
- command=set_x_data,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column + 2, row=row, sticky=tkinter.E + tkinter.W)
- y_data = tkinter.StringVar()
- row += 1
- put = tkinter.Entry(SCREEN, width=gui_width * 2, textvariable=y_data)
- put.grid(column=column, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
- put["state"] = "readonly"
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="选用Y集",
- command=set_y_data,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column + 2, row=row, sticky=tkinter.E + tkinter.W)
- learner_output = tkinter.StringVar()
- row += 1
- put = tkinter.Entry(SCREEN, width=gui_width * 2, textvariable=learner_output)
- put.grid(column=column, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
- put["state"] = "readonly"
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="选用学习器",
- command=set_learner,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column + 2, row=row, sticky=tkinter.E + tkinter.W)
- row += 1
- tkinter.Label(
- SCREEN,
- text="测试数据分割:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column, row=row)
- data_split = tkinter.Entry(SCREEN, width=gui_width * 2)
- data_split.grid(
- column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W
- )
- row += 1
- learner_box = tkinter.Listbox(SCREEN, width=gui_width * 3, height=gui_height * 5)
- learner_box.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=5,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 5
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="导入学习器",
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="查看数据",
- command=visualization_results,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="删除学习器",
- command=del_leaner,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="训练机器",
- command=fit_learner,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="测试机器",
- command=score_learner,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="数据预测",
- command=predict_learner,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="单一变量特征选择",
- command=add_select_k_best,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- columnspan=2,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="映射标准化",
- command=add_mapzoom,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="方差特征选择",
- command=add_variance,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="使用学习器筛选",
- command=add_select_from_model,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="模糊量化标准化",
- command=add_fuzzy_quantization,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="Z-score",
- command=add_z_score,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="离差标准化",
- command=add_min_max_scaler,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="Log变换",
- command=add_log_scaler,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="atan变换",
- command=add_atan_scaler,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="小数定标准化",
- command=add_decimal_scaler,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="Sigmod变换",
- command=add_sigmod_scaler,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="正则化",
- command=add_regularization,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="二值离散",
- command=add_binarizer,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="多值离散",
- command=add_discretization,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="独热编码",
- command=add_one_hot_encoder,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="数字编码",
- command=add_label,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="缺失填充",
- command=add_missed,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="PCA降维",
- command=add_pca,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="RPCA降维",
- command=add_rpca,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="KPCA升维",
- command=add_kpca,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="LDA降维",
- command=add_lda,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="NMF降维",
- command=add_nmf,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="t-SNE",
- command=add_tsne,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="线性回归",
- command=add_line,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="岭回归",
- command=add_ridge,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="Lasso",
- command=add_lasso,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="逻辑回归",
- command=add_logistic_regression,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="K邻近预测",
- command=add_knn,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="K邻近分类",
- command=add_knn_class,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="梯度回归树回归",
- command=add_gradient_tree,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="决策树回归",
- command=add_tree,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="决策树分类",
- command=add_tree_class,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="梯度回归树分类",
- command=add_gradient_tree_class,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="随机森林回归",
- command=add_forest,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="随机森林分类",
- command=add_forest_class,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- column += 3
- tkinter.Label(SCREEN, text="", bg=bg_color, fg=word_color, font=FONT, width=1).grid(
- column=column, row=row
- ) # 设置说明
- column += 1
- row = 0
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="多层感知机回归",
- command=add_mlp,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="多层感知机分类",
- command=add_mlp_class,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="随机森林分类",
- command=add_forest_class,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="支持向量机分类:SVC",
- command=add_svc,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- columnspan=2,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="回归:SVR",
- command=add_svr,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="k-means",
- command=add_k_means,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="凝聚聚类",
- command=add_agglomerative,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="DBSCAN",
- command=add_dbscan,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="特征分类图",
- command=add_class_bar,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="临近特征回归图",
- command=add_feature_scatter,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="临近特征分类图",
- command=add_feature_scatter_class,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="所有特征回归图",
- command=add_feature_scatter_all,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="所有特征分类图",
- command=add_feature_scatter_class_all,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="临近特征预测图",
- command=add_predictive_heatmap,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="所有特征预测图",
- command=add_predictive_heatmap_more,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="矩阵热力图",
- command=add_numpy_to_heatmap,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="数据y-x散点图",
- command=add_feature_y_x,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="聚类树状图",
- command=add_cluster_tree,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="获取数据",
- command=add_view_data,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="矩阵散点图",
- command=add_matrix_scatter,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="特征相关性",
- command=add_correlation,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="曲线拟合",
- command=curve_fitting,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="快速傅里叶",
- command=add_fast_fourier,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="数据统计",
- command=add_statistics,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="双逆向傅里叶",
- command=add_reverse_fast_fourier2,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="逆向傅里叶",
- command=add_reverse_fast_fourier,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="分类模型评估",
- command=show_class_score,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="回归模型评估",
- command=show_regression_score,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="聚类模型评估",
- command=show_clustering_score,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Label(
- SCREEN,
- text="【学习器配置】",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width * 3,
- height=gui_height,
- ).grid(
- column=column,
- columnspan=3,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- ) # 设置说明
- row += 1
- global_settings = []
- lable = ["聚类仅邻近特征", "导出单独页面", "导出表格CSV"] # 复选框
- for i in range(3):
- global_settings.append(tkinter.IntVar())
- tkinter.Checkbutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text=lable[i],
- variable=global_settings[-1],
- command=global_seeting,
- ).grid(column=column + i, row=row, sticky=tkinter.W)
- row += 1
- lable = ["导出模型", "压缩为tar.gz", "创建新目录"] # 复选框
- for i in range(3):
- global_settings.append(tkinter.IntVar())
- tkinter.Checkbutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text=lable[i],
- variable=global_settings[-1],
- command=global_seeting,
- ).grid(column=column + i, row=row, sticky=tkinter.W)
- for i in global_settings[1:]:
- i.set(1)
- global_seeting()
- row += 1
- learner_parameters = tkinter.Text(
- SCREEN, width=gui_width * 3, height=gui_height * 6
- )
- learner_parameters.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=6,
- sticky=tkinter.E + tkinter.W + tkinter.N + tkinter.S,
- )
- row += 6
- tkinter.Label(
- SCREEN,
- text="【矩阵运算】",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width * 3,
- height=gui_height,
- ).grid(
- column=column,
- columnspan=3,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- ) # 设置说明
- row += 1
- calculation_box = tkinter.Listbox(
- SCREEN, width=gui_width * 3, height=gui_height * 1
- )
- calculation_box.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=1,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Label(
- SCREEN,
- text="运算类型:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column, row=row)
- calculation_type = tkinter.Entry(SCREEN, width=gui_width * 2)
- calculation_type.grid(
- column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W
- )
- row += 1
- tkinter.Label(
- SCREEN,
- text="键入参数:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column, row=row)
- value = tkinter.Entry(SCREEN, width=gui_width * 2)
- value.grid(column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
- row += 1
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="选择参数",
- command=add_calculation_object,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="键入参数",
- command=add_calculation_number,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=botton_color,
- fg=word_color,
- text="矩阵运算",
- command=calculation,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
|