文章 "第三代神经网络:深度网络" - 页 12

 
kimkarus:

弗拉基米尔-佩列文科

在文章中添加有关使用 R Studio 的其他信息

  • 为确保一切运行正常,需要确保 hosts 文件中没有其他对 "localhost "的引用。

下午好。

我不太理解主机文件。您能提供更多详细信息吗?

祝你好运

 
kimkarus:

弗拉基米尔-佩列文科

在文章中添加有关使用 R Studio 的其他信息

  • 要正确运行所有程序,需要确保在 hosts 文件中没有其他对 "localhost "的引用。
  • 请务必安装所有软件包,并使用命令(在 R 工作区中)运行它们:

install.packages("R.matlab")
install.packages("deepnet")
install.packages("caret")
install.packages("h2o")
install.packages("TTR")
install.packages("rminer")
install.packages("foreach")
install.packages("doParallel")
install.packages("svSocket")
install.packages("lattice")
install.packages("ggplot2")
install.packages("statmod")
install.packages("kknn")
install.packages("iterators")
install.packages("parallel")

library("R.matlab")
library("deepnet")
library("caret")
库("h2o")
库("TTR")
library("rminer")
library("foreach")
library("doParallel")
library("svSocket")
library("lattice")
库("ggplot2")
库("statmod")
库("kknn")
库("迭代器")
库("并行")

我使用另一种记录形式来检查已安装的软件包:

packets <- Hmisc::Cs(R.matlab, deepnet, caret, h2o, TTR, rminer, foreach, doParallel, 
                        svSocket, lattice, ggplot2, statmod, kknn, iterators, parallel)
for(i in 1:length(packets)) {
  if (! (packets[i] %in% rownames(installed.packages()))) { 
    install.packages(packets[i]) }
}

您应该在使用库的函数描述中加载库。虽然在初始化智能交易系统时也可以这样做。

那么,为什么需要在测试器中运行智能交易系统呢?

祝您好运

 

在长时间调试 R 脚本的过程中,发现了一个在输入数据有 NA 的情况下很难捕捉的错误。它根本不会触发信号。在 "e_SAE_init.r "文件中,建议在 new.data <- predict(prepr, tail(x, 50)): x <- na.omit(x) 之前,在 Test(dt,x) 函数中添加一个 NA 清理项;

这似乎是个 "拐杖",但我还没想到更好的办法。

如果不这样做,就会出现隐藏错误:

Error in if (sqrt(denom) > .Machine$double.eps) x/sqrt(denom) else x * : missing value where TRUE/FALSE needed

 
kimkarus:

在长时间调试 R 脚本的过程中,发现了一个在输入数据有 NA 的情况下很难捕捉的错误。它根本不会触发信号。在 "e_SAE_init.r "文件中,建议在 new.data <- predict(prepr, tail(x, 50)): x <- na.omit(x) 之前,在 Test(dt,x) 函数中添加一个 NA 清理项;

这似乎是个 "拐杖",但我还没想到更好的办法。

如果不这样做,就会出现隐藏错误:

Error in if (sqrt(denom) > .Machine$double.eps) x/sqrt(denom) else x * : missing value where TRUE/FALSE needed

kimkarus:

在调试 R 脚本的很长一段时间里,我发现了一个在输入数据有 NA 时很难捕捉的错误。它根本不会触发信号。在 "e_SAE_init.r "文件中,建议在 new.data <- predict(prepr, tail(x, 50)): x <- na.omit(x) 之前,在 Test(dt,x) 函数中添加一个 NA 清理项;

这似乎是个 "拐杖",但我还没想到更好的办法。

如果不这样做,就会出现隐藏错误:

Error in if (sqrt(denom) > .Machine$double.eps) x/sqrt(denom) else x * : missing value where TRUE/FALSE needed

该语句不正确。

在 Test(dt, x) 函数中,x 是由 In() 函数计算的输入数据。让我们看看 "i_SAE_fun.r "脚本中的数据

