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
# Regression Analysis | |
fig, ax = plt.subplots(2, 1, figsize=(20,20)) | |
sns.set(color_codes=True) | |
print("r2_score: ", round(r2_score(grades_GT, grades_P), 2)) | |
print("mean_squared_error: ", round(mean_squared_error(grades_GT, grades_P), 2)) | |
print("mean_absolute_error: ", round(mean_absolute_error(grades_GT, grades_P), 2)) | |
print("explained_variance_score: ", round(explained_variance_score(grades_GT, grades_P), 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
# Regression Analysis | |
fig, ax = plt.subplots(2, 1, figsize=(20,20)) | |
sns.set(color_codes=True) | |
print("mean_squared_error: ", round(mean_squared_error(grades_GT, grades_P), 2)) | |
print("mean_absolute_error: ", round(mean_absolute_error(grades_GT, grades_P), 2)) | |
print("explained_variance_score: ", round(explained_variance_score(grades_GT, grades_P), 2)) | |
ax[0].tick_params(axis='both', labelsize=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
def create_joint_probability_matrix(data_GT, data_P, bins): | |
# https://stackoverflow.com/questions/38931566 | |
def background_gradient(s, m=None, M=None, cmap='Reds', low=0, high=0): | |
if m is None: | |
m = s.min().min() | |
if M is None: | |
M = s.max().max() | |
rng = M - m | |
norm = colors.Normalize(m - (rng * low), M + (rng * high)) |
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
axis = np.linspace(5, 105, NUM_BINS + 1)[:-1] | |
jp_df = pd.DataFrame(jp_matrix, columns=axis, index=axis) | |
jp_df = jp_df.applymap(lambda val: 0 if math.isnan(val) else (val / NUM_STUDENTS)) | |
jp_df |
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
# https://stackoverflow.com/questions/38931566 | |
def background_gradient(s, m=None, M=None, cmap='Reds', low=0, high=0): | |
if m is None: | |
m = s.min().min() | |
if M is None: | |
M = s.max().max() | |
rng = M - m | |
norm = colors.Normalize(m - (rng * low), M + (rng * high)) | |
normed = s.apply(lambda x: norm(x.values)) | |
cm = plt.cm.get_cmap(cmap) |
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 typing import Optional | |
from fastapi import FastAPI | |
app = FastAPI() | |
@app.get("/") | |
def read_root(): | |
return {"Hello2": "World5"} |
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 tiangolo/uvicorn-gunicorn-fastapi:python3.7 | |
WORKDIR /usr/src/ | |
COPY ./src . |
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
version: '3.7' | |
services: | |
server: | |
container_name: server | |
build: | |
context: . | |
dockerfile: Dockerfile | |
ports: | |
- "8008:8008" | |
environment: |
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
version: '3.7' | |
services: | |
server: | |
container_name: server | |
build: | |
context: . | |
dockerfile: Dockerfile | |
volumes: | |
- ./src:/usr/src | |
ports: |
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 pandas as pd | |
from datetime import datetime, date | |
from iexfinance.stocks import get_historical_data | |
# Assumptions: | |
# 1. No missing data in existing dataframes in the store; data is complete between (date_min, date_max). | |
# 2. The requested data is of the same format (URL, params, retrieved columns, etc...). | |
# Reference for metadata: https://moonbooks.org/Articles/How-to-add-metadata-to-a-data-frame-with-pandas-in-python-/#store-in-a-hdf5-file | |
def get_historical_data_cached(store, symbol, start_date, end_date, **kwargs): |