Skip to content

Instantly share code, notes, and snippets.

View ltiao's full-sized avatar
🐢
Slow is smooth. Smooth is fast.

Louis Tiao ltiao

🐢
Slow is smooth. Smooth is fast.
View GitHub Profile
@ltiao
ltiao / textlist.py
Last active December 12, 2015 12:09
prints list of prescribed textbooks given a list of subjects
#!/usr/bin/python
import pprint, requests, sys
from bs4 import BeautifulSoup
from itertools import izip
base_url = 'http://www.bookshop.unsw.edu.au/cgi-bin/bookweb/subject2'
subjects = []
while True:
@ltiao
ltiao / currency.py
Last active December 13, 2015 19:18
#!/usr/bin/python
import requests, optparse
from bs4 import BeautifulSoup
PRECISION = 2
VERBOSE = False
parser = optparse.OptionParser()
parser.add_option('-f', '--from', action="store", dest="from")
@ltiao
ltiao / vividwireless.py
Created February 23, 2013 04:22
Quick and dirty script to get vividwireless usage data. I'm still figuring out how to get the javascript usage graph
#!/usr/bin/python
import requests
from bs4 import BeautifulSoup
EMAIL = ''
PASSWORD = ''
# Scrape login form and parse into a dict of fields and default vales for form submission
payload = {}

Autobackup

Overview

Automated backup management.

Installation

Required Software

#!/usr/bin/python
import requests, re, json
from bs4 import BeautifulSoup
r = requests.get('https://my.unsw.edu.au/amserver/UI/Login?module=ISISWSSO&IDToken1=')
soup = BeautifulSoup(r.text)
form = soup.find("form", {"id": "muLoginForm"})
payload = {}
for field in form.find_all("input"):
  1. 3
  2. 2
=== Run information ===

Scheme:weka.classifiers.trees.J48 -C 0.25 -M 2
Relation:     iris
Instances:    150
Attributes:   5
@ltiao
ltiao / gist:5346417
Created April 9, 2013 15:00
dat dont work dawwg
World 1.0 9.425909e11 1.0 [Particle 2.1301455e10 (-23.722443,273.93643) (-0.5603789,8.87553),Particle 5.4552156e12 (-620.9837,-34.27094) (0.8044095,14.809131),Particle 2.0776714e11 (9.89766,-174.47176) (35.80036,-34.40756),Particle 1.2364892e10 (4.0329933,65.24691) (18.734251,221.23175),Particle 7.7461894e11 (740.04193,94.38988) (15.756793,-8.751707),Particle 4.2237824e11 (-1585.7284,-213.17168) (47.984566,101.29193),Particle 5.401596e11 (-235.64716,-139.60974) (-26.06327,-15.914259),Particle 1.33174534e11 (-64.33501,-405.01236) (4.042644,2.774118),Particle 5.1389723e10 (-1511.0996,4881.5757) (0.6556639,13.3051195),Particle 5.3848208e11 (-115.08583,955.13684) (-11.534346,-31.219143),Particle 5.9962958e10 (-68.10322,-94.91835) (-13.505034,1.1353914),Particle 5.0289918e10 (-220.84084,-96.86563) (0.38176155,11.775326),Particle 5.1853357e10 (8.276694,-235.82036) (-51.282913,25.556257),Particle 3.3220094e10 (1525.3933,23.393568) (-0.47481883,-5.4444294),Particle 8.3360986e11 (-34.808674,-5.540028) (10.581584,12.18
import Test.QuickCheck
import Data.List(sort, nub)
data BinaryTree = Branch Integer BinaryTree BinaryTree
| Leaf
deriving (Show, Ord, Eq)
isBST :: BinaryTree -> Bool
isBST Leaf = True
isBST (Branch v l r) = allTree (< v) l && allTree (>= v) r && isBST l && isBST r

COMP9417 - Machine Learning: Assignment 1

Chi-Chun Tiao: 3390558


    • a. Observing the results of comparison by Percent_correct using DecisionStump as the baseline, we can see that there is no statistically significant difference in accuracy (Percent_correct) between J48 and DecisionStump on the datasets credit-rating (85.51% vs. 85.57%) and vote (95.63% vs. 96.57%).

First note that J48 is simply an implementation of the C4.5 algorithm that generates a decision tree of arbitrary depth, while DecisionStump generates a decision tree of depth one, i.e. a set of rules that test one attribute. Thus, one possible reason their accuracy might be approximately equivalent is that the inductive bias of decision tree learning (Occam's razor/preference of shorter trees) may not suit the dataset well, causing both algorithms to perform equally poor - not the case here with either dataset (both over 85% accuracy)! Another possible cause is the existence of a single attribute in the datase

@ltiao
ltiao / gist:5429471
Created April 21, 2013 12:41
writing
try {
String content = "hello world!\nThere are 2 lines in this file!";
File file = new File("something.txt");
file.createNewFile();
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write(content);
bw.close();
} catch (IOException e) {
e.printStackTrace();