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
#delete the next # if rjson package is not installed in the system | |
#install.packages("rjson") | |
library("rjson") | |
#load from a json file | |
data=fromJSON(file="E:/test.json") | |
#check the data | |
print(data) |
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
>>> import json | |
>>> testHash={"A":10,"B":20,"C":30.0} | |
with open("E:/test.json","w") as f: | |
json.dump(testHash,f) | |
>>> testHash | |
{'A': 10, 'C': 30.0, 'B': 20} |
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
import json | |
#make a test data. | |
testHash={"A":10,"B":20.0,"C":[30.0,40]} | |
#dump the variable as a file | |
with open("E:/test.json","w") as f: | |
json.dump(testHash,f) | |
#load from a json file |
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
No | Part | Correct | Choices | |
---|---|---|---|---|
1 | 1 | 3 | 5 | |
1 | 2 | 2 | 5 | |
1 | 3 | 5 | 5 | |
1 | 4 | 3 | 5 | |
1 | 5 | 5 | 5 | |
2 | 6 | 4 | 5 | |
3 | 7 | 5 | 5 | |
4 | 8 | 1 | 5 | |
5 | 9 | 3 | 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
No | Part | Correct | Choices | |
---|---|---|---|---|
1 | 1 | 1 | 5 | |
1 | 2 | 3 | 5 | |
1 | 3 | 1 | 5 | |
1 | 4 | 1 | 5 | |
1 | 5 | 5 | 5 | |
2 | 6 | 1 | 5 | |
3 | 7 | 5 | 5 | |
4 | 8 | 2 | 5 | |
5 | 9 | 5 | 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
> #各選択肢の出現回数を求めます | |
> choiceTable<-table(exam5) | |
> choiceTable | |
exam5 | |
1 2 3 4 5 | |
15 12 13 12 15 | |
> | |
> #各選択肢に対して同じ回数出現しているかを統計的に調べます。 | |
> #(カイ二乗検定による適合度検定) | |
> chisq.test(choiceTable) |
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
#過去の解答を読み込む | |
examH25<-read.csv("C:/center_kokugo - H25.csv",header=T) | |
examH24<-read.csv("C:/center_kokugo - H24.csv",header=T) | |
#過去問をくっつけます | |
exam<-rbind(examH25,examH24) | |
#選択肢が5個のものだけの解答を抽出します | |
exam5<-exam$Correct[exam$Choices==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
> hash.test[["square"]](2) | |
[1] 4 | |
> hash.test[["pi"]] | |
[1] 3.141593 | |
> | |
> #probability that a random selected number is a prime number. | |
> 6/hash.test[["square"]](hash.test[["pi"]]) | |
[1] 0.6079271 |
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
#Its behavior is like hash (associative array). | |
hash.test=list("square"=function(x){x**2}, | |
"pi"=3.1415926535) | |
hash.test[["square"]](2) | |
hash.test[["pi"]] | |
#probability that a random selected number is a prime number. | |
6/hash.test[["square"]](hash.test[["pi"]]) |
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
Ave. score(BagOfFeatures):70.492308[%] | |
Ave. score(BagOfFeaturesGMM):71.323077[%] |