帮酷LOGO
  • 显示原文与译文双语对照的内容
文章标签:spark  GEO  inference-engine  Gemfire  Inference  GEM  Spring  INF  
Stock inference engine using Spring XD, Apache Geode / GemFire and Spark ML Lib.

  • 源代码名称:StockInference-Spark
  • 源代码网址:http://www.github.com/Pivotal-Open-Source-Hub/StockInference-Spark
  • StockInference-Spark源代码文档
  • StockInference-Spark源代码下载
  • Git URL:
    git://www.github.com/Pivotal-Open-Source-Hub/StockInference-Spark.git
  • Git Clone代码到本地:
    git clone http://www.github.com/Pivotal-Open-Source-Hub/StockInference-Spark
  • Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/Pivotal-Open-Source-Hub/StockInference-Spark
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
  • 基于机器学习的实时股票预测

    Architecture

    摘要

    使用 spring XD 。Apache geode/gemfire和 Spark ML库的股票推理引擎。

    要求

    PS: 如果你被提供给这里实验室的预先打包的xmlwebservices,你将只需要:

    如果你希望自己创建演示虚拟机,那么这里的指令是

    每个产品的第一步

    如果你不熟悉 geode/gemfire,spring XD,Spark ML和Apache飞艇,请先遵循以下特定的产品实验室:

    启动演示环境

    如果你已经收到预先构建的虚拟机,请启动虚拟机并使用ssh访问它的控制台,如下所示:

    $ vagrant up
    Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Box 'package.box' could not be found. Attempting to find and install...
     default: Box Provider: virtualbox
     default: Box Version:> = 0
    ==> default: Adding box 'package.box' (v0) for provider: virtualbox
     default: Downloading: file:///Users/fmelo/qcon/package.box
    ==> default: Successfully added box 'package.box' (v0) for 'virtualbox'!
    (...)
     default: Running: inline script
    ==> default: stdin: is not a tty
    ==> default: QCon Rio 2015 - Pivotal Lab
    $ vagrant ssh
    Welcome to Ubuntu 15.04 (GNU/Linux 3.19.0-23-generic x86_64)
     * Documentation: https://help.ubuntu.com/
     System information as of Mon Aug 24 01:13:06 UTC 2015
     System load: 0.0 Processes: 96
     Usage of/: 17.6% of 38.81GB Users logged in: 0
     Memory usage: 2% IP address for eth0: 10.0.2.15
     Swap usage: 0% IP address for eth1: 192.168.56.10
     Graph this data and manage this system at:
     https://landscape.canonical.com/
     Get cloud support with Ubuntu Advantage Cloud Guest:
     http://www.ubuntu.com/business/services/cloud
    47 packages can be updated.
    27 updates are security updates.
    Last login: Sun Aug 23 23:16:30 2015 from 10.0.2.2
    _____________________________________________________________________________
    Lab variables:
    GEODE_HOME=/home/vagrant/incubator-geode/gemfire-assembly/build/install/apache-geode
    SPRINGXD_HOME=/home/vagrant/spring-xd-2.0.0.BUILD-SNAPSHOT
    ZEPPELIN_HOME=/home/vagrant/incubator-zeppelin
    SPARK_HOME=/home/vagrant/spark-1.3.1-bin-hadoop2.6
    PROJECT=/home/vagrant/project/StockInference-Spark
    _____________________________________________________________________________
    [vagrant@stocks-vm, load: 0.00] (Mon Aug 24 - 01:13:10)
    ~ $

    如果不使用预先构建的VM,只需创建指向 geode/gemfire服务器和 spring XD ("XD服务器") 服务器位置的主机条目。 例如配置演示以运行我的主机上的所有服务器:

    $ more/etc/hosts
    ##
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the system is booting. Do not change this entry.
    ##
    127.0.0.1 localhost geode-server xd-server
    255.255.255.255 broadcasthost
    ::1 localhost

    如果使用虚拟机,请修改/etc/hosts 文件以将服务器名称与虚拟机提供的外部IP相关联。 它将是以 192.168. x. x 开头的地址

    $ ifconfig
    eth0 Link encap:Ethernet HWaddr 08:00:27:6a:32:e8
     inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
     UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
     RX packets:29266 errors:0 dropped:0 overruns:0 frame:0
     TX packets:25649 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:1000
     RX bytes:10570362 (10.5 MB) TX bytes:2911832 (2.9 MB)
    eth1 Link encap:Ethernet HWaddr 08:00:27:ae:57:0d
     inet addr:192.168.56.10 Bcast:192.168.56.255 Mask:255.255.255.0
     UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
     RX packets:7339 errors:0 dropped:0 overruns:0 frame:0
     TX packets:9164 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:1000
     RX bytes:585718 (585.7 KB) TX bytes:10272756 (10.2 MB)

    /etc/hosts 文件更改:

    $ more/etc/hosts
    #127.0.0.1 localhost stocks-vm geode-server xd-server
    127.0.0.1 localhost
    192.168.56.10 stocks-vm geode-server xd-server

    另外,如果在虚拟机中运行并且希望使用外部客户端,则需要通过删除绑定地址条目,并将地址改为VM的外部IP来修改该配置。

    $ more ~/project/StockInference-Spark/data/setup.gfsh
    # GemFire/Geode setup
    start locator --name=locator1 --J=-Dgemfire.http-service-port=7575
    start server --name=server1 --J=-Dgemfire.start-dev-rest-api=true --J=-Dgemfire.http-service-port=8888 --hostname-for-cl
    ients=192.168.56.10 --locators=geode-server[10334]
    connect --locator=geode-server[10334]
    create region --name=/Stocks --type=PARTITION
    create region --name=/TechIndicators --type=PARTITION
    create region --name=/Predictions --type=PARTITION
    import data --region=/Stocks --file=../Stocks.gfd --member=server1
    import data --region=/TechIndicators --file=../TechIndicators.gfd --member=server1
    describe region --name=/Stocks
    describe region --name=/TechIndicators
    describe region --name=/Predictions

    你还需要导出GEODE_HOME变量,指向你的安装

    $ export GEODE_HOME=/home/pivotal/apache-geode

    要验证是否有正确的目录,你应该能够通过键入 $GEODE_HOME/bin/gfsh 启动 gfsh

    $ $GEODE_HOME/bin/gfsh
     _________________________ __
    /_____/______/______//____//
    //__//___/_____/_____/
    //__//____/_____/////
    /______/_//______/_//_/v1.0.0-incubating-SNAPSHOT
    Monitor and Manage GemFire
    gfsh>exit
    Exiting...
    $

    创建 geode/gemfire区域

    演示使用三个不同的区域存储数据:

    • (/股票- Stores从 Yahoo Yahoo金融YQL或者使用模拟器( 随机重播以前从同一Yahoo金融YQL中吸取的数据) 存储原始股票交易数据。
    • /TechIndicators - 存储技术指标,将它的用作机器学习模型的输入/特性。 这些指标由 R 脚本计算,它是 involked,由 spring XD 。
    • /预测- 存储预测数据,因为它是由 Spark MLLib模型计算的。

    要创建区域,请在这里项目 root 路径的data 文件夹下执行脚本 startGeode.sh,如下所示:

    $ cd project/StockInference-Spark/data
    $./startGeode.sh
    1. Executing - start locator --name=locator1 --J=-Dgemfire.http-service-port=7575
    ............................................
    Locator in/home/vagrant/project/StockInference-Spark/data/locator1 on 192.168.56.10[10334] as locator1 is currently online.
    Process ID: 4374
    Uptime: 23 seconds
    GemFire Version: 1.0.0-incubating-SNAPSHOT
    Java Version: 1.8.0_51
    Log File:/home/vagrant/project/StockInference-Spark/data/locator1/locator1.log
    JVM Arguments: -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire.http-service-port=7575 -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
    Class-Path:/home/vagrant/incubator-geode/gemfire-assembly/build/install/apache-geode/lib/gemfire-core-1.0.0-incubating-SNAPSHOT.jar:/home/vagrant/incubator-geode/gemfire-assembly/build/install/apache-geode/lib/gemfire-core-dependencies.jar
    Successfully connected to: [host=192.168.56.10, port=1099]
    Cluster configuration service is up and running.
    2. Executing - start server --name=server1 --J=-Dgemfire.start-dev-rest-api=true --J=-Dgemfire.http-service-port=8888
    ..............
    Server in/home/vagrant/project/StockInference-Spark/data/server1 on 192.168.56.10[40404] as server1 is currently online.
    Process ID: 4546
    Uptime: 7 seconds
    GemFire Version: 1.0.0-incubating-SNAPSHOT
    Java Version: 1.8.0_51
    Log File:/home/vagrant/project/StockInference-Spark/data/server1/server1.log
    JVM Arguments: -Dgemfire.default.locators=192.168.56.10[10334] -Dgemfire.use-cluster-configuration=true -Dgemfire.start-dev-rest-api=true -Dgemfire.http-service-port=8888 -XX:OnOutOfMemoryError=kill -KILL %p -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
    Class-Path:/home/vagrant/incubator-geode/gemfire-assembly/build/install/apache-geode/lib/gemfire-core-1.0.0-incubating-SNAPSHOT.jar:/home/vagrant/incubator-geode/gemfire-assembly/build/install/apache-geode/lib/gemfire-core-dependencies.jar
    3. Executing - create region --name=/Stocks --type=PARTITION
    Member | Status
    ------- | -------------------------------------
    server1 | Region"/Stocks" created on"server1"
    4. Executing - create region --name=/TechIndicators --type=PARTITION
    Member | Status
    ------- | ---------------------------------------------
    server1 | Region"/TechIndicators" created on"server1"
    5. Executing - create region --name=/Predictions --type=PARTITION
    Member | Status
    ------- | ------------------------------------------
    server1 | Region"/Predictions" created on"server1"
    6. Executing - import data --region=/Stocks --file=../Stocks.gfd --member=server1
    Data imported from file :/home/vagrant/project/StockInference-Spark/data/Stocks.gfd on host : 192.168.56.10 to region :/Stocks
    7. Executing - import data --region=/TechIndicators --file=../TechIndicators.gfd --member=server1
    Data imported from file :/home/vagrant/project/StockInference-Spark/data/TechIndicators.gfd on host : 192.168.56.10 to region :/TechIndicators
    8. Executing - describe region --name=/Stocks
    ..........................................................
    Name : Stocks
    Data Policy : partition
    Hosting Members : server1
    Non-Default Attributes Shared By Hosting Members
     Type | Name | Value
    ------ | ----------- | ---------
    Region | size | 41540
     | data-policy | PARTITION
    9. Executing - describe region --name=/TechIndicators
    ..........................................................
    Name : TechIndicators
    Data Policy : partition
    Hosting Members : server1
    Non-Default Attributes Shared By Hosting Members
     Type | Name | Value
    ------ | ----------- | ---------
    Region | size | 36486
     | data-policy | PARTITION
    10. Executing - describe region --name=/Predictions
    ..........................................................
    Name : Predictions
    Data Policy : partition
    Hosting Members : server1
    Non-Default Attributes Shared By Hosting Members
     Type | Name | Value
    ------ | ----------- | ---------
    Region | size | 0
     | data-policy | PARTITION

    正如你可以以验证的那样,脚本不仅创建了区域,而且导入了我们先前捕获的一些数据。 我们稍后会继续训练数据。

    接下来,我们应该为Spark连接器部署 geode/gemfire功能:

    ~/project/StockInference-Spark/data $./deployFunctionVM.sh
    (1) Executing - connect
    Connecting to Locator at [host=localhost, port=10334].. 
    Connecting to Manager at [host=192.168.56.10, port=1099].. 
    Successfully connected to: [host=192.168.56.10, port=1099]
    (2) Executing - deploy --jar=/home/vagrant/incubator-geode/gemfire-spark-connector/gemfire-functions/target/scala-2.10/gemfire-functions_2.10-0.5.0.jar
    Member | Deployed JAR | Deployed JAR Location
    ------- | -------------------------------- | ------------------------------------------------------------------------------------------------
    server1 | gemfire-functions_2.10-0.5.0.jar |/home/vagrant/project/StockInference-Spark/data/server1/vf.gf#gemfire-functions_2.10-0.5.0.jar#1

    训练机器学习模型

    在Spark上执行机器学习模型之前,我们需要用现有数据对它的进行训练。 为此,运行脚本 below,该脚本是 Scala 类的。

    在流式文件夹中,运行 train.sh 。 这需要一段时间才能运行。

    ~/project/StockInference-Spark $ cd streaming
    ~/project/StockInference-Spark/streaming $./train.sh
    15/08/24 03:07:41 INFO SparkContext: Running Spark version 1.3.1
    15/08/24 03:07:41 WARN Utils: Your hostname, stocks-vm resolves to a loopback address: 127.0.1.1; using 10.0.2.15 instead (on interface eth0)
    (...)
    15/08/24 03:09:33 INFO DAGScheduler: Stage 2012 (mean at StockInferenceDemo.scala:127) finished in 0.072 s
    15/08/24 03:09:33 INFO DAGScheduler: Job 2012 finished: mean at StockInferenceDemo.scala:127, took 0.084467 s
    training Mean Squared Error = 4.356799628392633E-4
    [info 2015/08/24 03:09:33.493 UTC <Distributed system shutdown hook> tid=0x40] VM is exiting - shutting down distributed system
    [info 2015/08/24 03:09:33.498 UTC <Distributed system shutdown hook> tid=0x40] GemFireCache[id = 1756587746; isClosing = true; isShutDownAll = false; created = Mon Aug 24 03:07:48 UTC 2015; server = false; copyOnRead = false; lockLease = 120; lockTimeout = 60]: Now closing.
    [info 2015/08/24 03:09:33.555 UTC <Distributed system shutdown hook> tid=0x40] Destroying connection pool DEFAULT

    创建 spring XD流

    现在,我们将在SpringXD中创建流,以编排所有数据流。

    让我们先开始 spring XD 。 在 streaming 目录中,运行脚本 startSpringXD.sh 。 这将在 background 中启动服务器,将日志输出到文件 nohup.out

    ~/project/StockInference-Spark/streaming $./startSpringXD.sh
    Starting...
    nohup: appending output to 'nohup.out'

    接下来,看看文件 stream-create.xd,其中包含我们将在 spring XD上创建的流。 请记住体系结构映像

    ~/project/StockInference-Spark/streaming $ more stream-create.xd
    admin config server http://localhost:9393
    stream create process_sink --definition"queue:stocks> transform --script='file:./transform.groovy' | object-to-json | gemfire-json-server --useLocator=true --host=localhost --port
    =10334 --regionName=Stocks --keyExpression=payload.getField('entryTimestamp')" --deploy
    stream create yahoo_finance_source --definition"trigger --cron='* * 7-13 * * MON-FRI' | http-client --url='''https://query.yahooapis.com/v1/public/yql?q=select Symbol, LastTradeDate
    , LastTradeTime, LastTradePriceOnly, DaysHigh, DaysLow, Open from yahoo.finance.quotes where symbol in ("TSLA")&format=json&env=store://datatables.org/alltableswithkeys''' --httpMe
    thod=GET | splitter --expression=#jsonPath(payload,'$.query.results.quote')> queue:stocks" --deploy
    stream create http_source --definition"http --port=9000 | splitter --expression=#jsonPath(payload,'$')> queue:stocks" --deploy
    stream create --name r_process --definition"tap:stream:process_sink.transform> r-parsing: object-to-json | shell --command='Rscript./tech_indicators.R' | formatting: splitter --ex
    pression=#jsonPath(payload,'$') | filter --expression=#jsonPath(payload,'$.rsi').indexOf('NaN')==-1 | object-to-json | gemfire-json-server --useLocator=true --host=locator --port=103
    34 --regionName=TechIndicators --keyExpression=payload.getField('entryTimestamp')" --deploy
    stream create --name prediction --definition"tap:stream:r_process.object-to-json> shell --command='../evaluate.sh' | gemfire-json-server --regionName=Predictions --host=localhost -
    -port=10334 --useLocator=true --keyExpression=payload.getField('entryTimestamp')" --deploy
    # stream create --name training --definition"trigger --fixedDelay=300 | shell --command='../train.sh'" --deploy

    请注意 yahoo_finance_source 流有一个基于PDT时区( 7 -13星期五= 正常华尔街操作时间)的。 如果你的环境设置了另一个时区,则需要相应地调整它。

    执行脚本 stream-create.sh 以将所有流部署到 spring XD:

    ~/project/StockInference-Spark/streaming $./stream-create.sh
    Aug 24, 2015 3:19:48 AM org.springframework.shell.core.AbstractShell handleExecutionResult
    INFO: Successfully targeted http://localhost:9393
    Aug 24, 2015 3:19:53 AM org.springframework.shell.core.AbstractShell handleExecutionResult
    INFO: Created and deployed new stream 'process_sink'
    Aug 24, 2015 3:19:54 AM org.springframework.shell.core.AbstractShell handleExecutionResult
    INFO: Created and deployed new stream 'yahoo_finance_source'
    Aug 24, 2015 3:19:55 AM org.springframework.shell.core.AbstractShell handleExecutionResult
    INFO: Created and deployed new stream 'http_source'
    Aug 24, 2015 3:20:05 AM org.springframework.shell.core.AbstractShell handleExecutionResult
    INFO: Created and deployed new stream 'r_process'
    Aug 24, 2015 3:20:08 AM org.springframework.shell.core.AbstractShell handleExecutionResult
    INFO: Created and deployed new stream 'prediction'

    现在,spring 已经经在查询雅虎的最新引号( 在正常的市场时间),并且在端口 9000中收听可以能的引号。

    使用模拟器

    当你不在美国股市开放时,我们可以使用模拟器随机重播在 geode/gemfire上存储的一些旧报价。 由于顺序是随机的,我们可以期望更高的波动性。

    FinanceStreamSimulator 文件夹启动模拟器:

    ~/project/StockInference-Spark/FinanceStreamSimulator $./startSimulator.sh
    :compileJava UP-TO-DATE
    :processResources UP-TO-DATE
    :classes UP-TO-DATE
    :findMainClass
    :run
    /$$$$$$$$/$$/$$$$$$/$$/$$$$$$/$$/$$/$$
    | $$_____/|__//$$__ $$ | $$/$$__ $$|__/| $$ | $$
    | $$/$$/$$$$$$$ | $$ __//$$$$$$/$$$$$$ | $$ __//$$/$$$$$$/$$$$/$$/$$| $$/$$$$$$/$$$$$$/$$$$$$/$$$$$$
    | $$$$$ | $$| $$__ $$| $$$$$$|_ $$_//$$__ $$ | $$$$$$ | $$| $$_ $$_ $$| $$ | $$| $$ |____ $$|_ $$_//$$__ $$/$$__ $$
    | $$__/| $$| $$ $$ ____ $$ | $$ | $$ __/____ $$| $$| $$ $$ $$| $$ | $$| $$/$$$$$$$ | $$ | $$ $$| $$ __/
    | $$ | $$| $$ | $$/$$ $$ | $$/$$| $$/$$ $$| $$| $$ | $$ | $$| $$ | $$| $$/$$__ $$ | $$/$$| $$ | $$| $$
    | $$ | $$| $$ | $$| $$$$$$/| $$$$/| $$ | $$$$$$/| $$| $$ | $$ | $$| $$$$$$/| $$| $$$$$$$ | $$$$/| $$$$$$/| $$
    |__/|__/|__/|__/______/___/|__/______/|__/|__/|__/|__/______/|__/_______/___/______/|__/
    Finance Stream Simulator
    Usage: java -jar FinanceStreamSimulator.jar [--serverUrl=<URL>] [--numberOfMessages=<messages>] [--basePrice=<price>] [--scale=<scale>]
    2015-08-24 04:16:38.055 INFO 9954 --- [ main] io.pivotal.demo.SimulatorApp : Starting SimulatorApp on stocks-vm with PID 9954 (/home/vagrant/project/StockInference-Spark/FinanceStreamSimulator/build/classes/main started by vagrant in/home/vagrant/project/StockInference-Spark/FinanceStreamSimulator)
    2015-08-24 04:16:38.096 INFO 9954 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@51e2adc7: startup date [Mon Aug 24 04:16:38 UTC 2015]; root of context hierarchy
    2015-08-24 04:16:38.847 INFO 9954 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
    2015-08-24 04:16:38.852 INFO 9954 --- [ main] io.pivotal.demo.ReplaySimulator : --------------------------------------
    2015-08-24 04:16:38.853 INFO 9954 --- [ main] io.pivotal.demo.ReplaySimulator :>> > Geode rest endpoint: http://localhost:8888
    2015-08-24 04:16:38.853 INFO 9954 --- [ main] io.pivotal.demo.ReplaySimulator :>> > Endpoint URL: http://localhost:9000
    2015-08-24 04:16:38.853 INFO 9954 --- [ main] io.pivotal.demo.ReplaySimulator :>> > Number of messages: 500
    2015-08-24 04:16:38.854 INFO 9954 --- [ main] io.pivotal.demo.ReplaySimulator :>> > Symbol: TSLA
    2015-08-24 04:16:38.854 INFO 9954 --- [ main] io.pivotal.demo.ReplaySimulator : --------------------------------------
    2015-08-24 04:16:39.240 INFO 9954 --- [ main] io.pivotal.demo.ReplaySimulator :>> > Posting 500 messages 2015-08-24 04:21:20.768 INFO 10187 --- [ main] io.pivotal.demo.ReplaySimulator : done
    2015-08-24 04:21:20.769 INFO 10187 --- [ main] io.pivotal.demo.SimulatorApp : Started SimulatorApp in 154.355 seconds (JVM running for 154.685)
    2015-08-24 04:21:20.772 INFO 10187 --- [ Thread-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@51e2adc7: startup date [Mon Aug 24 04:18:46 UTC 2015]; root of context hierarchy
    2015-08-24 04:21:20.773 INFO 10187 --- [ Thread-1] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
    BUILD SUCCESSFUL
    Total time: 2 mins 38.003 secs

    验证计算的预测

    使用GFSH连接到 geode/gemfire并验证预测区域:

    $ gfsh
     _________________________ __
    /_____/______/______//____//
    //__//___/_____/_____/
    //__//____/_____/////
    /______/_//______/_//_/v1.0.0-incubating-SNAPSHOT
    Monitor and Manage GemFire
    gfsh> connect --locator=192.168.56.10[10334]
    Connecting to Locator at [host=192.168.56.10, port=10334].. 
    Connecting to Manager at [host=192.168.56.10, port=1099].. 
    Successfully connected to: [host=192.168.56.10, port=1099]
    gfsh>describe region --name=/Predictions
    ..........................................................
    Name : Predictions
    Data Policy : partition
    Hosting Members : server1
    Non-Default Attributes Shared By Hosting Members
     Type | Name | Value
    ------ | ----------- | ---------
    Region | size | 500
     | data-policy | PARTITION

    如果值显示为 0,则创建流时出现问题。 修复:发出destory并创建以重新创建流。

    ~/project/StockInference-Spark/streaming $./stream-destroy.sh
    ~/project/StockInference-Spark/streaming $./stream-create.sh

    现在检查一些数据:

    gfsh>query --query="select entryTimestamp, ema, predicted from/Predictions order by entryTimestamp desc"
    Result : true
    startCount : 0
    endCount : 20
    Rows : 548
    entryTimestamp | ema | predicted
    -------------- | ---------------- | ------------------
    13353015247329 | 243.655200392179 | 244.36126012453593
    13352705066802 | 243.304022701552 | 244.4679070450193
    13352402037135 | 242.724916646386 | 243.45581253816388
    13352098169940 | 242.36154257993 | 243.70099081921597
    13351795573541 | 241.695218711637 | 238.62424186981085
    13351492002111 | 243.225267310611 | 244.00046225381527
    13351189015085 | 242.839771151012 | 242.8768374516088
    13350884494287 | 242.82194251399 | 240.2610870520309
    13350573308646 | 244.09792973193 | 246.75466201448913
    13350268197871 | 242.775025233505 | 240.11608047958853
    13349964892135 | 244.100586370887 | 244.7387182131781
    13349658440285 | 243.782938889622 | 243.34998938877558
    13349354287691 | 243.999147524282 | 243.42056117407438
    13349043851852 | 244.287846987753 | 245.56848677338888
    13348734159759 | 243.650035229633 | 243.8471030722387
    13348413390251 | 243.552265288641 | 244.84555218518653
    13348104692176 | 242.908324243737 | 244.77470961584862
    13347800579225 | 241.979062973214 | 238.83273528756686
    13347496878110 | 243.547743641872 | 243.66095598690484
    13347193662872 | 243.491708904 | 242.94782444029957
    13346886510828 | 243.763199762867 | 243.0980329260479
    (...)

    你可以通过比较 ema和预测的列来检查预测值的准确性

    额外的:使用GUI实时检查预测

    如果你使用的是提供的VM,你需要在本地环境中克隆这个存储库,使用Java富 UI 。

    JavaFXClient 目录中,编辑文件 src/main/resources/client.xml 以指向 gemfire/geode本机客户端到你正在运行服务器的位置。 如果你正在使用提供的VM,则应该是 VM IP ( 192.168.56.10 ) 。 否则,如果你正在运行它,只需使用本地。

    JavaFXClient $ more src/main/resources/client.xml
    <?xml version="1.0"?>
    <!DOCTYPE client-cache PUBLIC
    "-//GemStone Systems, Inc.//GemFire Declarative Caching 8.0//EN"
    "http://www.gemstone.com/dtd/cache8_0.dtd">
    <client-cache>
     <pool name="client" subscription-enabled="true">
     <locator host="192.168.56.10" port="10334"/> <!-- CHANGE THE IP ON THIS LINE TO POINT TO GEODE/GEMFIRE -->
     </pool>
     <region name="Stocks">
     <region-attributes refid="PROXY">
     <cache-listener>
     <class-name>io.pivotal.demo.StockListener</class-name>
     </cache-listener>
     </region-attributes>
     </region>
     <region name="Predictions">
     <region-attributes refid="PROXY">
     <cache-listener>
     <class-name>io.pivotal.demo.PredictionListener</class-name>
     </cache-listener>
     </region-attributes>
     </region>
    </client-cache>

    启动 GUI:

    JavaFXClient $./gradlew run
    :compileJava UP-TO-DATE
    :processResources UP-TO-DATE
    :classes UP-TO-DATE
    :runfx
    (...)

    这应该会打开基于Java的UI 。 现在再次运行模拟器,并实时观察预测值和实际值 !

    GUI



    文章标签:INF  spa  Apache  GEO  GEM  Spring  spark  Inference  

    Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语