Skip to content

Instantly share code, notes, and snippets.

View kkweon's full-sized avatar

Mo Kweon kkweon

View GitHub Profile
@kkweon
kkweon / pandas_read_html_test
Created September 27, 2016 22:49
pandas_read_html
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
@kkweon
kkweon / kalman_filter.py
Last active January 20, 2017 00:18
simple kalman filter to track a robot in circular motion
import numpy as np
import matplotlib.pyplot as plt
class Filter:
def __init__(self, filter=None):
self.filter = filter
self.filter.predict()
def get_point(self):
return self.filter.x[0:2, :].flatten()
@kkweon
kkweon / minimax.py
Created January 28, 2017 22:12
Minimax Implementation
"""Implementation of Figure 5.2 in Artificial Intelligence: A Modern Approach
[MINIMAX Algorithm]
AIMA p.164 Ch.5 Adversarial Search
function Minimax(state) returns a value
if terminal-test(state):
return utility(state)
if player(state) == MAX:
return max( Minimax(RESULT(state, action)) for every action in Action(s) )
@kkweon
kkweon / simple_neural_net.ipynb
Created February 3, 2017 21:58
Simple Neural Net
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kkweon
kkweon / fitness_8_queens.py
Last active March 5, 2017 21:28
Fitness of 8 queens problem
""" This file calculates the fitness of 8-queens problem
How to use:
In terminal,
$ python fitness_8_queens.py 24748552
Input: 24752411
Output: 22
@kkweon
kkweon / main.py
Created March 13, 2017 23:47
Naver News Requests Json Example
import json
import requests
url = "http://news.naver.com/main/mainNews.nhn"
payloads = {'componentId': 949984, 'page': 1, 'date': '2016-03-13 00:00:00'}
req = requests.get(url, params=payloads)
js = json.loads(req.text)
print(js.keys()) # dict_keys(['itemList', 'dateList', 'pagerInfo', 'currentDate'])
for item in js['itemList']:
@kkweon
kkweon / train.R
Created March 14, 2017 01:03
R Tensorflow RNN
library(tensorflow)
rm(list=".Random.seed", envir=globalenv())
batch.size = 128L
max.step = 500L
print.every = 10L
hidden.dim = 64L
dropout = 0.5
tf$reset_default_graph()
X <- tf$placeholder(tf$int64, shape(NULL, max.seq))
@kkweon
kkweon / app.R
Created March 14, 2017 06:10
Top 포탈 키워드
library(shiny)
library(gsheet)
# Helper Functions
read.list <- function(url = "https://docs.google.com/spreadsheets/d/1aJ2Bv8CCR4OhBoVdsQD16OWON89VwuaLYKDDP-OiTG4") {
as.data.frame(gsheet::gsheet2tbl(url))
}
read.data <- function(url) {
data <- as.data.frame(gsheet::gsheet2tbl(url))
@kkweon
kkweon / KMeans.ipynb
Created March 17, 2017 10:12
KMeans with Numpy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kkweon
kkweon / batchnorm.ipynb
Last active March 27, 2017 17:15
Batch normalization Comparison
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.