Ejemplo n.º 1
0
    def visualize(self, xs, estimates, answers):
        # print("dataset visualize")
        # print(f"self.name{self.name}")
        if self.name == 'abalone':
            for n in range(len(xs)):
                x, est, ans = xs[n], estimates[n], answers[n]
                xstr = mu.vector_to_str(x, '%4.2f')
                print('{} => 추정 {:4.1f} : 정답 {:4.1f}'.
                      format(xstr, est[0], ans[0]))
        elif self.name == 'pulsar':

            for n in range(len(xs)):
                x, est, ans = xs[n], estimates[n], answers[n]
                xstr = mu.vector_to_str(x, '%5.1f', 3)
                estr = self.target_names[int(round(est[0]))]
                astr = self.target_names[int(round(ans[0]))]
                rstr = 'O'
                if estr != astr: rstr = 'X'
                print('{} => 추정 {}(확률 {:4.2f}) : 정답 {} => {}'.format(xstr, estr, est[0], astr, rstr))

        elif self.name == 'steel':

            mu.show_select_results(estimates, answers, self.target_names)

        elif self.name == 'pulsarselect':

            mu.show_select_results(estimates, answers, self.target_names)

        elif self.name == 'flower':

            mu.draw_images_horz(xs, self.image_shape)
            mu.show_select_results(estimates, answers, self.target_names)


        elif self.name == 'office31':
            # print(f"estimates{estimates}\n{answers}")
            mu.draw_images_horz(xs, self.image_shape)
            # print(f"estimates type {type(estimates)} shape {estimates.shape}")
            ests, anss = np.hsplit(estimates, self.cnts), np.hsplit(answers, self.cnts)

            captions = ['도메인', '상품']
            # print(f"self.target_names,{len(self.target_names[0])},\n,{len(self.target_names[1])}")
            for m in range(2):
                print('[ {} 추정결과 ]'.format(captions[m]))
                print(f"ests[{m}]{ests[m].shape}")
                mu.show_select_results(ests[m], anss[m], self.target_names[m], 8)
Ejemplo n.º 2
0
 def visualize(self, xs, estimates, answers):
     for n in range(len(xs)):
         x, est, ans = xs[n], estimates[n], answers[n]
         xstr = mu.vector_to_str(x, '%5.1f', 3)
         estr = self.target_names[int(round(est[0]))]
         astr = self.target_names[int(round(ans[0]))]
         rstr = 'O'
         if estr != astr: rstr = 'X'
         print('{} => 추정 {}(확률 {:4.2f}) : 정답 {} => {}'.format(
             xstr, estr, est[0], astr, rstr))
Ejemplo n.º 3
0
 def visualize(self, xs, estimates, answers):
     for n in range(len(xs)):
         x, est, ans = xs[n], estimates[n], answers[n]
         xstr = mu.vector_to_str(x, '%4.2f')
         print('{} => 추정 {:4.1f} : 정답 {:4.1f}'.format(xstr, est[0], ans[0]))