Skip to content

Instantly share code, notes, and snippets.

@yuu-ito
yuu-ito / index.html
Last active September 1, 2017 10:33
vue.js( http://vuejs.org/ ) を試してみた。functionと打つ時間を計測するだけ。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue/0.12.16/vue.min.js"></script>
</head>
<body>
<h1>タイピングてすと:function</h1>
function + enter で計測
get_latlng_from_address<-function(zipcode){
require("rjson")
url.template<-"http://maps.googleapis.com/maps/api/geocode/json?language=ja&address"
url <- paste(url.template,zipcode,sep="=")
map_data <- fromJSON(paste(readLines(url), collapse=""))
if(map_data$status=="OK"){
address_info <- map_data$results[[1]]$address_components
location <- map_data$results[[1]]$geometry$location
res <- data.frame(
zipcode= zipcode,
@yuu-ito
yuu-ito / pref_code.csv
Last active February 1, 2016 05:28
d<-read.csv("../../Desktop/pref_code.csv") http://ja.wikipedia.org/wiki/全国地方公共団体コード
PREF_CODE NAME REGION
01 北海道 北海道
02 青森県 東北
03 岩手県 東北
04 宮城県 東北
05 秋田県 東北
06 山形県 東北
07 福島県 東北
08 茨城県 関東
09 栃木県 関東
# kaggle titanic
# https://www.kaggle.com/c/titanic-gettingStarted/data
t <- read.csv("../../Downloads/train.csv")
names(t)<-tolower(names(t))
idx<- sample(nrow(t),(nrow(t)*0.7))
t.tr <- t[ idx,]
t.te <- t[-idx,]
@yuu-ito
yuu-ito / 0_reuse_code.js
Created March 20, 2014 03:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Rでデンドログラムのプロット

概要

  • データセットの作成(matrix,dist)
  • デンドログラム(樹形図)のプロット方法
  • グラフによる可視化

Rpubsにも投稿

@yuu-ito
yuu-ito / _共起尺度.md
Last active June 29, 2016 01:29
共起、距離行列、内積、類似度、

共起尺度メモ

主なものとして

  • Jaccard係数
  • Simpson係数
  • コサイン距離

共起尺度、共起頻度の指標は自然言語処理関連でよく使われているらしい。

  • 文書中の単語の出現数から文書間の類似性をみるなど
# install.packages("party")
library("party")
# ?ctree
irisct <- ctree(Species ~ .,data = iris)
irisct
plot(irisct)