In <- function(p = 16){
        require(TTR)
        adx <- ADX(price, n = p)
        ar <- aroon(price[ ,c('High', 'Low')], n = p)[ ,'oscillator']
        cci <- CCI(price[ ,2:4], n = p)
        chv <- chaikinVolatility(price[ ,2:4], n = p)
        cmo <- CMO(price[ ,'Med'], n = p)
        macd <- MACD(price[ ,'Med'], 12, 26, 9)[ ,'macd']
        osma <- macd - MACD(price[ ,'Med'],12, 26, 9)[ ,'signal']
        rsi <- RSI(price[ ,'Med'], n = p)
        stoh <- stoch(price[ ,2:4], 14, 3, 3)
        smi <- SMI(price[ ,2:4],n = p, nFast = 2, nSlow = 25, nSig = 9)
        vol <- volatility(price[ ,1:4], n = p, calc="yang.zhang", N=96)
        In <- cbind(adx, ar, cci, chv, cmo, macd, osma, rsi, stoh, smi, vol)
        return(In)
}

这是一些指标。让我们在长度为 2000 条的价格[]历史记录上计算它们。

> x <- In()加载所需软件包:TTR 让我们看看得到了哪些数据
> summary(x)
      DIp             DIn                DX          
 Min.   :20.24   Min.   :  9.546   Min.   : 0.04605  
 1st Qu.:43.61   1st Qu.: 31.022   1st Qu.:10.28793  
 Median :50.46   Median : 39.297   Median :19.31075  
 Mean   :49.01   Mean   : 41.833   Mean   :21.82957  
 3rd Qu.:55.78   3rd Qu.: 49.441   3rd Qu.:31.18539  
 Max.   :74.50   Max.   :116.050   Max.   :71.84495  
 NA's   :16      NA's   :16        NA's   :16        
      ADX               ar                cci           
 Min.   : 7.038   Min.   :-100.000   Min.   :-364.2786  
 1st Qu.:15.559   1st Qu.: -56.250   1st Qu.: -86.9604  
 Median :20.450   Median : -12.500   Median :  -6.4301  
 Mean   :21.878   Mean   :  -1.147   Mean   :  -0.3145  
 3rd Qu.:27.330   3rd Qu.:  56.250   3rd Qu.:  86.1551  
 Max.   :47.191   Max.   : 100.000   Max.   : 331.4449  
 NA's   :31       NA's   :16         NA's   :15         
      chv                cmo                macd          
 Min.   :-0.63538   Min.   :-88.8628   Min.   :-0.219469  
 1st Qu.:-0.28769   1st Qu.:-29.6125   1st Qu.:-0.030508  
 Median :-0.01415   Median : -0.8713   Median : 0.001847  
 Mean   : 0.12162   Mean   : -1.6646   Mean   : 0.009282  
 3rd Qu.: 0.35276   3rd Qu.: 27.7824   3rd Qu.: 0.037112  
 Max.   : 7.37405   Max.   : 86.9767   Max.   : 0.703234  
 NA's   :31         NA's   :16         NA's   :25         
      osma               rsi             fastK       
 Min.   :-0.10903   Min.   : 8.614   Min.   :0.0000  
 1st Qu.:-0.01063   1st Qu.:41.108   1st Qu.:0.2246  
 Median :-0.00016   Median :50.547   Median :0.4553  
 Mean   :-0.00006   Mean   :49.953   Mean   :0.4793  
 3rd Qu.: 0.01021   3rd Qu.:58.706   3rd Qu.:0.7425  
 Max.   : 0.28849   Max.   :84.854   Max.   :1.0000  
 NA's   :33         NA's   :16       NA's   :13      
     fastD             slowD              SMI         
 Min.   :0.01645   Min.   :0.03279   Min.   :-77.616  
 1st Qu.:0.23056   1st Qu.:0.23618   1st Qu.:-27.662  
 Median :0.45989   Median :0.46420   Median : -2.998  
 Mean   :0.47916   Mean   :0.47922   Mean   : -3.468  
 3rd Qu.:0.72776   3rd Qu.:0.71850   3rd Qu.: 21.330  
 Max.   :0.98610   Max.   :0.96254   Max.   : 73.964  
 NA's   :15        NA's   :17        NA's   :25       
     signal             vol          
 Min.   :-74.526   Min.   :0.001235  
 1st Qu.:-24.781   1st Qu.:0.003168  
 Median : -2.446   Median :0.004686  
 Mean   : -3.358   Mean   :0.005457  
 3rd Qu.: 19.029   3rd Qu.:0.006484  
 Max.   : 71.664   Max.   :0.047742  
 NA's   :33        NA's   :16        
