Example #1
0
 def rotate(self):
     self.coordinates_rotated = poincare_translation(
         -self.coordinates[self.iroot, :], self.coordinates)
Example #2
0
    # if os.path.isfile(log_file):
    #     df_logs = pd.read_csv(log_file)
    #     df_stats = pd.concat([df_logs, df_stats])

    # df_stats.to_csv(f'results/{opt.logfile}.csv', index=False, sep=',')

    color_dict = plotPoincareDisc(embeddings.T,
                                  labels,
                                  fout,
                                  titlename,
                                  color_dict=color_dict)

    # rotation
    root_hat = poincare_root(opt.root, labels, features)
    print('Root:', root_hat)
    if root_hat != -1:
        titlename = '{0} rotated'.format(titlename)

        poincare_coord_new = poincare_translation(-embeddings[root_hat, :],
                                                  embeddings)

        plot_poincare_disc(poincare_coord_new,
                           labels=labels,
                           coldict=color_dict,
                           file_name=fout + '_rotated',
                           d1=9.5,
                           d2=9.0)
    else:
        print("Can't perform rotation. Root node is not found.")