This file contains 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 | |
# 4.1.4 フィッシャーの線形判別(p.185) | |
# 3クラスへの応用 | |
import numpy as np | |
from pylab import * | |
import sys | |
N = 150 # データ数 |
This file contains 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
#SVM by OpenOpt | |
#use 'classification.txt' | |
from scipy import * | |
from scipy.linalg import norm | |
import numpy as np | |
from openopt import QP | |
from pylab import * | |
C = 0.5 # | |
SIGMA = 0.45 # the parameter of gaussian_kernel |
This file contains 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
""" | |
search route between 2 users in twitter | |
""" | |
print __doc__ | |
import sys | |
import twitter |
This file contains 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
'''ハッシュタグ#programmngからStatusListを受け取りファイルへテキストを保存する | |
1,「#programming」を条件にデータを取得 | |
2,「, . ( ) 」をスペースに置換 | |
3,小文字に変換 | |
#4,スペースで文字を分割 | |
#5,文字が#で始まっていたら#を削除 |
This file contains 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
#!/usr/bin/python | |
# -*- coding:utf-8 -*- | |
'''年俸1000万がどうとか | |
http://alpha.cgios.net/alpha/cgios | |
''' | |
import sys |
This file contains 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
#!/usr/bin/python | |
# -*- coding:utf-8 -*- | |
import sys | |
import copy | |
def usage(): | |
print "usage: %s puyomap_file" % sys.argv[0] | |
return 1 |
This file contains 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
#!/usr/bin/python | |
# -*- coding:utf-8 -*- | |
''' | |
他人のコード使って重要な所間違ってたからそこだけ修正したやつ | |
''' | |
from itertools import product | |
from collections import namedtuple |
This file contains 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
#!/bin/bash | |
CMDNAME=`basename $0` | |
if [ $# -ne 1 ]; then | |
echo "usage: CMDNAME: tex_file" 1>&2 | |
exit 0 | |
fi | |
tex_file=$1 |
This file contains 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
def permutation(l: List[Int]): Iterator[List[Int]] = { | |
if (l.isEmpty) | |
Iterator(Nil) | |
else | |
// for (i <- 0 until l.length; | |
for (i <- Iterator.range(0, l.length); | |
next <- permutation(l.slice(0, i) ::: l.slice(i+1, l.length))) | |
yield l(i) :: next | |
} |
This file contains 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
def insertAtErrorL[A](e: A, i: Int, ls: Seq[A]): Seq[A] = ls.take(i) :+ e ++ ls.drop(i) | |
// scala> <console>:7: error: value ++ is not a member of type parameter A | |
// def insertAtErrorL[A](e: A, i: Int, ls: Seq[A]): Seq[A] = ls.take(i) :+ e ++ ls.drop(i) | |
// ^ | |
def insertAtErrorR[A](e: A, i: Int, ls: Seq[A]): Seq[A] = ls.take(i) ++ e +: ls.drop(i) | |
// scala> <console>:1: error: left- and right-associative operators with same precedence may not be mixed | |
// def insertAtErrorR[A](e: A, i: Int, ls: Seq[A]): Seq[A] = ls.take(i) ++ e +: ls.drop(i) | |
// ^ |
OlderNewer