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
#include <iostream> | |
#include <string> | |
#include <cstdio> | |
#include <cstring> | |
#include <map> | |
#include <climits> | |
#include <cctype> | |
#include <vector> | |
#include <set> | |
#include <algorithm> |
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
count = 100; | |
dimen = 100; | |
test = 100; | |
function ret = distance(a, b) | |
ret = sqrt(sum((a.-b).^2,2)); | |
end | |
function ret = find_k_nearest_naive(x, p, k) | |
[val, r] = sort(distance(x,p)); |
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, json, sys | |
from bs4 import BeautifulSoup | |
FILE = 'comments.txt' | |
PAGE = 50 | |
TYPE = '' | |
def get_comments(appid): | |
with open(FILE, 'a') as file: | |
for page in range(1, 101): |
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, re | |
from pathlib import Path | |
def preprocessor(text): | |
# Remove comments | |
text = re.sub(r'\/\/.+', '', text) | |
text = re.sub(r'\/\*(\*(?!\/)|[^*])*\*\/', '', text) | |
# Remove the package name | |
text = re.sub(r'package\s\w+(\.\w+)+;', '', text) |
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 queue import Queue | |
import graphviz as gv | |
import numpy as np | |
from sklearn import datasets | |
from sklearn.cross_validation import train_test_split | |
class DecisionTree: | |
# Decision tree | |
tree = {} |
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 copy | |
import numpy as np | |
class Bagging: | |
num_base = 0 | |
classifiers = [] | |
minvs = [] | |
maxvs = [] |
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 matplotlib.pyplot as plt | |
import numpy as np | |
from scipy.spatial import ConvexHull | |
class KMeans: | |
mean_vec = np.array([]) | |
X = np.array([]) | |
y = np.array([]) | |
clusters = [] |
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 matplotlib.colors as colors | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
class LogisticRegression: | |
kern_param = 0 | |
X = np.array([]) | |
a = np.array([]) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.