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_time_per_embedding_run_vs_theta_values.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:ed962b4d11e5ae97df8e188bb90faf254744d674
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_time_per_embedding_run_vs_theta_values.py
"""
This script creates a plot to show how the time spent on the computation of an embedding behaves when changing the
parameter Theta for the acceleration. One line is plotted per data set.
"""

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

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

####################
# READING THE DATA #
####################

results_path = Path("../results/timings_per_theta/")
data = []
for subdir, dirs, files in os.walk(results_path):
    for file in files:
        if str(os.path.basename(os.path.join(subdir, file))) == "timings.csv":
            dataset = str(subdir).split('/')[-3]
            theta = float(str(subdir).split('/')[-1].split('_')[-1])
            timing_df = pd.read_csv(os.path.join(subdir, file))
            timing_df = timing_df[(timing_df.time_type == "tot_gradient")]
            average_time = float(timing_df[["total_time"]].mean())
            data.append({
                    "dataset": dataset,
                    "theta": theta,
                    "average_time": average_time
            })
average_times = pd.DataFrame(data)
average_times.loc[average_times.dataset == "LUKK", "order"] = 1
average_times.loc[average_times.dataset == "MYELOID8000", "order"] = 2
average_times.loc[average_times.dataset == "PLANARIA", "order"] = 3
average_times.loc[average_times.dataset == "MNIST", "order"] = 4
average_times.loc[average_times.dataset == "WORDNET", "order"] = 5
average_times.loc[average_times.dataset == "C_ELEGANS", "order"] = 6
average_times = average_times.sort_values(by="order", ascending=True)

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

#####################
# PLOTTING THE DATA #
#####################

_, axs = plt.subplots(figsize=(5, 5), ncols=1, layout="tight")
times_lineplot = sns.lineplot(
    data=average_times,
    x="theta",
    y="average_time",
    hue="dataset",
    palette=palette,
    markers=False,
    linewidth=linewidth,
    ax=axs
)
times_lineplot.set(yscale='log')
axs.set_title(f"Average Total Time per Iteration vs Theta")
axs.set_xlabel("Theta")
axs.set_ylabel("log(Time (Seconds))")
plt.savefig("theta_timing_plot.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