所有变量都是 NA。但它们都位于开头!!这对所有指标来说都是正常的。 因此,当我们在脚本中写入

 new.data <- predict(prepr, tail(x, 500));

删除未定义的数据。条件:nrow(x) > 500 + max(NA)。即至少在我们的情况下是 533。为了安全起见,nrow(x) = 600-700。

我不明白你是如何在 x 中得到不确定的 NA 的。

祝你好运

 

你好,弗拉基米尔、

这是来自巴西的

我阅读了您关于使用 R 语言创建神经网络的说明,但我有一个愚蠢的问题(抱歉,我是这方面的新手!)。

在您写的教程 (https://www.mql5.com/zh/articles/1103#ch_3) 中,在"第 3.3.1 节 - 源数据"中,您描述了一个名为 pr.OHLC 的函数,我对此非常了解。

但是,我不太清楚下面的结果需要哪些参数。

> head(price)
        Open    High     Low   Close      Med     CO
[1,] 1.33848 1.33851 1.33824 1.33844 1.338375 -4e-05
[2,] 1.33843 1.33868 1.33842 1.33851 1.338550  8e-05
[3,] 1.33849 1.33862 1.33846 1.33859 1.338540  1e-04
[4,] 1.33858 1.33861 1.33856 1.33859 1.338585  1e-05
[5,] 1.33862 1.33868 1.33855 1.33855 1.338615 -7e-05 

您能帮我解决这个问题吗?

最好、

法比奥

Third Generation Neural Networks: Deep Networks
Third Generation Neural Networks: Deep Networks
  • 2015.02.05
  • Vladimir Perervenko
  • www.mql5.com
This article is dedicated to a new and perspective direction in machine learning - deep learning or, to be precise, deep neural networks. This is a brief review of second generation neural networks, the architecture of their connections and main types, methods and rules of learning and their main disadvantages followed by the history of the third generation neural network development, their main types, peculiarities and training methods. Conducted are practical experiments on building and training a deep neural network initiated by the weights of a stacked autoencoder with real data. All the stages from selecting input data to metric derivation are discussed in detail. The last part of the article contains a software implementation of a deep neural network in an Expert Advisor with a built-in indicator based on MQL4/R.
 
fabiocarvalho:

你好,弗拉基米尔、

这是来自巴西的

我阅读了您关于使用 R 语言创建神经网络的说明,但我有一个愚蠢的问题(抱歉,我是这方面的新手!)。

在您写的教程 (https://www.mql5.com/zh/articles/1103#ch_3) 中,在"第 3.3.1 节 - 源数据"中,您描述了一个名为 pr.OHLC 的函数,我对此非常了解。

但是,我不太清楚下面的结果需要哪些参数。

您能帮我解决这个问题吗?

最好、

法比奥

你好,法比奥、

什么地方不清楚?

pr.OHLC <- function (o, h, l, c) 
{
  #Unite quote vectors into a matrix having previously expanded them
  #Indexing of time series of vectors in R starts with 1. 
  #Direction of indexing is from old to new ones.   
  price <- cbind(Open = rev(o), High = rev(h), Low = rev(l), Close = rev(c))
  Med <- (price[, 2] + price[, 3])/2 #We calculate average price (HIgh + Low)/2
  CO <- price[, 4] - price[, 1] # We calculate body candles (Close - Open)
  #add Med and CO to the matrix
  price <- cbind(price, Med, CO)#We are putting it all in a matrix
}
 

你好,弗拉基米尔、

是否有可能获得 MT5 的文件?

请联系

法比奥-利马

 
fabioflimaster:

你好,弗拉基米尔、

是否有可能获得 MT5 的文件?

请联系

法比奥-利马

你好,法比奥、

很抱歉

我不会 MKL5

致以最诚挚的问候

弗拉基米尔


 

有一个问题 .我不太清楚价格矢量的顺序 .

您在这里做了一次反转: price <- cbind(Open = rev(o), High = rev(h), Low = rev(l), Close = rev(c))

o,h,l,c 的原始顺序是什么?

 
jake89:

有一个问题 .我不太清楚价格矢量的顺序 .

您在这里做了一次反转: price <- cbind(Open = rev(o), High = rev(h), Low = rev(l), Close = rev(c))

o,h,l,c 的原始顺序是什么?

您好、

MT4 对 条形图的 编号 是从 最近的 到最远的。 R 则相反, 从旧到 新条形图 排在最后