[译]免费的DARL在线服务进行过程仿真
By robot-v1.0
本文链接 https://www.kyfws.com/ai/process-simulation-with-the-free-darl-online-servi-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 14 分钟阅读 - 6759 个词 阅读量 0免费的DARL在线服务进行过程仿真(译文)
原文地址:https://www.codeproject.com/Articles/1251218/Process-Simulation-with-the-Free-DARL-Online-Servi
原文作者:AndyEdmonds
译文由本站 robot-v1.0 翻译
前言
You can simulate with DARL too! This demonstrates a financial trading simulation.
您也可以使用DARL进行模拟!这演示了金融交易模拟.
介绍(Introduction)
这是4(This is the 4)日(th)在有关DARL的一系列文章中,该语言和在线REST接口以及SaaS服务使您能够构建和使用模糊逻辑专家系统,甚至可以使用机器学习来创建它们.(in a sequence of articles about DARL A language and online REST interface and SaaS service that enables you to build and employ fuzzy logic expert systems, and even create them using Machine Learning.)
到目前为止,我已经描述了DARL的用法,他们只关注一个时间点,在该时间点,推理所需的所有信息都可用,或者可以通过一系列问题获得.这忽略了时间的影响或推理对先前发生的一系列事件的依赖关系. DARL有一个称为DASL(Andy医生的模拟语言)的变体,可以处理基于时间的推理. DARL和DASL之间的唯一区别是一个新元素,即(As I’ve described the uses of DARL so far, they have been concerned only with one point in time, where all the information required for an inference is available, or can be obtained through a set of questions. This ignores the effect of time or the dependency an inference might have on a sequence of events having occurred previously. DARL has a variant called DASL (Doctor Andy’s Simulation Language) that can handle time based inference. The only difference between DARL and DASL is one new element, the)**延迟(Delay)**操作员,以及内置了时态数据库的运行时引擎.(operator, and a runtime engine that has a temporal database built in.)
可以找到此示例的代码(Code for this example can be found) 这里(here) .(.)
描述了我们正在使用的免费REST接口(The free REST interface we are using is described) 这里(here) .(.)
先前的文章是:(The previous articles are:)
- DARL语言及其在线模糊逻辑专家系统引擎(The DARL Language and its online Fuzzy Logic Expert System Engine)
- DARL – AI和模糊逻辑规则语言示例–脚本机器人(DARL – AI and fuzzy logic rule language examples – scripting Bots)
- DARL和Whitebox机器学习(DARL and Whitebox Machine Learning)
背景(Background)
我将用来演示DASL/DARL模拟如何有用的示例来自金融交易.显然,金融交易是一个巨大的课题.但是,有一个非常简单的基本原则:(The example I’m going to use to demonstrate how DASL/DARL simulation might be useful is drawn from financial trading. Obviously, financial trading is an enormous subject. However, there is one fundamental principle that is very simple: “)便宜买,亲爱的(Buy cheap, sell dear)”.(".)
交易是指将资金从一种金融工具转移到另一种金融工具,然后再转移回去,这样您可以在完成交易后拥有更多的第一种金融工具.在这种情况下,我们将使用的两种金融工具是英镑和美元.我将从模拟的10,000英镑开始,然后进行美元进出交易.(Trading is about transferring funds from one financial instrument to another and back again, in such a way as to have more of the first financial instrument when you’ve finished. In this case, the two financial instruments we will use are the pound sterling and the dollar. I’m going to start with a simulated £10,000 and trade in and out of the dollar.)
为此,我在文件库中收集了两年间两年间每日交易的历史数据,您可以在名为(To do this, I’ve collected two years' historic data of daily trading between the two in the file you can find in the repository entitled)GBP_USD.csv(GBP_USD.csv).(.)
该数据包含日期以及每天的开盘价,收盘价,最高汇率和最低汇率.我们将在结束时模拟交易.在文件中,该值称为"(This data contains a date and the open, close, high and low exchange rates for each day. We’re going to simulate trading at the close. In the file, this value is called “) price
“.(”.)
当您通过交易所进行任何交易或使用大街上的外汇交易时,有两种成本来源.通常会有交易费和"价差”,这是对中央汇率的抵消.这些是经纪人保证利润的来源.我们的仿真将同时具有这两个值.(When you trade anything through an exchange, or use a high street foreign exchange, there are two sources of cost. There’s normally a transaction fee and there’s a “spread” which is an offset to the central rate. These are the sources of guaranteed profit to the brokers. Our simulation will have values for both of these.)
模拟交易将要求我们响应交易信号并购买被告知的任何一种货币,以计算和减去费用,并跟踪我们持有的资产的价值.(Simulating trading will require us to respond to a trading signal and to buy whichever currency we are told, to calculate and subtract charges, and to keep track of the value of our holding.)
用交易术语来说,在货币交易中,您可以"做多"或"做空"特定货币.如果我们持有英镑,我们就是多头英镑,做空美元;如果我们持有美元,我们就是空头英镑和多头美元.(In trading parlance, in currency trading, you can be “long” or “short” a particular currency. If we are holding sterling, we are long sterling and short the dollar, if we are holding dollars we are short sterling and long dollar.)
我们将设置相对于英镑的术语,因此长交易信号表示买入英镑,而短交易信号表示买入美元.在此简单的交易模拟中,我们将在一种货币与另一种货币之间切换所有现金.(We’ll set the terminology relative to sterling, so a long trading signal means buy sterling, and a short means buy dollar. In this simple trading simulation, we will switch all of our cash between one currency and the other.)
因此,我们拥有汇率的历史记录以及具有交易信号的模拟交易.我们如何决定产生什么交易信号?当然,这是百万(十亿/万亿?)美元的问题.只要我们知道!(So we have a history of exchange rates and a simulation of trading that takes trading signals. How do we decide what trading signals to generate? This, of course is the million (billion/trillion?) dollar question. If only we knew!)
为简单起见,我将使用一种旧的交易策略,即一种动量交易.它使用两个移动平均线,一个移动平均线的长度较小,一个移动平均线的长度较大,并且当一个线穿过另一个线时,就会生成交易信号.大多数交易策略使用对工具过去历史的某种分析来产生交易信号.我为这些移动平均线选择了3和9的长度.您可能要尝试一下.(For simplicity, I’m going to use an old trading strategy that is a kind of momentum trading. It uses two moving averages, one with a small length and one with a large length, and when one crosses the other, a trading signal is generated. Most trading strategies use some analysis of the past history of the instrument to generate trading signals. I’ve selected lengths of 3 and 9 for these moving averages. You may well want to experiment.)
一个警告(A warning).财务时间序列已显示(由(. Financial time series have been shown (by) 我(myself) 等)变得混乱.这意味着它们是长期无法预测的.实际上,这意味着,即使您找到了可以在一段时间内运行的交易系统,也很难随着时间的流逝而继续运行.我不建议您实际使用这些想法.实际上,我举的例子是亏本的.但是毫无疑问,可以找到某种组合的移动平均线.(and others) to be Chaotic. This means that they are unpredictable long term. What this means in practice is that, even if you find a trading system that works over a period of time, it is very unlikely to continue to work as time goes by. I don’t advise you to actually trade with these ideas. In fact, the example I’ve given loses money. But no doubt some combination of moving averages could be found that didn’t.)## DARL代码(The DARL Code)
我们的模拟包括汇率历史记录,DARL规则集代码,将执行模拟的DARL站点上的REST接口以及一些用于加载数据,编排模拟并报告结果的C#代码.(Our simulation consists of the exchange rate history, DARL ruleset code, the REST interface on the DARL site which will perform the simulation, and some C# code to load the data, orchestrate the simulation and report the results.)
到目前为止,DARL代码的所有示例在代码中都只有一个规则集.在此示例中,有两个规则集.第一个叫做"(All the examples so far of DARL code have had only a single ruleset in the code. In this example, there are two rulesets. The first is called “) tradingrules
“:(":)
ruleset tradingrules
{
input numeric price;
input numeric price_1;
input numeric price_2;
input numeric price_3;
input numeric price_4;
input numeric price_5;
input numeric price_6;
input numeric price_7;
input numeric price_8;
output numeric average3;
output numeric average9;
output categorical trade {long,short};
if anything then average3 will be sum(price, price_1, price_2) / 3;
if anything then average9 will be sum
(price, price_1, price_2, price_3, price_4, price_5, price_6, price_7, price_8) / 9;
if average3 is >= average9 then trade will be long;
if average3 is < average9 then trade will be short;
}
这需要9个输入,(This takes in 9 inputs, the) price
及其8个延迟版本.它创建两个移动平均线和一个交易信号.(and 8 delayed versions thereof. It creates two moving averages and a single trading signal.)
到目前为止,这是如何工作的应该是显而易见的.(By now, how this works should be obvious.) price_1
价格延迟一个采样时间-在这种情况下是一天,并且(is the price delayed by one sample time - in this case one day, and) price_8
延迟了8天.(is delayed by 8 days.)
我将在稍后描述如何获取延迟值.(I’ll describe how we get the delayed values later.)
交易模拟如下:(The trading simulation looks like this:)
ruleset tradingsim
{
input categorical trade {long,short};
input categorical oldtrade {long,short};
input numeric price;
input numeric balance;
constant spread 0.001;
constant transaction_fee 10.00;
output categorical transact {true,false};
output numeric newbalance;
output numeric sterling;
if not trade is categoryof(oldtrade) or trade is present and oldtrade is absent
then transact will be true;
otherwise if anything then transact will be false;
if transact is true and trade is long then newbalance will be balance / (price + spread) -
transaction_fee;
if transact is true and trade is short then newbalance will be balance * (price - spread) -
transaction_fee * price;
otherwise if anything then newbalance will be balance;
if trade is short then sterling will be newbalance / price;
otherwise if anything then sterling will be newbalance;
}
输入是交易信号”(The inputs are the trading signal “) trade
" 来自(” from the) tradingrules
规则集(ruleset,) oldtrade
这是最后一个交易信号,所以(which is the last trading signal, so) trade
延迟一个周期,当前(delayed by one cycle, the current) price
和当前(and the current) balance
.(.)
输出是(The outputs are) transact
,它响应交易信号的变化,(, which responds to a change in trading signal,) newbalance
,这是交易后底池的价值,以及(, which is the value of the pot after the transaction, and) sterling
,即锅的英镑价值.(, which is the sterling value of the pot.)
所以,(So,) transact
在任何时候都是真的(is true whenever) trade
与…不同(is not the same as) oldtrade
,或者在移动平均线填满后的第一个交易的特殊情况下,(, or in the special case of the first trade after the moving averages fill up, when) trade
是已知的,但是(is known, but) oldtrade
未知.(is unknown.)
每当(Whenever) transact
触发时,我们将资金从一种货币切换到另一种货币,因此我们会产生费用.电荷由常数设置.所以(fires, we switch the funds from one currency to the other, incurring charges as we go. The charges are set by the constants. So) newbalance
和(and) balance
分别是美元和英镑.(are in alternately dollars and pounds sterling.)
最后,为了追踪事物,(Finally, in order to keep track of things,) sterling
通过转换显示英镑的锅价(shows you the value of the pot in pounds sterling by converting) newbalance
只要它包含美元.(whenever it contains dollars.)
DARL的最后一位创建延迟,并将所有内容连接在一起.因此,DARL使用电路图/示意图范例,其中规则集就像电子组件,mapinput和mapoutput就像边缘连接器,并且连接并延迟连接所有东西.(The last bit of DARL creates the delays and wires everything together. So DARL uses a circuit diagram/schematic paradigm where rulesets are like electronic components, mapinputs and mapoutputs are like edge connectors, and wires and delays wire everything up.)
mapinput price;
mapinput balance;
mapoutput sterling;
mapoutput trade;
mapoutput newbalance;
wire price tradingrules.price;
wire price tradingsim.price;
wire balance tradingsim.balance;
wire tradingrules.trade tradingsim.trade;
wire tradingsim.sterling sterling;
wire tradingrules.trade trade;
wire tradingsim.newbalance newbalance;
delay trade tradingsim.oldtrade {0};
delay price tradingrules.price_1 {0};
delay price tradingrules.price_2 {1};
delay price tradingrules.price_3 {2};
delay price tradingrules.price_4 {3};
delay price tradingrules.price_5 {4};
delay price tradingrules.price_6 {5};
delay price tradingrules.price_7 {6};
delay price tradingrules.price_8 {7};
delay newbalance tradingsim.balance {0};
延迟的行为类似于导线,但是会延迟信号.大括号中的信号偏移值可能会造成混淆.(Delays behave like wires, but they delay the signal. The signal offset values in the curly brackets are perhaps confusing.) {0}
offset表示反馈的处理周期的结果,即先前的值.延迟(offset means the result of a processing cycle fed back, so the previous value. A delay of) {1}
表示先前的值又延迟了一个周期,依此类推.(means the previous value delayed a further cycle, and so on.)
DASL运行时(The DASL Runtime)
DASL运行时的工作是获取按时间排列的一组数据值,并通过推理引擎和规则集对它们进行排序.(The DASL runtime’s job is to take a set of data values arranged in time and sequence them through the inference engine and through the rulesets.)
由于DARL使用模糊推理引擎,因此任何输入或输出都可以处于已知或未知状态,并具有确定性.如果当前使用的数据序列中存在一个数据项,则将其标记为已知.如果不是,则未知.(Because DARL uses a fuzzy inference engine, any input or output can be in a known or unknown state and have degrees of certainty attached. If a data item is present in the current sequence of the data used, then it’s marked as known. if not, unknown.)
在模拟中,您经常会在一段时间后耗尽数据.例如,如果您要使用直到现在的历史数据来模拟工厂,但是您希望模拟会持续到将来.(In a simulation, you often have data that runs out after a while. For instance, if you were simulating a factory using historical data right up to the present, but you would expect the simulation to continue into the future.)
DASL的排列方式是,如果您的输出与历史数据中的数据值同名,则它将使用历史值直到其用完,然后无缝切换到模拟值.(DASL is arranged so that, if you have an output with the same name as a data value in the historical data, it will use the historical value until it runs out, and then switch seamlessly to the simulated value.)
这就是(This is what happens with the) balance
值.仅在第一组数据中设置此值,以将底池的初始值设置为10,000英镑,然后由仿真提供该值.(value. This is only set in the first set of data to set the initial value of the pot at £10,000, and thereafter the value is provided by the simulation.)
输入数据(Input Data)
输入到仿真中的时间序列数据要求采用特定格式.(The time series data input to the simulation is required to be in a particular format.)
public class DaslData
{
/// <summary>
/// The code
/// </summary>
public string code { get; set; }
/// <summary>
/// The time series history
/// </summary>
public DaslSet history { get; set; }
}
一种(A) DaslSet
看起来像这样:(looks like this:)
public class DaslSet
{
/// <summary>
/// Gets or sets the events.
/// </summary>
/// <value>
/// The events.
/// </value>
[Required]
[Display(Name = "The sequence of events",
Description = "A sequence of time-tagged sets of values")]
public List<DaslState> events { get; set; } = new List<DaslState>();
/// <summary>
/// Gets or sets the sample time.
/// </summary>
/// <value>
/// The sample time.
/// </value>
[Required]
[Display(Name = "The sample time",
Description = "Will be used to set up the sample time of the simulation")]
public TimeSpan sampleTime { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>
/// The description.
/// </value>
[Display(Name = "The description",
Description = "Description of the contained sampled events")]
public string description { get; set; }
}
的(The) sampleTime
确定模拟的时钟速率.(determines the clock rate of the simulation.) events
包含时间序列数据作为时间标记的时间片.(contains the time series data as time tagged time slices.)
DaslState
看起来像这样:(looks like this:)
public class DaslState
{
/// <summary>
/// Gets or sets the time stamp.
/// </summary>
/// <value>The time stamp.</value>
[Required]
[Display(Name = "The time stamp",
Description = "The moment these values changed or became valid")]
public DateTime timeStamp { get; set; }
/// <summary>
/// Gets or sets the values.
/// </summary>
/// <value>The values.</value>
[Required]
[Display(Name = "The values",
Description = "A set of values that changed or became valid at the given time")]
public List<DarlVar> values { get; set; }
}
最后,(Finally,) DarlVar
类保存单个数据值,并用名称,不确定性等进行注释.(classes hold individual data values, annotated with a name, uncertainty, etc.)
[Serializable]
public partial class DarlVar
{
/// <summary>
/// The type of data stored in the DarlVar
/// </summary>
public enum DataType
{
/// <summary>
/// Numeric including fuzzy
/// </summary>
numeric,
/// <summary>
/// One or more categories with confidences
/// </summary>
categorical,
/// <summary>
/// Textual
/// </summary>
textual,
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string name { get; set; }
/// <summary>
/// This result is unknown if true.
/// </summary>
/// <value><c>true</c> if unknown; otherwise, <c>false</c>.</value>
public bool unknown { get; set; } = false;
/// <summary>
/// The confidence placed in this result
/// </summary>
/// <value>The weight.</value>
public double weight { get; set; } = 1.0;
/// <summary>
/// The array containing the up to 4 values representing the fuzzy number.
/// </summary>
/// <value>The values.</value>
/// <remarks>Since all fuzzy numbers used by DARL are convex,
/// i.e., their envelope doesn't have any in-folding
/// sections, the user can specify numbers with a simple sequence of doubles.
/// So 1 double represents a crisp or singleton value.
/// 2 doubles represent an interval,
/// 3 a triangular fuzzy set,
/// 4 a trapezoidal fuzzy set.
/// The values must be ordered in ascending value,
/// but it is permissible for two or more to hold the same value.</remarks>
public List<double> values { get; set; }
/// <summary>
/// list of categories, each indexed against a truth value.
/// </summary>
/// <value>The categories.</value>
public Dictionary<string, double> categories { get; set; }
public List<DateTime> times { get; set; }
/// <summary>
/// Indicates approximation has taken place in calculating the values.
/// </summary>
/// <value><c>true</c> if approximate; otherwise, <c>false</c>.</value>
/// <remarks>Under some circumstances the coordinates of the fuzzy number
/// in "values" may not exactly represent the "cuts" values.</remarks>
public bool approximate { get; set; }
/// <summary>
/// Gets or sets the type of the data.
/// </summary>
/// <value>The type of the data.</value>
public DataType dataType { get; set; }
/// <summary>
/// Gets or sets the sequence.
/// </summary>
/// <value>The sequence.</value>
public List<List<string>> sequence { get; set; }
/// <summary>
/// Single central or most confident value, expressed as a string.
/// </summary>
/// <value>The value.</value>
public string Value { get; set; } = string.Empty;
}
C#代码(The C# Code)
控制台应用程序的目的是读取历史数据,以正确的格式将其与DARL代码一起发送到REST服务,并获取生成的模拟数据并将其输出.(The purpose of the console app is to read the historical data, put it into the right format, send it to the REST service along with the DARL code, and to take the generated simulation data and output it.)
历史数据为CSV格式,因此我们最好以相同的方式输出.对于CSV处理,我们将使用(The historical data is in CSV format, so we may as well output it the same way. For CSV handling, we’ll use the) CsvHelper
NuGet软件包.(NuGet package.)
var initial_balance = "10000";
//get the data and ruleset from the exe
var ddata = new DaslData();
var csv = new CsvReader(new StreamReader
(Assembly.GetExecutingAssembly().GetManifestResourceStream("DaslTradingExample.GBP_USD.csv")));
var records = csv.GetRecords<TradingRecord>().ToList();
ddata.code = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream
("DaslTradingExample.trading_simulation.darl")).ReadToEnd();
//convert the csv records to a DaslSet.
ddata.history = new DaslSet();
ddata.history.sampleTime = new TimeSpan(1, 0, 0, 0); // 1 day
ddata.history.events = new List<DaslState>();
foreach (var r in records)
{
if (r == records.Last()) //records are in reverse order,
//set the initial value of the balance and add the first price
ddata.history.events.Add(new DaslState { timeStamp = DateTime.Parse(r.Date),
values = new List<DarlVar> { new DarlVar { name = "price",
Value = r.Price, dataType = DarlVar.DataType.numeric },
new DarlVar { name = "balance",
dataType = DarlVar.DataType.numeric, Value = initial_balance } } });
else // add the day's price
ddata.history.events.Add(new DaslState { timeStamp = DateTime.Parse(r.Date),
values = new List<DarlVar> { new DarlVar { name = "price",
Value = r.Price, dataType = DarlVar.DataType.numeric } } });
}
代码的第一部分读取嵌入的历史数据和规则集.(The first part of the code reads the embedded historical data and ruleset.)
然后,我们创建一个(We then create a) DaslData
分类并填充代码和历史记录部分.(class and populate the code and the history sections.)
请注意,历史数据中的记录是相反的顺序,因此我们将初始余额作为数据项添加到它们的最后一个.活动可以任何顺序呈现. DASL运行时的时态数据库将使它们有意义.(Note that the records in the historical data are in reverse order, so we add the initial balance as a data item to the last of them. Events can be presented in any order. The DASL runtime’s temporal database will make sense of them.)
//send the data off to the simulator
var valueString = JsonConvert.SerializeObject(ddata);
var client = new HttpClient();
var response = await client.PostAsync("https://darl.ai/api/Linter/DaslSimulate",
new StringContent(valueString, Encoding.UTF8, "application/json"));
var resp = await response.Content.ReadAsStringAsync();
var returnedData = JsonConvert.DeserializeObject<DaslSet>(resp);
接下来,我们发送(Next, we send of the) DaslSet
指向位于以下位置的免费REST接口(object to the free REST interface at) darl.ai
.(.)
//now write out the results as a csv file
var outlist = new List<OutputRecord>();
foreach(var d in returnedData.events)
{
var sterling = d.values.Where(a => a.name == "sterling").First();
var ave3 = d.values.Where(a => a.name == "tradingrules.average3").First();
var ave9 = d.values.Where(a => a.name == "tradingrules.average9").First();
var price = d.values.Where(a => a.name == "price").First();
var newbalance = d.values.Where(a => a.name == "newbalance").First();
outlist.Add(new OutputRecord {
price = price.values[0],
date = d.timeStamp,
sterling = sterling.unknown ? 0.0 : sterling.values[0],
ave3 = ave3.unknown ? 0.0 : ave3.values[0],
ave9 = ave9.unknown ? 0.0 : ave9.values[0],
newbalance = newbalance.unknown ? 0.0 : newbalance.values[0],
trade = d.values.Where(a => a.name == "trade").First().Value,
transact = d.values.Where(a => a.name == "tradingsim.transact").First().Value
});
}
var csvout = new CsvWriter(new StreamWriter("results.csv"));
csvout.WriteRecords(outlist);
最后,我们将所有模拟数据写到CSV文件中.(Finally, we write out all the simulated data to a CSV file.)
date,price,trade,sterling,ave3,ave9,transact,newbalance
30/06/2016 00:00:00,1.3311,,10000,0,0,false,10000
01/07/2016 00:00:00,1.3262,,10000,0,0,false,10000
04/07/2016 00:00:00,1.329,,10000,1.32876666666667,0,false,10000
05/07/2016 00:00:00,1.3023,,10000,1.31916666666667,0,false,10000
06/07/2016 00:00:00,1.2931,,10000,1.30813333333333,0,false,10000
07/07/2016 00:00:00,1.291,,10000,1.29546666666667,0,false,10000
08/07/2016 00:00:00,1.2956,,10000,1.29323333333333,0,false,10000
11/07/2016 00:00:00,1.2994,,10000,1.29533333333333,0,false,10000
12/07/2016 00:00:00,1.3243,short,9982.44884089708,1.30643333333333,1.31022222222222,true,13219.757
13/07/2016 00:00:00,1.3147,long,10037.6985635023,1.3128,1.3084,true,10037.6985635023
14/07/2016 00:00:00,1.3342,long,10037.6985635023,1.3244,1.30928888888889,false,10037.6985635023
15/07/2016 00:00:00,1.3193,long,10037.6985635023,1.32273333333333,
1.30821111111111,false,10037.6985635023
注意输出(Note that the output) DaslSet
包含模拟中每个可用步骤(即处于已知状态)的模拟中所有数据项.您可以使用来访问规则集值(contains all the data items in the simulation that are available, i.e., in a known state, for each step of the simulation. You can access ruleset values using the) <ruleset>.<ioname>
命名约定.(naming convention.)
这就是交易系统的性能.(This is the performance of the trading system.)
您可以尝试的事物(Things You Can Experiment With)
您可以轻松更改源数据.历史数据可从Yahoo Finance等网站免费获得.交易算法基于两个移动均线的选择.如果要选择其他选项(例如4和17),则需要添加更多的延迟和输入并更改计算平均值的darl.(You can easily change the source data. Historical data is freely available from sites like Yahoo finance. The trading algorithm is based round the choice of two moving averages. If you want a different selection, like 4 and 17, you would need to add more delays and inputs and change the darl that calculated the averages.)
未来的工作(Future Work)
我创建了这个示例,并将darl分为两个规则集,以创建可以与Genetic Programming一起使用的应用程序.这是一种可以优化系统元素的机器学习形式.这在处理能力上非常昂贵,所以我不会提供免费版本!但是,模糊规则非常适合GP,请参阅此(I created this example and split the darl into two rulesets in order to create an application I could use with Genetic Programming. This is a form of Machine learning that can optimise an element of a system. It is extremely expensive in processing power, so I shan’t be providing a free version! However, fuzzy rules are uniquely suited to GP, see this) 现在很旧的纸(now very old paper) .这个想法是GP会修改(. The idea is that GP would modify the) TradingRules
规则集,最初会播种大量随机生成的规则,并使用模拟演变对其进行改进.(ruleset, initially seeding a large number of randomly generated rules and improving them using simulated evolution.)
注意下一篇文章.(Watch out for the next article.)
历史(History)
- 07/05/2018:初始版本(07/05/2018: Initial version)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C# Dev CEO fuzzy AI 新闻 翻译