Skip to content

Instantly share code, notes, and snippets.

View sudarshan85's full-sized avatar

sudarshan sudarshan85

  • University of Tenneessee
  • Knoxville, TN
View GitHub Profile
@sudarshan85
sudarshan85 / config.json
Created July 2, 2021 15:28
jupyter config
#################### edit.json ##################
{
"Editor": {
"codemirror_options": {
"indentUnit": 2,
"vimMode": false,
"keyMap": "default"
}
},
"load_extensions": {
lightning_logs
project_dir
outputs
wandb
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
@sudarshan85
sudarshan85 / plots
Created November 13, 2020 22:29
Plots
df = pd.read_parquet(Path(args.data_dir).parent/'dataset_with_splits.parquet')
df['char_len'] = df['text'].apply(len)
df['word_len'] = df['text'].apply(lambda x: len(x.split()))
fig, ax = plt.subplots(1,1,figsize=(10,8))
ax = df['word_len'].plot.hist(bins=100, alpha=0.5)
ax.set_xlim(0,200)
ax.set_ylabel('# emails')
@sudarshan85
sudarshan85 / plot_metrics
Last active October 30, 2020 13:18
Plot metrics logged by PL CSVLogger
df = pd.read_csv(csv)
df.drop(columns=['step', 'epoch'], inplace=True)
df.fillna(method='ffill', inplace=True)
df.fillna(method='bfill', inplace=True)
df.drop_duplicates(inplace=True)
df.reset_index(inplace=True, drop=True)
df = df.iloc[::2,:].reset_index(drop=True)
fig, ax = plt.subplots(1,2,figsize=(15,5))
df[['train_loss', 'val_loss']].plot(ax=ax[0])
@sudarshan85
sudarshan85 / jupyterlab_shortcuts
Last active March 31, 2020 20:31
Jupyterlab Shortcut Overrides
# Keyboard Shortcuts
{
"shortcuts": [
{
"command": "notebook:change-cell-to-raw",
"keys": [
""
],
"selector": ".jp-Notebook:focus"