This file contains hidden or 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 array import array | |
from pympler.asizeof import asizeof | |
SIZE = 1000 | |
the_array = array('i') | |
the_list = [] | |
for_tuple = [] |
This file contains hidden or 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 urllib.parse import quote, urlencode, ParseResult as Url | |
Url.__str__ = Url.geturl | |
bucket_name = 'something_with space' | |
file_name = 'data.txt' | |
url = Url( | |
scheme='https', |
This file contains hidden or 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 decimal import Decimal | |
from fractions import Fraction | |
def muller_recurrence(y, z): | |
return 108 - ((815-1500/z)/y) | |
N = 25 |
This file contains hidden or 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 time import sleep | |
import signal | |
import multiprocessing as mp | |
_SIGTERM = None | |
def sigterm_handler(signum, frame): | |
global _SIGTERM |
This file contains hidden or 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 numpy as np | |
import pandas as pd | |
from sklearn.model_selection import GridSearchCV, train_test_split | |
from sklearn.metrics import roc_auc_score, precision_score, recall_score, f1_score, accuracy_score | |
import torch | |
from torch import nn, tensor, optim | |
from skorch import NeuralNetClassifier | |
def get_data(): |
This file contains hidden or 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 math import ceil, floor | |
import numpy as np | |
LEVELS = 10 | |
CENTER = int(LEVELS/2) | |
FACTORS = [ | |
'Agreeableness', | |
'Conscientiousness', | |
'Extraversion', |
This file contains hidden or 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
def main(): | |
y = 0 | |
for k in range(1,3): | |
z = k | |
def inside_main(): | |
print(y) | |
print(z) | |
print(k) | |
inside_main() |
This file contains hidden or 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 sys | |
import unittest | |
from contextlib import contextmanager | |
@contextmanager | |
def assert_not_raises(self, exc_type): | |
try: | |
yield None | |
except exc_type: |
This file contains hidden or 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 pympler import asizeof | |
def list_to_str(lst): | |
str = '' | |
for val in lst: | |
str = str + val + ', ' | |
return str[0:len(str)-2] | |
This file contains hidden or 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 pympler import asizeof | |
class Coordinates(): | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y | |
class CoordinatesSlots(): | |
__slots__ = ('x', 'y') |
NewerOlder