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 random | |
import time | |
class CARD: | |
card = [m+i for m in ["♣","♦","♥","♠"] for i in ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10',"J","Q","K"]] | |
def __init__(self): | |
random.shuffle(self.card) | |
def pop(self): | |
return self.card.pop() |
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 os | |
import datetime | |
import re | |
from functools import reduce | |
import pandas as pd | |
def dtString_to_datetime(sendDt): | |
return datetime.datetime.strptime(sendDt,"%Y-%m-%d %H:%M:%S") | |
def sender_time_receivers(row): | |
if type(row) == dict: |
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
# coding: utf-8 | |
# In[28]: | |
from __future__ import print_function | |
import keras | |
from keras.datasets import mnist | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout |
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 | |
import re | |
from sklearn.model_selection import train_test_split | |
from sklearn.ensemble import RandomForestClassifier | |
from sklearn.metrics import log_loss,accuracy_score,confusion_matrix | |
from sklearn.calibration import CalibratedClassifierCV | |
from sklearn import preprocessing | |
from sklearn.metrics import roc_auc_score | |
from sklearn.grid_search import GridSearchCV |
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
class Rational(x:Int, y:Int){ | |
require(y != 0 , "denominator must be nonzero") | |
def this(x: Int) = this(x,1) | |
private def gcd(a:Int,b:Int): Int = if(b==0) a else gcd(b,a%b) | |
def numer = x | |
def denom = y | |
def less(that:Rational) = numer * that.denom < that.numer * denom | |
def max(that:Rational) = if(this.less(that)) that else this | |
def add(that:Rational) = | |
new Rational( |
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 requests, grequests,re,sqlite3,datetime,sys,getopt,pymongo,time | |
from collections import deque | |
class SteamData: | |
R_URL = "http://store.steampowered.com/appreviews/%d?json=1&filter=recent&start_offset=%d" | |
GL_URL = "http://api.steampowered.com/ISteamApps/GetAppList/v0002/?key=STEAMKEY&format=json" | |
G_URL = "http://store.steampowered.com/api/appdetails?appids=%d" | |
U_URL = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=%s&steamids=%s" | |
UA_URL = "http://api.steampowered.com/ISteamUserStats/GetPlayerAchievements/v0001/?appid=%d&key=%s&steamid=%s" | |
US_URL = "http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=%d&key=%s&steamid=%s" |
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 | |
from six.moves import cPickle | |
from matplotlib import pyplot as plt | |
from matplotlib.ticker import NullFormatter | |
# problem 1 | |
#1) | |
n = 100000 | |
x = np.random.rand(n,1) |
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
# coding: utf-8 | |
# In[60]: | |
import pandas as pd | |
import statsmodels.api as sm | |
from statsmodels.stats.outliers_influence import variance_inflation_factor | |
import numpy as np |
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
# coding: utf-8 | |
# In[60]: | |
import pandas as pd | |
import statsmodels.api as sm | |
from statsmodels.stats.outliers_influence import variance_inflation_factor | |
import numpy as np |
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
# coding: utf-8 | |
# In[60]: | |
import pandas as pd | |
import statsmodels.api as sm | |
from statsmodels.stats.outliers_influence import variance_inflation_factor | |
import numpy as np |
NewerOlder