def __init__(self,user,percent):
     Split.__init__(self,user)
     self.percent = percent
示例#2
0
    def update(self):
        # close / reset the splits
        if key.hit(pykey.C):
            self.accrued_time.zero()
            self.prev_accrued.zero()
            self.splits = []
            self.attempts = 0
            self.update_subtitle()
            self.update_title()
            self.build_splits()
            cfg.last_file = ""

        # save the splits
        if key.hit(pykey.S):
            self.save_splits()

        # set a new title
        if key.hit(pykey.T):
            title = simpledialog.askstring("", "Title")
            if title == "" or title == None:
                title = "Untitled"
            self.update_title(title)

        # set a new sub title
        if key.hit(pykey.Y):
            subtitle = simpledialog.askstring("", "Sub Title")
            if subtitle == None:
                subtitle = ""
            self.update_subtitle(subtitle)

        # hide or unhide the splits
        if key.hit(pykey.H):
            cfg.hide_splits = int(cfg.hide_splits == 0)
            self.build_splits()

        # query to open a new split file
        if key.hit(pykey.O):
            openPath = filedialog.askopenfilename(defaultextension=".ks")
            if openPath != "":
                self.read_splits(openPath)

        # change the number of splits
        if key.hit(pykey.N):
            n = simpledialog.askstring("", "Split Count")
            if n is not None:
                n = int(n)
            else:
                n = 0
            while len(self.splits) < n:
                self.splits.append(Split(new=True))
            if n == 0:
                self.splits = []
            else:
                self.splits = self.splits[:n]
            cfg.last_file = ""
            self.build_splits()

        # enter here only if a demo is being recorded
        if mem.recording == 1 and mem.port is not None:
            if mem.intermission == 1 and self.done_intermission == 0:
                self.current_time.from_tics(mem.tics)
                self.total_time.copy(self.current_time)
                self.total_time.add_secs(self.prev_total)
                self.done_intermission = 1
                if self.maps_played <= len(self.splits):
                    self.splits[self.maps_played - 1].end(self)
                if self.maps_played == len(self.splits):
                    self.finish_run()
                self.make_sum_of_best()
            elif mem.intermission == 0:
                self.done_intermission = 0
            if self.current_map != mem.map_number:
                self.maps_played += 1
                if len(self.splits) >= self.maps_played:
                    self.splits[self.maps_played - 1].arrivals += 1
                if self.maps_played == 1:
                    self.attempts += 1
                self.current_map = mem.map_number
                self.done_intermission = 0
                self.prev_total.copy(self.total_time)
                self.prev_accrued.copy(self.accrued_time)
            self.current_time.from_tics(mem.tics)
            self.total_time.copy(self.current_time)
            self.total_time.add_secs(self.prev_total)
            self.accrued_time.copy(self.prev_accrued)
            self.accrued_time.add(self.current_time)

            # advanced-hud style notes for completion
            if mem.monsters_alive == 0:
                self.completion_label.text = "K"
            elif mem.kill_count == mem.monster_total:
                self.completion_label.text = "k"
            else:
                self.completion_label.text = ""
            if mem.items_found == mem.item_total:
                self.completion_label.text += "I"
            else:
                self.completion_label.text += ""
            if mem.secrets_found == mem.secret_total:
                self.completion_label.text += "S"
            else:
                self.completion_label.text += ""

            self.update_labels()
            #print(mX.shape)

        mX_lagged_ = np.ndarray([mX_.shape[0],mX_.shape[1],yp_lagged.shape[1]])
        for i in range(num_series):
            mf_params = mf_params_[:,i]
            for j in range(lag):
                mX, _ = Fuzzyfy.fuzzify(yp_lagged[:,i*lag+j],mf_params,num_groups=num_groups)
                mX_lagged_[:,:,i*lag+j] = mX
                #print(i*lag+j)

        form = Formulation(max_rulesize,min_activation)

        rules, rulesize, prem_terms = form.run(mX_lagged_)


        split = Split(mY_,prem_terms,num_series)
        complete_rules = split.run(rules)

        rw = Reweight(mY_,complete_rules,prem_terms)
        wd_, agg_training = rw.run('mqr',debug=True)

        defuzz = Defuzzification(mf_params_,num_series)
        y_predict_ = defuzz.run('cog',agg_training)

        f = open('results/{}_results.txt'.format(n_verify),'w')

        if diff_series:
            y__ = y_predict_ + data[lag:in_sample.shape[0]-1,:]
            yt__ = yt + data[lag:in_sample.shape[0]-1,:]

        elif detrend_series: