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
Verifying my Blockstack ID is secured with the address 1PwrzAjKF65Wme7JsddXGsqjTKeuQ42K3e https://explorer.blockstack.org/address/1PwrzAjKF65Wme7JsddXGsqjTKeuQ42K3e |
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 datetime import timedelta | |
from apscheduler.schedulers.blocking import BlockingScheduler | |
import requests, json, datetime, numpy, requests_cache | |
import matplotlib.dates as mdate | |
import matplotlib.pyplot as plot | |
import numpy as np | |
ALL_HISTORICAL_DATA_ENDPOINT = 'https://blockchain.info/charts/market-price?timespan=all&format=json' | |
NUM_UNIQUE_ADDRESSES = 'https://blockchain.info/charts/n-unique-addresses?timespan=all&format=json' |
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 pstats import func_std_string, f8 | |
from dataclasses import dataclass | |
from typing import Dict | |
@dataclass(unsafe_hash=True) | |
class FunctionProfile: | |
ncalls: int | |
tottime: float | |
percall_tottime: float | |
cumtime: float |
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 cProfile, pstats | |
import time | |
from random import randint | |
START_TIME = int(time.time()) | |
timestamped_stats_profiles = [] | |
def sleep1(): | |
time.sleep(0.1) |
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 | |
import itertools | |
TIME_SLICE = 10 # Aggregate logs every 10 seconds | |
def time_to_bucket(time): | |
return (time-START_TIME) // TIME_SLICE | |
def bucket_to_time(bucket): | |
return bucket * TIME_SLICE + START_TIME |
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 numpy as np | |
import matplotlib | |
import matplotlib.pyplot as plt | |
from matplotlib.ticker import FormatStrFormatter | |
WIDTH = 0.4 | |
ind = np.arange(len(time_sliced_counters)) | |
x_axis = tuple(time for (time, c) in time_sliced_counters) |
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 cProfile, pstats | |
import time | |
from random import randint | |
def sleep1(): | |
time.sleep(0.1) | |
def sleep2(): | |
time.sleep(0.2) | |
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
# Data Generation | |
NUM_STUDENTS = 30 | |
MEAN = 80 | |
STD = 20 | |
# https://stackoverflow.com/questions/36894191/how-to-get-a-normal-distribution-within-a-range-in-numpy | |
# Need to cap the values of the distributions to [0,100] | |
def get_truncated_normal(mean, sd, size, low, upp): | |
return truncnorm((low - mean) / sd, (upp - mean) / sd, loc=mean, scale=sd).rvs(size) |
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
NUM_BINS = 10 | |
bins = np.linspace(0, 100, NUM_BINS + 1) | |
# Note: we set include_lowest to true to make sure that we include zeroes | |
bucket_GT = pd.cut(grades_GT, bins=bins, include_lowest=True, right=True) | |
bucket_P = pd.cut(grades_P, bins=bins, include_lowest=True, right=True) | |
# Output of the cut function | |
pd.DataFrame({'grades': grades_GT, 'bucket': bucket_GT}).head() |
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
# Generate a pandas dataframe where the index represents the student number | |
df_GT = pd.DataFrame({'bucket': bucket_GT}).reset_index() | |
display(df_GT.head()) | |
df_P = pd.DataFrame({'bucket': cut_P}).reset_index() | |
display(df_P.head()) | |
# Merged the actual predicted grades | |
merged_df = pd.merge(df_GT, df_P, on=['index'], suffixes=('_grouth_truth', '_predicted')) | |
display(merged_df.head()) |
OlderNewer