def __init__(self, settings_file): self.settings_file = settings_file self.json_file = read_json(settings_file) self.todo_size, self.history_size, self.delta_size = -1, -1, -1 self.todo_list, self.history_list, self.delta_list = [], [], [] self.get_queue_size()
def __init__(self, name, settings_file, parent=None): self.name = name self.media_type = "" self.settings = read_json(settings_file) self.parent = parent self.get_suggested_metadata()
reply_kb_university = ReplyKeyboardMarkup( [["City University of Hong Kong"], ["Hong Kong Baptist University"], ["Lingnan University"], ["The Chinese University of Hong Kong"], ["The Education University of Hong Kong"], ["The Hong Kong Polytechnic University"], ["The Hong Kong University of Science and Technology"], ["The University of Hong Kong"], ["Hang Seng University of Hong Kong"], ["Hong Kong Shue Yan University"], ["The Open University of Hong Kong"], ["Others"]], one_time_keyboard=True) # reply_kb_example = ReplyKeyboardMarkup([['Where is the library?'],['Tell me the contact of KEC']], one_time_keyboard=True) # initial the nltk parts default_tagger = nltk.tag.DefaultTagger('NN') model = read_json('json/models.json') tl_MWs = read_multiwords_json('json/multiwords.json') tags_dict = {} tagger = nltk.tag.UnigramTagger(model=model, backoff=default_tagger) tknzr = TweetTokenizer(strip_handles=True, reduce_len=True) mwtknzr = MWETokenizer(tl_MWs) stop_words = set(stopwords.words('english')) # initialize the list of information for class schedule clList = readClSchedule('schedule/MTT_2021S2_Custom.xls') def createKeyBoardLayout(btnStringList: list) -> ReplyKeyboardMarkup: for btsString in btnStringList:
pl.clf() pl.plot(x, y, label='Raw Data') for i in range(len(smoothy)): pl.plot(x, smoothy[i], label='Smooth('+str(f[i])+')') pl.legend() pl.savefig('./imgs/lowess') print "Successfully created picture file lowess.png" if __name__ == '__main__': #pdb.set_trace() import numpy as np from readjson import read_json cpu, cpu_time, mem, mem_time, load, load_time = read_json("./host2.json") #x = np.asarray(cpu_time) y=[] for i in xrange(30): y = y+cpu x = np.arange(0.0, len(y)) print "----------------- LOWESS ---------------------" def chunks(l, n): for i in xrange(0, len(l), n): yield l[i:i+n] chunk_size = 1000
from ewma import ewma_with_window ave_y = ewma_with_window(y, 0.8, 50) pl.clf() pl.plot(x, y, label="raw data") pl.plot(x, ave_y, label="EWMAverage") pl.legend() pl.savefig("./imgs/emwa_window") print "Successfully created picture file emwa_window.png" if __name__ == '__main__': #pdb.set_trace() import numpy as np from readjson import read_json cpu, cpu_time, mem, mem_time, load, load_time = read_json("./host2.json") x = np.asarray(cpu_time) y = cpu #x = np.array([[1,2,3,4,5,6],[1,232,3,41,5,6]]).reshape(2,6) #y = np.array([[1,2,2,3,4,5]]) print(x.shape) print(y.shape) print "----------------- LOWESS ---------------------" testLowess(x, y) print "------------ Liner Regression ----------------" testLinerRegression(x, y) print "------------- Poly Regression ----------------"