Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/msmathcomp/hyperbolic-tsne
03 May 2024, 17:35:23 UTC
  • Code
  • Branches (2)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • refs/heads/related_works
    No releases to show
  • 477dbb2
  • /
  • experiments_and_plots
  • /
  • plot_asymptotic_order_box_plot_per_exact_or_accelerated.py
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:cbd80040afe6f0ea448ec7019b2fef9edaa07e51
origin badgedirectory badge Iframe embedding
swh:1:dir:2caf0882678a2a4775b9907fdf5d8d473a34240f
origin badgerevision badge
swh:1:rev:bba9d0f089659fb170c7270aa90c796f91bfb2b1
origin badgesnapshot badge
swh:1:snp:9ac5f55368e393bdd437f6b15aab9fdb4f438510
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: bba9d0f089659fb170c7270aa90c796f91bfb2b1 authored by Martin Skrodzki on 02 May 2024, 12:34:19 UTC
Update README.md
Tip revision: bba9d0f
plot_asymptotic_order_box_plot_per_exact_or_accelerated.py
"""
This script creates a plot to compare the estimated asymptotic order of convergence for the experiments run on each
data set. The boxes are grouped by the accelerated runs, i.e, thos that use the polar quad tree, and the exact, i.e.,
the non-accelerated ones.
"""

###########
# IMPORTS #
###########

from pathlib import Path
import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt

####################
# READING THE DATA #
####################
results_path = Path("../results/samples_per_data_set/")
df = pd.read_csv(results_path.joinpath("overview.csv"))
timings_dfs = []
for record in df.to_records():
    timing_df = pd.read_csv(record.run_directory.replace(".", str(results_path)) + "/timings.csv")
    timing_df = timing_df[(timing_df.time_type == "tot_gradient")]

    for cn in df.columns:
        timing_df[cn] = record[cn]
    timings_dfs.append(timing_df)

timings_df = pd.concat(timings_dfs, axis=0, ignore_index=True)
timings_df["early_exag"] = np.repeat(False, timings_df.shape[0])
timings_df.loc[timings_df.it_n <= 250, "early_exag"] = True
del timings_dfs

# Compute the asymptotic estimates
grouping_vars = ["dataset", "tsne_type"]
plot_asymptotic_df = timings_df.copy()
plot_asymptotic_df = plot_asymptotic_df[(plot_asymptotic_df.splitting_strategy == "equal_length")]
plot_asymptotic_df["log_size"] = np.log(plot_asymptotic_df.sample_size)
plot_asymptotic_df["log_total_time"] = np.log(plot_asymptotic_df.total_time)
plot_asymptotic_df = plot_asymptotic_df.groupby(
    grouping_vars + ["sample_size", "log_size", ]
)["log_total_time"].agg(mu_log_total_time=np.mean, std_log_total_time=np.std).reset_index()
diff_df = plot_asymptotic_df.groupby(grouping_vars).diff(periods=-1)
diff_df.columns = ["diff_" + cn for cn in diff_df.columns]
plot_asymptotic_df = pd.concat([plot_asymptotic_df, diff_df], axis=1)
plot_asymptotic_df["asymptotic_score"] = plot_asymptotic_df.diff_mu_log_total_time/plot_asymptotic_df.diff_log_size
plot_asymptotic_df = plot_asymptotic_df.dropna(axis=0)

##############
# PLOT SETUP #
##############
sns.set_palette("colorblind")
modes = timings_df.dataset.unique()
colors = sns.color_palette('colorblind', len(modes))
palette = {mode: color for mode, color in zip(modes, colors)}

#####################
# PLOTTING THE DATA #
#####################
_, axs = plt.subplots(figsize=(5, 5), ncols=1)
asym_boxplot = sns.boxplot(
    plot_asymptotic_df,
    x="tsne_type",
    y="asymptotic_score",
    hue="dataset",
    palette=palette
)
axs.set_title(f"Estimated Asymptotic Order")
axs.set_xlabel("t-SNE Type")
axs.set_ylabel("Asymptotic Order")
plt.savefig("est_asymp_order.png")

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top