script for gen images

This commit is contained in:
Malte Tammena 2024-05-17 09:36:52 +02:00
parent 91b51fe38b
commit 3c0f8f83f1
2 changed files with 44 additions and 1 deletions

View file

@ -186,7 +186,7 @@
};
devShells.default = let
python = pkgs.python3.withPackages (ps: [ps.torch ps.torchvision ps.psutil]);
python = pkgs.python3.withPackages (ps: [ps.torch ps.torchvision ps.psutil ps.pandas ps.matplotlib ps.seaborn]);
in
craneLib.devShell {
# Inherit inputs from checks.

43
scripts/test.py Executable file
View file

@ -0,0 +1,43 @@
#!/usr/bin/env python3
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def read_and_visualize(csv_file):
# Read the CSV file
df = pd.read_csv(csv_file)
# Display the first few rows of the dataframe
print(df.head())
# Identify all the properties (assuming they are all columns except for 'runtime')
properties = [col for col in df.columns if col != 'speedup' and col != 'time' and col != 'stddev']
# Pairplot to see general pairwise relationships, may help to understand the overall relationship between properties and runtime
sns.pairplot(df)
plt.suptitle('Pairplot of Properties and Runtime', y=1.02)
plt.show()
# Create scatter plots for each property against runtime
for prop in properties:
plt.figure(figsize=(10, 6))
sns.scatterplot(x=df[prop], y=df['runtime'])
plt.title(f'Impact of {prop} on Runtime')
plt.xlabel(prop)
plt.ylabel('Runtime')
plt.show()
# Create box plots for categorical properties if any (e.g., difficulty level or type) against runtime
for prop in properties:
if df[prop].dtype == 'object':
plt.figure(figsize=(10, 6))
sns.boxplot(x=df[prop], y=df['runtime'])
plt.title(f'Impact of {prop} on Runtime')
plt.xlabel(prop)
plt.ylabel('Runtime')
plt.show()
# Example usage
csv_file = 'all.csv' # Replace with your actual CSV file path
read_and_visualize(csv_file)