{"id":1543,"date":"2018-08-26T12:05:37","date_gmt":"2018-08-26T03:05:37","guid":{"rendered":"https:\/\/plaza.umin.ac.jp\/~OIO\/?p=1543"},"modified":"2018-08-26T14:20:48","modified_gmt":"2018-08-26T05:20:48","slug":"r%e3%81%a7pubmed%e3%81%ae%e6%a4%9c%e7%b4%a2%e7%b5%90%e6%9e%9c%e3%82%92%e6%a9%9f%e6%a2%b0%e5%ad%a6%e7%bf%92","status":"publish","type":"post","link":"https:\/\/plaza.umin.ac.jp\/~OIO\/?p=1543","title":{"rendered":"R\u3067PubMed\u306e\u691c\u7d22\u7d50\u679c\u3092\u6a5f\u68b0\u5b66\u7fd2"},"content":{"rendered":"<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>\u672c\u7a3f\u306fR\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3067deep learning\u304c\u3067\u304d\u308b\u3068\u805e\u3044\u3066\u3001\u30cd\u30c3\u30c8\u3067\u8abf\u3079\u306a\u304c\u3089\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3046\u9053\u7b4b\u3092\u3064\u3051\u308b\u307e\u3067\u306e\u3001\u5fd8\u5099\u9332\u3067\u3059\u3002\u30b5\u30f3\u30d7\u30eb\u306b\u3057\u305f\u306e\u306f\u3001\u300cA\u85ac\u300d\u3067\u691c\u7d22\u3057\u305f\u7d50\u679c\u3068\u300cB\u85ac\u300d\u3067\u691c\u7d22\u3057\u305f\u7d50\u679c\u3092\u3001\u30c6\u30ad\u30b9\u30c8\u5f62\u5f0f\u3067A.txt, B.txt\u3068\u3057\u3066PC\u306b\u4fdd\u5b58\u3057\u305f\u3046\u3048\u3067\u3001\u4e00\u90e8\u3092\u5b66\u7fd2\u7528\u30b5\u30f3\u30d7\u30eb\u3001\u6b8b\u308a\u3092\u30c6\u30b9\u30c8\u7528\u30b5\u30f3\u30d7\u30eb\u306b\u3057\u3066\u3001\u5b66\u7fd2\u306e\u52b9\u679c\uff08\uff1f\uff09\u3092\u6e2c\u5b9a\u3057\u307e\u3057\u305f\u3002\u96c6\u8a08\u306b\u5165\u308b\u524d\u306b\u3001\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30c7\u30fc\u30bf\u306e\u4e2d\u306e\u3001\u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u524a\u9664\u3057\u307e\u3057\u305f\u3002\uff08\u2190\u3053\u308c\u3092\u3057\u306a\u3044\u3068\u3055\u3059\u304c\u306b\u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u305d\u306e\u3082\u306e\u304c\u305d\u308c\u305e\u308c\u306e\u96c6\u56e3\u306b\u3070\u3063\u3061\u308a\u5165\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u5206\u985e\u306e\u6027\u80fd\u304c\u8a55\u4fa1\u3067\u304d\u306a\u3044\u306e\u3067\u306f\u306a\u3044\u304b\u3068\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1554\" src=\"https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/img_3496.jpg\" alt=\"\" width=\"2448\" height=\"3264\" srcset=\"https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/img_3496.jpg 2448w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/img_3496-113x150.jpg 113w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/img_3496-225x300.jpg 225w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/img_3496-768x1024.jpg 768w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/img_3496-700x933.jpg 700w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/img_3496-576x768.jpg 576w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/img_3496-800x1067.jpg 800w\" sizes=\"auto, (max-width: 2448px) 100vw, 2448px\" \/><\/p>\n<p>\u306f\u3063\u304d\u308a\u5206\u985e\u3057\u3084\u3059\u3044\u3088\u3046\u306b\u3001\u4eca\u56de\u306fA\u306f\u6297\u764c\u85ac\u3001B\u306f\u514d\u75ab\u795e\u7d4c\u7cfb\u75be\u60a3\u6cbb\u7642\u85ac\u3068\u6cbb\u7642\u5bfe\u8c61\u306e\u75be\u60a3\u306e\u6027\u8cea\u304c\u9055\u3046\u3082\u306e\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u691c\u7d22\u7d50\u679c\u306f\u3001Medline\u5f62\u5f0f\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002\u3053\u306e\u3042\u305f\u308a\u306e\u624b\u9806\u306f\u3001<a href=\"http:\/\/wanko-sato.hatenablog.com\/entry\/2017\/07\/02\/175227\">\u3010R\u3067\u81ea\u7136\u8a00\u8a9e\u51e6\u7406\u3011<\/a>\u3092\u3001\u307b\u307c\u305d\u306e\u307e\u307e\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002\uff08\u300c\u30c7\u30fc\u30bf\u5206\u6790\u7cfb\u7537\u5b50\u300d\u3055\u3093\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\uff09\u5206\u985e\u306b\u4f7f\u7528\u3057\u305fMXNet\u306e\u5468\u308a\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306f<a href=\"http:\/\/fits.hatenablog.com\/entry\/2017\/12\/12\/212753\">\u3010R\u306eMXNet\u3067iris\u3092\u5206\u985e\u3011<\/a>\u3092\u3001\u307b\u307c\u305d\u306e\u307e\u307e\u5229\u7528\u3057\u3066\u3044\u307e\u3059\uff08\u300c\u306a\u3093\u3068\u306a\u304f\u306aDeveloper\u300d\u3055\u3093\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\uff09<\/p>\n<hr \/>\n<h1>{mxnet}\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h1>\n<p>\u3068\u308a\u3042\u3048\u305a\u3053\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u3059\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u306f\u3001\u4ed6\u306e\u65e5\u672c\u8a9e\u306e\u30b5\u30a4\u30c8\u306e\u8aac\u660e\u901a\u308a\u3067\u306f\u3001\u306a\u305c\u304b\u3046\u307e\u304f\u3086\u304d\u307e\u305b\u3093\u3002\u4e00\u5fdc\u4ee5\u4e0b\u306e\u6d41\u308c\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3057\u305f\u3002\u4ed6\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306f\u7279\u306b\u82e6\u52b4\u3059\u308b\u3053\u3068\u306a\u304finstall.packages()\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<blockquote><p># first add the repo<br \/>\ndrat::addRepo(&#8220;dmlc&#8221;)<br \/>\n# either install just one or more given packages<br \/>\ninstall.packages(&#8220;xgboost&#8221;)<\/p>\n<p>cran &lt;- getOption(&#8220;repos&#8221;)<br \/>\ncran[&#8220;dmlc&#8221;] &lt;- &#8220;https:\/\/s3-us-west-2.amazonaws.com\/apache-mxnet\/R\/CRAN\/&#8221;<br \/>\noptions(repos = cran)<br \/>\ninstall.packages(&#8220;mxnet&#8221;)<\/p>\n<hr \/>\n<\/blockquote>\n<h2>MedLine\u691c\u7d22\u3068\u4fdd\u7ba1<\/h2>\n<p>\u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u306f\u666e\u901a\u306b\u5165\u529b\u3057\u3066\u691c\u7d22\u3059\u308c\u3070\u3088\u3044\u306e\u3067\u3059\u304c\u3001\u3042\u307e\u308a\u305f\u304f\u3055\u3093\u306e\u6587\u732e\u304c\u3042\u3063\u3066\u3082\u53d6\u308a\u56de\u3057\u304c\u60aa\u3044\u306e\u3067\u4eca\u56de\u306f\u691c\u7d22\u5bfe\u8c61\u3092\u4eca\u5e74\u51fa\u7248\u306e\u6587\u732e\u3068\u3057\u307e\u3057\u305f\u3002\u307e\u305f\u30a2\u30d6\u30b9\u30c8\u30e9\u30af\u30c8\u3067\u5206\u985e\u3057\u307e\u3059\u306e\u3067\u3001\u30a2\u30d6\u30b9\u30c8\u30e9\u30af\u30c8\u304c\u5165\u529b\u3055\u308c\u3066\u3044\u308b\u82f1\u8a9e\u306e\u6587\u732e\u306b\u7d5e\u3063\u3066\u51fa\u529b\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1551\" src=\"https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/46b84b8916043b7293e43d0def6f4958.png\" alt=\"\" width=\"219\" height=\"514\" srcset=\"https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/46b84b8916043b7293e43d0def6f4958.png 219w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/46b84b8916043b7293e43d0def6f4958-64x150.png 64w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/46b84b8916043b7293e43d0def6f4958-128x300.png 128w\" sizes=\"auto, (max-width: 219px) 100vw, 219px\" \/><\/p>\n<p>\u4fdd\u5b58\u306b\u5f53\u305f\u3063\u3066\u306f\u3001send to\u304b\u3089File-Medline\u5f62\u5f0f\u3092\u9078\u629e\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1552\" src=\"https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/send2.png\" alt=\"\" width=\"609\" height=\"513\" srcset=\"https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/send2.png 609w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/send2-150x126.png 150w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/send2-300x253.png 300w\" sizes=\"auto, (max-width: 609px) 100vw, 609px\" \/><\/p>\n<h2>Medline\u8aad\u307f\u8fbc\u307f<\/h2>\n<blockquote><p>setwd(&#8220;C:\/Users\/Oshima\/Documents\/2018\/R deep learning\/TXT\/&#8221;)<\/p>\n<p>## define function<br \/>\nmedline &lt;- function(file_name){<br \/>\nlines &lt;- readLines(file_name)<br \/>\nmedline_records &lt;- list()<br \/>\nkey &lt;- 0<br \/>\nrecord &lt;- 0<br \/>\nfor(line in lines){<br \/>\nheader &lt;- sub(&#8221; {1,20}&#8221;, &#8220;&#8221;, substring(line, 1, 4))<br \/>\nvalue &lt;- sub(&#8220;^.{6}&#8221;, &#8220;&#8221;, line)<br \/>\nif(header == &#8220;&#8221; &amp; value == &#8220;&#8221;){<br \/>\nnext<br \/>\n}<br \/>\nelse if(header == &#8220;PMID&#8221;){<br \/>\nrecord = record + 1<br \/>\nmedline_records[[record]] &lt;- list()<br \/>\nmedline_records[[record]][header] &lt;- value<br \/>\n}<br \/>\nelse if(header == &#8220;&#8221; &amp; value != &#8220;&#8221;){<br \/>\nmedline_records[[record]][key] &lt;- paste(medline_records[[record]][key], value)<br \/>\n}<br \/>\nelse{<br \/>\nkey &lt;- header<br \/>\nif(is.null(medline_records[[record]][key][[1]])){<br \/>\nmedline_records[[record]][key] &lt;- value<br \/>\n}<br \/>\nelse {<br \/>\nmedline_records[[record]][key] &lt;- paste(medline_records[[record]][key], value, sep=&#8221;;&#8221;)<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\nreturn(medline_records)<br \/>\n}<\/p>\n<p>## read Medline<br \/>\nfileVec &lt;- list.files(file.path(getwd()),<br \/>\npattern=&#8221;.txt&#8221;,<br \/>\nfull.names = T)<br \/>\ncategoryVec &lt;- list.files(file.path(getwd()),<br \/>\npattern=&#8221;.txt&#8221;)<br \/>\ndataMed &lt;- lapply(fileVec,medline)<\/p>\n<p>## exstract Title, Abstract and CategoryVec<br \/>\ndataMedList &lt;- lapply(seq(1,length(dataMed)),function(x){<br \/>\nres &lt;- lapply(seq(1,length(dataMed[[x]])),function(y){<br \/>\nout &lt;- data.frame(title=dataMed[[x]][[y]]$TI,<br \/>\nabst=dataMed[[x]][[y]]$AB,<br \/>\ncategory=categoryVec[x])<br \/>\nreturn(out)<br \/>\n# return(x)<br \/>\n})<br \/>\nreturn(do.call(rbind,res))<br \/>\n# return(y)<br \/>\n})<\/p>\n<p>dataMedDF &lt;- do.call(rbind,dataMedList)<\/p><\/blockquote>\n<h2>\u30c7\u30fc\u30bf\u306e\u524d\u51e6\u7406<\/h2>\n<blockquote><p>dataMH &lt;- sapply(dataMed,function(i){<br \/>\nsapply(i,function(x){<br \/>\nif(all(!(names(x) %in% &#8220;MH&#8221;))){<br \/>\nstrMH &lt;- c()<br \/>\n}else{<br \/>\nstrMH &lt;- strsplit(x$MH,&#8221;;&#8221;)<br \/>\n}<br \/>\nstrMHgsub &lt;- gsub(&#8221; &#8220;,&#8221;_&#8221;,strMH[[1]])<br \/>\nstrMHpaste &lt;- paste(strMHgsub,collapse = &#8221; &#8220;)<br \/>\nreturn(strMHpaste)<br \/>\n})<br \/>\n})<\/p><\/blockquote>\n<p>\u30c8\u30d4\u30c3\u30af\u983b\u5ea6\u306e\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002\u3053\u3053\u3067\u306f\u3001\u4e0a\u8ff0\u306e\u30b5\u30a4\u30c8\u306b\u5023\u3063\u3066k=20\u3067\u3084\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote><p>library(textmineR)<br \/>\nlibrary(text2vec)<br \/>\nlibrary(tm)<br \/>\nlibrary(topicmodels)<\/p>\n<p># create vector of abstracts<br \/>\nallTexts &lt;- sapply(dataMed,function(i){<br \/>\nsapply(i,function(x){<br \/>\nti &lt;- gsub(&#8220;\\\\[|\\\\]&#8221;,&#8221;&#8221;,x$TI)<br \/>\nif(all(!(names(x) %in% &#8220;MH&#8221;))){<br \/>\nstrMH &lt;- c()<br \/>\n}else{<br \/>\nstrMH &lt;- strsplit(x$MH,&#8221;;&#8221;)<br \/>\n}<br \/>\nstrMHgsub &lt;- gsub(&#8221; &#8220;,&#8221;_&#8221;,strMH[[1]])<br \/>\nstrMHpaste &lt;- paste(strMHgsub,collapse = &#8221; &#8220;)<br \/>\npaste(ti,x$AB,strMHpaste,collapse=&#8221; &#8220;)<br \/>\n})<br \/>\n})<\/p>\n<p>allTexts &lt;- unlist(allTexts)<\/p>\n<p># preprocess<br \/>\nsw &lt;- c(&#8220;i&#8221;, &#8220;me&#8221;, &#8220;my&#8221;, &#8220;myself&#8221;, &#8220;we&#8221;, &#8220;our&#8221;, &#8220;ours&#8221;,<br \/>\n&#8220;ourselves&#8221;, &#8220;you&#8221;, &#8220;your&#8221;, &#8220;yours&#8221;, tm:::stopwords(&#8220;English&#8221;))<br \/>\npreText &lt;- tolower(allTexts)<br \/>\npreText &lt;- tm::removePunctuation(preText)<br \/>\npreText &lt;- tm::removeWords(preText,sw)<br \/>\npreText &lt;- tm::removeNumbers(preText)<br \/>\npreText &lt;- tm::stemDocument(preText, language = &#8220;english&#8221;)<\/p>\n<p># tokenize(split into single words)<br \/>\nit &lt;- itoken(preText,<br \/>\npreprocess_function = tolower,<br \/>\ntokenizer = word_tokenizer)<br \/>\n#, ids = abstID)<\/p>\n<p># delete stopwords and build vocablary<br \/>\nvocab &lt;- create_vocabulary(it,<br \/>\nstopwords = sw)<\/p>\n<p># word vectorize<br \/>\nvectorizer &lt;- vocab_vectorizer(vocab)<\/p>\n<p># create DTM<br \/>\ndtm &lt;- create_dtm(it, vectorizer)<br \/>\n# Term frecency<br \/>\nTDF &lt;- TermDocFreq(dtm)<\/p>\n<p># modeling by package &#8220;topicmodels&#8221;<br \/>\nmodel &lt;- LDA(dtm, control=list(seed=37464847),k = 20, method = &#8220;Gibbs&#8221;)<\/p>\n<p>termsDF &lt;- get_terms(model,100)<br \/>\ntopicProbability &lt;- data.frame(model@gamma,dataMedDF$category)<\/p><\/blockquote>\n<p>\u4eca\u56de\u306f\u5b66\u7fd2\u7528\u30b5\u30f3\u30d7\u30eb\u309280%, \u8a55\u4fa1\u7528\u30b5\u30f3\u30d7\u30eb\u309220%\u306b\u3057\u3066\u3001\u5206\u3051\u307e\u3057\u305f\u3002<\/p>\n<blockquote><p>train_size &lt;- 0.8<br \/>\nn &lt;- nrow(topicProbability)<br \/>\nperm &lt;- sample(n, size=round(n * train_size))<\/p>\n<p># data for training<br \/>\ntrain &lt;- topicProbability[perm, ]<\/p>\n<p># data for test<br \/>\ntest &lt;- topicProbability[-perm, ]<\/p>\n<p># imput data for training<br \/>\ntrain.x &lt;- data.matrix(train[1:20])<\/p>\n<p># label for training<br \/>\ntrain.y &lt;- as.numeric(train$dataMedDF.category) -1<\/p>\n<p># imput data for test<br \/>\ntest.x &lt;- data.matrix(test[1:20])<\/p>\n<p># label for test<br \/>\ntest.y &lt;- as.numeric(test$dataMedDF.category) -1<\/p><\/blockquote>\n<hr \/>\n<p>\u4ee5\u4e0a\u30c7\u30fc\u30bf\u306e\u524d\u51e6\u7406\u3067\u3057\u305f\u3002<\/p>\n<h2>\u968e\u5c64\u578b\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af<\/h2>\n<p>\u30c7\u30fc\u30bf\u306e\u524d\u51e6\u7406\u304c\u7d42\u308f\u308a\u307e\u3057\u305f\u306e\u3067\u3001\u3053\u3053\u304b\u3089\u304c\u3044\u308f\u3086\u308b\u6a5f\u68b0\u5b66\u7fd2\u306e\u51e6\u7406\u306b\u306a\u308a\u307e\u3059\u3002iris\u8a18\u4e8b\u306b\u5023\u3063\u3066\u3001\u672c\u7a3f\u3067\u3082\u6b21\u306e\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n<table id=\"tablepress-3\" class=\"tablepress tablepress-id-3\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\">\u5f15\u6570<\/th><th class=\"column-2\">\u5099\u8003<\/th><th class=\"column-3\">\u4eca\u56de\u306e\u30d1\u30e9\u30e1\u30fc\u30bf<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">hidden_node<\/td><td class=\"column-2\">\u96a0\u308c\u5c64\u306e\u30ce\u30fc\u30c9\uff08\u30cb\u30e5\u30fc\u30ed\u30f3\uff09\u6570\u3000\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\uff11<\/td><td class=\"column-3\">5<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">out_node<\/td><td class=\"column-2\">\u51fa\u529b\u30ce\u30fc\u30c9\u6570\uff08\u5206\u985e\u6570\u3001\u4eca\u56de\u306fA\u85ac\u3068B\u85ac\u306e\uff12\uff09<\/td><td class=\"column-3\">2<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">num.round<\/td><td class=\"column-2\">\u7e70\u308a\u8fd4\u3057\u56de\u6570\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\uff11\uff10\uff09<\/td><td class=\"column-3\">100<\/td>\n<\/tr>\n<tr class=\"row-5\">\n\t<td class=\"column-1\">array.batch.size<\/td><td class=\"column-2\">\u30d0\u30c3\u30c1\u30b5\u30a4\u30ba\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f128\uff09<\/td><td class=\"column-3\">10<\/td>\n<\/tr>\n<tr class=\"row-6\">\n\t<td class=\"column-1\">learning.rate<\/td><td class=\"column-2\">\u5b66\u7fd2\u4fc2\u6570<\/td><td class=\"column-3\">0.1<\/td>\n<\/tr>\n<tr class=\"row-7\">\n\t<td class=\"column-1\">activation<\/td><td class=\"column-2\">\u6d3b\u6027\u5316\u4fc2\u6570\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f'tanh'\uff09<\/td><td class=\"column-3\">'relu'<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-3 from cache -->\n<p>&#8216;tanh&#8217;, &#8216;relu&#8217;\u3068\u306f\u306a\u3093\u305e\u3084\u3001\u3068\u3044\u3046\u306e\u306f\u89e3\u3089\u306a\u3044\u3002<a href=\"https:\/\/qiita.com\/miyamotok0105\/items\/3435930cc04650bce54d\">\u300c\u30d5\u30ea\u30fc\u30e9\u30f3\u30b9\u306e\u30d7\u30ed\u30b0\u30e9\u30de\u300d\u3055\u3093\u306b\u3088\u308b\u3068<\/a>\u3001\u300c\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068Relu\u3092\u4f7f\u304a\u3046\u300d\u306a\u306e\u3060\u305d\u3046\u3067\u3059\u3002<\/p>\n<blockquote><p># deep learning<\/p>\n<p>library(mxnet)<br \/>\nmx.set.seed(0)<\/p>\n<p># \u5b66\u7fd2<br \/>\nmodel &lt;- mx.mlp(train.x, train.y,<br \/>\nhidden_node = 5,<br \/>\nout_node = 2,<br \/>\nnum.round = 100,<br \/>\nlearning.rate = 0.1,<br \/>\narray.batch.size = 10,<br \/>\nactivation = &#8216;relu&#8217;,<br \/>\narray.layout = &#8216;rowmajor&#8217;,<br \/>\neval.metric = mx.metric.accuracy)<\/p>\n<p># \u8a55\u4fa1<br \/>\npred &lt;- predict(model, test.x, array.layout = &#8216;rowmajor&#8217;)<\/p>\n<p># \u8a55\u4fa1\u7528\u30c7\u30fc\u30bf\u306e\u5206\u985e\u7d50\u679c\uff080, 1\uff09<br \/>\npred.y &lt;- max.col(t(pred)) -1<\/p>\n<p># \u8a55\u4fa1\u30c7\u30fc\u30bf\u306e\u6b63\u89e3\u306e\u5272\u5408\u3092\u7b97\u51fa<br \/>\nacc &lt;- sum(pred.y == test.y) \/ length(pred.y)<\/p>\n<p>print(acc)<\/p><\/blockquote>\n<h2>\u7d50\u679c<\/h2>\n<p>\u6b21\u306e\u901a\u308a97.1% (95%CI; 92.6 &#8211; 99.2) \u306e\u5272\u5408\u3067\u6b63\u89e3\u306b\u5206\u985e\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1563\" src=\"https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/296a514253022ddcae4376aa5409bc04.png\" alt=\"\" width=\"492\" height=\"110\" srcset=\"https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/296a514253022ddcae4376aa5409bc04.png 492w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/296a514253022ddcae4376aa5409bc04-150x34.png 150w, https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/296a514253022ddcae4376aa5409bc04-300x67.png 300w\" sizes=\"auto, (max-width: 492px) 100vw, 492px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b \u672c\u7a3f\u306fR\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3067deep learning\u304c\u3067\u304d\u308b\u3068\u805e\u3044\u3066\u3001\u30cd\u30c3\u30c8\u3067\u8abf\u3079\u306a\u304c\u3089\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3046\u9053\u7b4b\u3092\u3064\u3051\u308b\u307e\u3067\u306e\u3001\u5fd8\u5099\u9332\u3067\u3059\u3002\u30b5\u30f3\u30d7\u30eb\u306b\u3057\u305f\u306e\u306f\u3001\u300cA\u85ac\u300d\u3067\u691c\u7d22\u3057\u305f\u7d50\u679c\u3068\u300cB\u85ac\u300d\u3067\u691c\u7d22\u3057\u305f\u7d50\u679c\u3092\u3001\u30c6\u30ad\u30b9&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1565,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1543","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-science"],"jetpack_featured_media_url":"https:\/\/plaza.umin.ac.jp\/~OIO\/wp-content\/uploads\/2018\/08\/deepLearning.png","jetpack_shortlink":"https:\/\/wp.me\/p9b6zl-oT","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/plaza.umin.ac.jp\/~OIO\/index.php?rest_route=\/wp\/v2\/posts\/1543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/plaza.umin.ac.jp\/~OIO\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/plaza.umin.ac.jp\/~OIO\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/plaza.umin.ac.jp\/~OIO\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/plaza.umin.ac.jp\/~OIO\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1543"}],"version-history":[{"count":0,"href":"https:\/\/plaza.umin.ac.jp\/~OIO\/index.php?rest_route=\/wp\/v2\/posts\/1543\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/plaza.umin.ac.jp\/~OIO\/index.php?rest_route=\/wp\/v2\/media\/1565"}],"wp:attachment":[{"href":"https:\/\/plaza.umin.ac.jp\/~OIO\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plaza.umin.ac.jp\/~OIO\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plaza.umin.ac.jp\/~OIO\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}