<jupyter_start><jupyter_text>Import packages<jupyter_code>%matplotlib inline

import matplotlib
import matplotlib.pyplot as plt
import os
import sys
import dill
import yaml
import numpy as np
import pandas as pd
import ast

import seaborn as sns
sns.set(style='ticks')<jupyter_output><empty_output><jupyter_text>Import submodular-optimization packages<jupyter_code>sys.path.insert(1, "/home/grad3/harshal/Projects/submodular-optimization/submodular_optimization/")<jupyter_output><empty_output><jupyter_text>Visualizations directory<jupyter_code>VIZ_DIR = os.path.abspath("/home/grad3/harshal/Projects/submodular-optimization/viz/")<jupyter_output><empty_output><jupyter_text>Plotting utilities<jupyter_code>def set_style():
    # This sets reasonable defaults for font size for a paper
    sns.set_context("paper")    
    # Set the font to be serif
    sns.set(font='serif')#, rc={'text.usetex' : True})   
    # Make the background white, and specify the specific font family
    sns.set_style("white", {
        "font.family": "serif",
        "font.serif": ["Times", "Palatino", "serif"]
    })
    # Set tick size for axes
    sns.set_style("ticks", {"xtick.major.size": 6, "ytick.major.size": 6})
def set_size(fig, width=6, height=4):
    fig.set_size_inches(width, height)
    plt.tight_layout()
def save_fig(fig, filename):
    fig.savefig(os.path.join(VIZ_DIR, filename), dpi=600, format='pdf', bbox_inches='tight')<jupyter_output><empty_output><jupyter_text>Plots<jupyter_code>df = pd.read_csv("/research/data-x/submodular-optimization/experiment_01.csv",
                header=0,
                index_col=False)<jupyter_output><empty_output><jupyter_text>Performance evaluation of lazy evaluation epsilon<jupyter_code>def plot_lazy_evaluation_performance(df):
    # Cost Scaled Lazy Greedy
    g = sns.lineplot(x='lazy_epsilon', y='val', data=df[df.alg=='cost_scaled_lazy_greedy'], color='blue',
                    label='cost_scaled_lazy_greedy', marker='o')

    ax = plt.gca()
    fig = plt.gcf()
    
    # Cost Distorted Greedy
    distorted_greedy_performance = df[df.alg=='distorted_greedy'].iloc[0]['val']
    ax.hlines(y=distorted_greedy_performance, xmin=0.01, xmax=0.99, color='red', linestyle=':',
              label='distorted_greedy')
    
    # Legend
    labels = ['cost_scaled_lazy_greedy', 'distorted_greedy']
    handles, _ = ax.get_legend_handles_labels()
    plt.legend(handles=handles, labels=labels)

    plt.xlabel('Epsilon value during lazy evaluation')
    plt.ylabel('Value of objective function')
    plt.title('Performance of Lazy Greedy Algorithms')
    return fig, ax
df0 = df[df.scaling_factor==1]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)
df0 = df[df.scaling_factor==50]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)
df0 = df[df.scaling_factor==100]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)
df0 = df[df.scaling_factor==200]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)
df0 = df[df.scaling_factor==300]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)
df0 = df[df.scaling_factor==400]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)
df0 = df[df.scaling_factor==500]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)
df0 = df[df.scaling_factor==600]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)
df0 = df[df.scaling_factor==700]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)
df0 = df[df.scaling_factor==800]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)
df0 = df[df.scaling_factor==900]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)
df0 = df[df.scaling_factor==1000]
set_style()
fig, ax = plot_lazy_evaluation_performance(df0)
set_size(fig, 10, 8)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13216957605985039, 'fraction_numerical': 0.028428927680798004, 'mean_word_length': 5.72986577181208, 'pattern_counts': {'":': 4, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '459994', 'license': 'MIT', 'n_tokens_mistral': 1625, 'n_tokens_neox': 1502, 'n_words': 269, 'path': 'jupyter/.ipynb_checkpoints/Experiment_01-checkpoint.ipynb', 'repo_name': 'smnikolakaki/submodular-linear-cost-maximization', 'size': '4010'}