Python: How to categorize the request in different categories for example in 3 categories based on any 3 ex. aa, bb, cc (any):, using KMeans or any other classification technique, I need just categories. help will be highly appreciated. thanks in advance!
import random class Req(): def __init__(self,reqNum,node_num): self.reqNum = reqNum self.location = random.randint(0,node_num//10) self.firewall_demand = random.randint(300,600) self.storage_demand = random.randint(100,300) self.bandwidth_demand = random.randint(200,500) self.fw_dm = random.randint(200,400) self.st_dm = random.randint(150,350) self.bw_dm = random.randint(250,550) def createSetOfRequest(req_num, node_num): sr = [] for i in range(0, req_num): sr.append(Req(i, node_num)) return sr # (i have to categorise in 3 category, scenario will be like that you can change accordingly, this is just for example) ns = createSetOfRequest(20,200) for i in range(0,20): print(sr[i].reqNum,sr[i].firewall_demand ,sr[i].firewall_demand ,sr[i].bandwidth_demand)