def plot_avg_vs_vp_id(self, prop, show=True):
     data = {}
     for vp in self.vps:
         data[vp.vp_id] = np.mean(
             [get_class_value(log, prop) for log in vp.logs])
     plt.plot(range(len(data)), [d[1] for d in sorted(data.items())])
     show_plot(show)
 def prop_inspection(self, prop):
     self.data_matrix(prop)
     for v in self.ttest_multiple([prop], 2):
         print(v)
     # plt.figure().canvas.set_window_title(prop)
     f, ax = plt.subplots(2, 2)
     ax = ax.flatten()
     self.boxplot_all(prop, fig=ax[0])
     self.boxplot_vs_run(prop, fig=ax[1])
     self.plot_avg_vs_run(prop, fig=ax[2], global_run_counter=True)
     self.plot_avg_vs_run(prop, fig=ax[3])
     show_plot()
 def plot_gear_probability(self):
     data = defaultdict(lambda: [[] for _ in range(5)])
     for log in self.all_logs():
         d = data[log.condition]
         for i in range(len(log.t)):
             d[log.gear[i]].append(log.speed[i])
     f, ax = plt.subplots(5)  # one plot for each gear
     for cond, d in data.items():  # each condition
         for gear, o in enumerate(d):  # each gear
             hist, bins = np.histogram(o, 30)
             x = [(bins[i] + bins[i + 1]) / 2 for i in range(len(bins) - 1)]
             ax[gear].plot(x, hist, c=condition2color(cond))
     show_plot()
 def plot_avg_vs_run(self,
                     prop,
                     global_run_counter=False,
                     show=None,
                     fig=None):
     data, max_items = self.data_vs_run(
         prop, global_run_counter=global_run_counter)
     for key, values in data.items():
         errorbar(
             np.arange(max_items) + 1,
             values,
             ylabel=prop,
             xlabel='global run counter' if global_run_counter else 'run',
             colors=condition2color(key),
             show=show,
             fig=fig)
     show_plot(show)
Beispiel #5
0
            if 0 < stop_condition < 3:
                correct = True
            else:
                print("Brak takiego kryterium")
        except ValueError:
            print("Brak takiego kryterium")

    accuracy = 0
    iteration = 0
    if stop_condition == 1:
        accuracy = abs(float(input("Podaj dokładność epsilon: ")))
        iteration = -1
    else:
        iteration = int(input("Podaj liczbe iteracji: "))
        accuracy = -1

    result_bisection = bisection(left, right, accuracy, iteration, function_number)  # miejsce zerowe (bisekcja)
    result_newton = newton(left, right, accuracy, iteration, function_number)        # miejsce zerowe (netwon)

    if result_bisection is False:
        print("Bisekcja: Funkcja nie spełnia założeń na danym przedziale")
    else:
        print("Bisekcja - " + str(result_bisection))

    if result_newton is False:
        print("Newton: Funkcja nie spełnia założeń na danym przedziale")
    else:
        print("Newton - " + str(result_newton))

    show_plot(left, right, function_number, result_bisection, result_newton)  # rysowanie wykresu