Example #1
0
 def plot_training_curve(self, xticks_step=5):
     evolution = pd.DataFrame({
         'Generation': self.log.select("gen"),
         'Max Accuracy': self.log.select("max"),
         'Average Accuracy': self.log.select("avg"),
         'Min Accuracy': self.log.select("min")
     })
     plt.title('Hyperparameter Optimisation')
     plt.plot(evolution['Generation'],
              evolution['Min Accuracy'],
              'b',
              color='C1',
              label='Min')
     plt.plot(evolution['Generation'],
              evolution['Average Accuracy'],
              'b',
              color='C2',
              label='Average')
     plt.plot(evolution['Generation'],
              evolution['Max Accuracy'],
              'b',
              color='C3',
              label='Max')
     plt.legend(loc='lower right')
     plt.ylabel('Accuracy')
     plt.xlabel('Generation')
     plt.xticks(
         [x for x in range(0, self.number_of_generations + 1, xticks_step)])
     plt.show()
Example #2
0
 def fit(self):
     self.X_embedded = TSNE(n_components=self.n_comp,
                            perplexity=self.perplexity,
                            verbose=self.verbose,
                            init=self.init).fit_transform(self.data)
     self.df_embedded = pd.DataFrame(
         {f'{n+1}d': self.X_embedded[:, n]
          for n in range(self.n_comp)})
Example #3
0
 def get_centroids(self):
     centroid_df = pd.DataFrame(self.X_projected)
     centroid_df[self.category_label] = self.categories
     df_centroids_projected = get_centroids_from_categories(
         centroid_df, self.category_label)
     X_centroids_projected = df_centroids_projected.values
     centroids_categories = df_centroids_projected.index
     return X_centroids_projected, centroids_categories
Example #4
0
 def fit(self):
     self.pca.fit(self.X_scaled)
     self.X_projected = self.pca.transform(self.X_scaled)
     # Components table
     components_cols = ["F{}".format(n + 1) for n in range(self.n_comp)]
     self.components_table = pd.DataFrame(self.X_projected,
                                          index=self.categories,
                                          columns=components_cols)
     self.default_factorial_plan_nb = self.kaiser_criterion(
         pair_comp=True) / 2
Example #5
0
    def fit(self):
        """

        """
        self.pca.fit(self.X_scaled)
        self.X_projected = self.pca.transform(self.X_scaled)
        self.evr = self.pca.explained_variance_ratio_
        # Components table
        components_cols = ["F{}".format(n + 1) for n in range(self.n_comp)]
        self.components_table = pd.DataFrame(self.X_projected,
                                             index=self.categories,
                                             columns=components_cols)
        self.default_factorial_plan_nb = int(self.kaiser_criterion() // 2)