Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Homo Sapiens

Nov05

💭
Homo Sapiens
View GitHub Profile
View 20230521_graph_distances between cities
New York,Los Angeles,2778
Chicago,Houston,940
San Francisco,Seattle,1094
Miami,Atlanta,663
Washington DC,Boston,394
Dallas,Austin,195
Phoenix,Denver,586
Detroit,Minneapolis,539
Charlotte,Raleigh,172
Philadelphia,Pittsburgh,305
View 20230509 panda express sales data on a receipt
Time,Cnt,Sales,%Sales
10:00AM-10:30AM,7,"$108.60",0.2
10:30AM-11:00AM,62,"$970.59",1.84
11:00AM-11:30AM,102,"$1,399.29",2.66
11:30AM-12:00PM,174,"$2,592.46",4.94
12:00PM-12:30PM,210,"$2,847.98",5.42
12:30PM-1:00PM,189,"$2,609.96",4.97
1:00PM-1:30PM,163,"$2,388.46",4.55
1:30PM-2:00PM,168,"$2,222.29",4.23
2:00PM-2:30PM,104,"$1,430.59",2.72
@Nov05
Nov05 / model.py
Last active March 11, 2020 04:33
2020-03-07 CNN-LSTM image captioning
View model.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
class EncoderCNN(nn.Module):
def __init__(self, embed_size):
# super(EncoderCNN, self).__init__()
super().__init__()
View 2020-02-29 python code snippet.md

Find the elements that appear in both lists.

import time
with open('names_1.txt', 'r') as f:
    names_1 = f.read().split("\n")  # List containing 10000 names
with open('names_2.txt', 'r') as f:
    names_2 = f.read().split("\n")  # List containing 10000 names
@Nov05
Nov05 / json_to_csv.py
Created December 5, 2019 12:27 — forked from emredjan/json_to_csv.py
Yelp Dataset Challenge JSON to CSV conversion
View json_to_csv.py
'''
Load Yelp JSON files and spit out CSV files
Does not try to reinvent the wheel and uses pandas json_normalize
Kinda hacky and requires a bit of RAM. But works, albeit naively.
Tested with Yelp JSON files in dataset challenge round 12:
https://www.yelp.com/dataset/challenge
'''
import json
View 2019-10-20 random forest.md

Baseline

# baseline score
X_train, X_val, y_train, y_val = train_test_split(
    X_trainval, y_trainval, test_size=0.33, random_state=42)
print("train mean velocity:", y_train.mean())
y_val_pred = [y_train.mean()] * len(y_val)
print('baseline error score:', mean_squared_error(y_val, y_val_pred))
View 2019-10-20 custom colorscale.md
!pip install colorlover
# Successfully installed colorlover-0.3.0
import pandas as pd
import numpy as np

import matplotlib.pyplot as plt
View 2019-10-20 fireball.md
import pandas as pd
import numpy as np

import matplotlib.pyplot as plt
import seaborn as sns
import pandas_profiling
import plotly
import plotly.graph_objects as go
from sklearn.preprocessing import MinMaxScaler
View 2019-08-02 Check Heroku Logs and Debug.md