Skip to content

Instantly share code, notes, and snippets.

@ac00std
ac00std / lda
Last active June 2, 2019 23:29
LDA
library(MASS)
library(mvtnorm)
#データの読み込み
sb=read.csv("sbnote.csv")
#学習用データの区分
sb_train=rbind(sb[1:50,],sb[101:150,])
sb_test=rbind(sb[51:100,],sb[151:200,])
@ac00std
ac00std / qda
Last active June 2, 2019 22:18
QDA
#MASS読み込み
library(MASS)
library(mvtnorm)
sb=read.csv("sbnote.csv")
#学習用データの区分
sb_train=rbind(sb[1:50,],sb[101:150,])
sb_test=rbind(sb[51:100,],sb[151:200,])
test_x=sb_test[,-7]
@ac00std
ac00std / exam.R
Created June 1, 2019 22:39
exam.R
#データの読み込み
exam=read.csv("exam_data.csv",row.names=1)
rate=exam[,11:15]
#定常過程かの確認
library(tseries)
adf.test(rate)
#時系列プロット
ts.plot(rate,gpars=list(xlab="年", ylab="合格率",lty=c(1:5),col=c(1:5)))
@ac00std
ac00std / earthquake.ipynb
Created April 10, 2019 23:38
earthquake.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ac00std
ac00std / sze2018.R
Created December 25, 2018 21:52
sze2018.R
###データの読み込み
sze_row=read.csv("2018sze.csv",header = T)
sze=sze_row[,-11]
#1992年~2017年までを学習用、2018年分をテスト用とする
train=c(1:1302)
test=c(1303:1351)
#2017年でテストする場合
#train=c(1:1254)
@ac00std
ac00std / Outliers2
Created July 9, 2018 14:22
Outliers2
set.seed(3383)
mu1=c(100, 100)
sigma1=matrix(c(10, 5, 5, 10), 2, 2)
data1=mvrnorm(1000, mu1, sigma1)
plot(data1)
mu2=c(150, 150)
sigma2=matrix(c(5, 0, 0, 5), 2, 2)
data2=mvrnorm(200, mu2, sigma2)
plot(data2)
@ac00std
ac00std / Outliers
Last active July 8, 2018 16:28
Outliers
library(MASS)
library(kernlab)
#データの読み込み
sb=read.csv("sbnote.csv")
#学習用データの区分
sb.g=sb[1:100,]
sb.g=data.frame(sb.g)
sb.t=sb.g[,-7]
ac_exam2=function(n,p1_low,p1_high,p2_low,p2_high,study1,study2){
#n:持っている科目数
#p1_low:1次試験科目の合格率下限
#p1_high:1次試験科目の合格率上限
#p2_low:2次試験科目の合格率下限
#p2_high: 2次試験科目の合格率上限
#study1:勉強により科目1の合格率を引き上げることができる
#study2:勉強により科目2の合格率を引き上げることができる
#year:受験年数
ac_exam=function(n,p1_low,p1_high,p2_low,p2_high,study){
#n:持っている科目数
#p1_low:1次試験科目の合格率下限
#p1_high:1次試験科目の合格率上限
#p2_low:2次試験科目の合格率下限
#p2_high: 2次試験科目の合格率上限
#study:勉強により1科目だけ合格率を引き上げることができる
#year:受験年数
#year1:1次試験合格年数
@ac00std
ac00std / sze_R
Last active January 8, 2018 02:23
sze_janken
###データの読み込み
sze_row=read.csv("2017sze.csv",header = T)
sze=sze_row[,-9]
#1992年~2016年までを学習用、2017年分をテスト用とする
train=c(1:1254)
test=c(1255:1302)
###seedはサザエさん(3383)とする
set.seed(3383)