计算机论文代写_计算机代考_机器学习代写

python代寫 python代做 python程序代寫 python編程代寫

Python算法作業代寫,Python程序代寫 2021.9.1

Programming component

Please read the information on assignments and Python carefully to ensure that you are

using the correct version of Python and the correct style. For full marks, you are required

计算机论文代写_计算机代考_机器学习代写not only to have a correct solution, but also to adhere to the requirements of the assignment question and the style guide, including aspects of the design recipe!

Although submitting tests is not required, it is highly recommended thay you test your code. For each assignment question, create a testing file that imports your submission and tests the code. Do not submit your testing file.

计算机论文代写_计算机代考_机器学习代写The helper functions total and safe from the model solutions of Assignment 1 have been made available for your use in the file asst4helpers.py.

For any of the programming questions in this assignment / you may import any of the follow ing files: asst4helpers.py, check.py, graphs.py, equiv.py, and as well as built-in modules

such as math, itertools, copy, and random.

Be sure to read the instructions on the Python requirements page to ensure that you have imported the files as required.


Note:

P1: You can assume that weights are positive integers. P2: You can assume that weights are positive integers.

P1. [12 marks] Write a function safe_hill that consumes a graph and produces a list of IDs of vertices that forms a safe set, not necessarily of maximum total weight. You will use the heuristic of hill-climbing, starting with an arbitrary feasible solution of your choice.

At each step, you will either add a new vertex to the solution, or you will find a vertex

计算机论文代写_计算机代考_机器学习代写in the current solution to replace with a vertex outside the current solution such that the total weight of the new solution is greater than the total weight of the current solution.

计算机论文代写_计算机代考_机器学习代写If neither such change can be made, your function should stop the search and return the current solution.


Submit your work in a file with the name safehill.py.

计算机论文代写_计算机代考_机器学习代写P2. [13 marks] Write a function safe_set_bt that consumes a graph and produces a list of IDs of vertices that forms a safe set of maximum total weight. Your function should use backtracking.

Submit your work in a file with the name safesetbt.py.

測試用例自動生成與選擇程序

需求

1.能隨機生成n個測試數據作為基礎測試用例集,并將數據輸出到exel表格文件,如下圖所示(數據個數、數據范圍和維度可以自定義,比如隨機生成-100 ~ 100 的整數數據,維度選擇1、2、3維)。


2.隨機生成k個測試數據放入基礎測試用例集(個數自選,維度和上面一樣)。新增了幾個測試數據如下圖所示,然后對這個測試用例集進行異常檢測。(需要循環i次)


计算机论文代写_计算机代考_机器学习代写3.異常檢測模塊(可以檢測出異常數據了,判斷異常數據是否屬于k個測試用例中的,如果是則放入到n個基礎測試用例中),下圖為一次異常檢測結果。

并將k個數據中的異常數據保留到基礎測試用例集中(假如k=3,有1個異常數據,2個正常數據,則只將1個異常的數據保留在基礎測試用例集中,異常數據的Anomaly值為1,)


異常檢測模塊代碼如下

import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"


import pandas as pd
dataset = pd.read_excel(r'C:\Users\hechen\Desktop\1.xlsx')


data = dataset.sample(frac=1, random_state=123)
data_unseen = dataset.drop(data.index)
data.reset_index(drop=True, inplace=True)
data_unseen.reset_index(drop=True, inplace=True)


from pycaret.anomaly import *
exp_ano1 = setup(data, normalize = True, session_id = 123)


iforest = create_model('iforest', fraction = 0.2)


iforest_results = assign_model(iforest)
#可以讀取到Anomaly等于1的數據
for i in range(41):
? ? if iforest_results['Anomaly'][i] == 1: ? ? ??
? ? ? ? print(iforest_results["a"][i])
? ? ? ? print(iforest_results["b"][i])
? ? ? ? print(iforest_results["c"][i])
iforest_results.head()

4.最后輸出最終的測試用例集到Excel表格,并計算此次運行時間。

微信
程序代寫,編程代寫
使用微信掃一掃關注
在線客服
歡迎在線資訊
聯系時間: 全天

在線客服

售前咨詢
售后咨詢
微信號
Essay_Cheery
微信
一站式論文代寫,硕士论文代写,essay代写,统计代写 新西兰代写assignment,CS代写,数学代写,essay代写,统计代写-Excellent due 美国代写,北美专业代写留学生论文,CS作业代写-EasyDue™ Assignment代写,美国代写网课代做,商科assignment代写网课 作业代写,論文代寫代写assignment-北美最好的一站式学术代写服务机构 代写essay,论文加急,论文代写,北美顶级代写-EssayV美国论文代写 加拿大代写assignment,英国、美国、澳洲留学生论文代写,论文代写 澳洲代写,论文代写,代写assignment,essay代写-熊猫人代写 悉尼代写assignment,作业代写,CS代写,代写金融,论文代写,Paper代写 墨尔本代写assignment,加拿大美国论文代写,北美essay代写-Panda Scholar