Exemplo n.º 1
0
def drawDeviation(plot: matplotlib.axes.SubplotBase, samples: numpy.ndarray,
                  polyfit):
    plot.plot(samples[0],
              polyfit['deviation'],
              zorder=1,
              color='#bbf',
              linewidth=1)
Exemplo n.º 2
0
 def plot_1_1(ax: matplotlib.axes.SubplotBase, df_pred_str: pd.DataFrame, df_pred_str_null: pd.DataFrame, rows_set: np.ndarray) -> None:
     mu, sigma = ClusteringUtils.calc_distribution(df_pred_str.loc[rows_set])
     mu_null, sigma_null = ClusteringUtils.calc_distribution(df_pred_str_null.loc[rows_set])
     y = pd.DataFrame([
         mu - sigma,
         mu,
         mu + sigma,
         mu_null - sigma_null,
         mu_null,
         mu_null + sigma_null
     ]).transpose()
     x = pd.DataFrame([df_pred_str.columns for _ in range(len(y.columns))]).transpose()
     lty = ["--", "-", "--", "--", "-", "--"]
     lwd = [1, 2, 1, 1, 2, 1]
     colors = ["blue", "blue", "blue", "red", "red", "red"]
     legend_lines = [
         Line2D([0], [0], color="blue", linestyle="-", linewidth=2),
         Line2D([0], [0], color="red", linestyle="-", linewidth=2),
         Line2D([0], [0], color="gray", linestyle="--", linewidth=1)
     ]
     for col in x.columns:
         ax.plot(x[col], y[col], color=colors[col], linestyle=lty[col], linewidth=lwd[col])
         ax.set_xlabel("k")
         ax.set_ylabel("prediction strength")
     ax.legend(legend_lines, ["model", "null", "95% CI"], loc='upper right')
Exemplo n.º 3
0
def drawFit(plot: matplotlib.axes.SubplotBase, samples: numpy.ndarray,
            polyfit):
    # plot options https://matplotlib.org/tutorials/introductory/pyplot.html
    # plot linear graph between min and max sample values
    predict = numpy.poly1d(polyfit['model'])
    linear_x = [min(samples[0]), max(samples[0])]
    linear_y = predict(linear_x)
    plot.plot(linear_x, linear_y, color='red', zorder=2)
 def _plot_roc(self, axis: mpl.axes.SubplotBase, y_true: np.ndarray,
               y_pred: np.ndarray, label: str, color: str):
     x, y, _ = roc_curve(y_true, y_pred)
     axis.plot(x,
               y,
               color,
               label="{label}, area={auc:.2f}".format(auc=auc(x, y),
                                                      label=label))
     axis.plot([0, 1], [0, 1], 'k--')
     axis.set_xlabel("False Positive Rate")
     axis.set_ylabel("True Positive Rate")
     axis.set_title("ROC curves - {label}".format(label=label))
Exemplo n.º 5
0
 def plot_2_2(ax: matplotlib.axes.SubplotBase, df_eff_k: pd.DataFrame, rows_set: np.ndarray) -> None:
     lty = ["--", "-", "--"]
     lwd = [1, 2, 1]
     mu, sigma = ClusteringUtils.calc_distribution(df_eff_k.loc[rows_set])
     y = pd.DataFrame([mu - sigma, mu, mu + sigma]).transpose()
     for col in y.columns:
         ax.plot(df_eff_k.columns, y[col], color="red", linestyle=lty[col], linewidth=lwd[col])
         ax.set_xlabel("k")
         ax.set_ylabel("effective k")
         ax.set_xlim(1, df_eff_k.columns.max())
         ax.set_ylim(1, df_eff_k.columns.max())
     abline_vals = np.array(ax.get_xlim())
     ax.plot(abline_vals, abline_vals, color="grey", linestyle="--")