zoukankan      html  css  js  c++  java
  • apache mxnet 深度学习神经网络小试

    http://mxnet.incubator.apache.org/versions/master/install/index.html?platform=Windows&language=R&processor=CPU

    1 cran <- getOption("repos")
    2 cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/"
    3 options(repos = cran)
    4 install.packages("mxnet")

    安装之前需要指定repository

    一起安装的包

    package ‘brew’ successfully unpacked and MD5 sums checked
    package ‘hms’ successfully unpacked and MD5 sums checked
    package ‘clipr’ successfully unpacked and MD5 sums checked
    package ‘XML’ successfully unpacked and MD5 sums checked
    package ‘Rook’ successfully unpacked and MD5 sums checked
    package ‘downloader’ successfully unpacked and MD5 sums checked
    package ‘igraph’ successfully unpacked and MD5 sums checked
    package ‘influenceR’ successfully unpacked and MD5 sums checked
    package ‘readr’ successfully unpacked and MD5 sums checked
    package ‘rgexf’ successfully unpacked and MD5 sums checked
    package ‘DiagrammeR’ successfully unpacked and MD5 sums checked
    package ‘visNetwork’ successfully unpacked and MD5 sums checked
    package ‘mxnet’ successfully unpacked and MD5 sums checked

    额外的依赖

    To run MXNet you also should have OpenCV and OpenBLAS installed.

    第一步:数据准备

    1 set.seed(0)
    2 #随机分配训练集和测试集
    3 train.ind = sample(1:nrow(inp), size=ceiling(0.7*nrow(inp)))
    4 
    5 train.x = data.matrix(inp[train.ind,NIRDATA])
    6 train.y = inp[train.ind,NIC]
    7 test.x = data.matrix(inp[-train.ind,NIRDATA])
    8 test.y = inp[-train.ind,NIC]

    第二步:创建网络并训练

    1 mx.set.seed(0)
    2 
    3 model <- mx.mlp(train.x, train.y, hidden_node=c(7), out_node=1, out_activation="rmse",
    4                 num.round=2000, array.batch.size=15, learning.rate=0.05, momentum=0.9,
    5                 eval.metric=mx.metric.rmse)

    hidden_node接受向量,c(100,50)代表两层隐含层,分别具有100和50个节点

    out_node输出层

    eval.metric=mx.metric.rmse
    评估方法,rmse 标准差
    评估测试集
    predict(model,test.x)->prd
    
    plot(prd,test.y)
  • 相关阅读:
    spring 的简单了解
    leetcode 刷题锻炼算法思维
    REDIS学习笔记
    mark:如何使用FileZilla连接虚拟机上的Fedora
    尝试在virtualbox fedora21 下安装additions和mount share folder
    字符集与Mysql字符集处理(二)
    字符集与Mysql字符集处理(一)
    MYSQL开发性能研究——INSERT,REPLACE,INSERT-UPDATE性能比较
    MYSQL开发性能研究——批量插入的优化措施
    Marven笔记贴
  • 原文地址:https://www.cnblogs.com/qianheng/p/10850162.html
Copyright © 2011-2022 走看看