This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter, deque | |
from copy import copy | |
from dataclasses import dataclass, asdict | |
import datetime | |
from itertools import islice | |
import json | |
import os | |
from pathlib import Path | |
import sys | |
import time |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
from itertools import repeat | |
import random | |
from deap import creator, base, tools, algorithms | |
import numpy as np | |
from joblib import Parallel, delayed | |
from joblib import dump, load |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import pandas as pd | |
@pd.api.extensions.register_series_accessor("path") | |
@pd.api.extensions.register_index_accessor("path") | |
class PathAccessor: | |
def __init__(self, pandas_obj): | |
self._validate(pandas_obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Default color scheme for shell prompts", | |
"groups": { | |
"hostname": { "fg": "brightyellow", "bg": "mediumorange", "attrs": [] }, | |
"environment": { "fg": "white", "bg": "darkestgreen", "attrs": [] }, | |
"virtualenv": { "fg": "gray2", "bg": "solarized:green", "attrs": [] }, | |
"mode": { "fg": "darkestgreen", "bg": "brightgreen", "attrs": ["bold"] }, | |
"attached_clients": { "fg": "white", "bg": "darkestgreen", "attrs": [] }, | |
"gitstatus": { "fg": "gray8", "bg": "gray2", "attrs": [] }, | |
"gitstatus_branch": { "fg": "gray8", "bg": "gray2", "attrs": [] }, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . *.ipynb -maxdepth 0 -type f -exec jupyter nbconvert --ExecutePreprocessor.timeout=-1 --to notebook {} --execute --output {} \; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
# whatever the data is | |
a = np.arange(5, 15) | |
# get colors for data from colormap (viridis in this case) | |
norm = mpl.colors.Normalize(vmin=a.min(), vmax=a.max()) | |
rgba_color = plt.cm.viridis([norm(v) for v in a]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
path = ROOT_DIR | |
result = (subprocess.check_output(['tree', '--dirsfirst', path]) | |
.decode("utf-8", "strict")) | |
file_list = result.split('\n') | |
root = file_list[0] | |
file_list = file_list[1:-3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.base import BaseEstimator, TransformerMixin | |
from scipy import sparse | |
from itertools import combinations | |
class SparseInteractions(BaseEstimator, TransformerMixin): | |
def __init__(self, degree=2, feature_name_separator="_"): | |
self.degree = degree | |
self.feature_name_separator = feature_name_separator | |
NewerOlder