From c1df1b3d570b6abee3fd36cd126c105c7048153b Mon Sep 17 00:00:00 2001 From: tz5514 Date: Sun, 8 Oct 2017 11:02:08 +0800 Subject: [PATCH 1/2] gm11 --- gm11.js | 11 +++++++++++ gm11.py | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 gm11.js create mode 100644 gm11.py diff --git a/gm11.js b/gm11.js new file mode 100644 index 0000000..06a91b9 --- /dev/null +++ b/gm11.js @@ -0,0 +1,11 @@ +const util = require('util'); +const exec = util.promisify(require('child_process').exec); + +async function gm11() { + const inputs = [223.3, 227.3, 230.5, 238.1]; + const { stdout } = await exec(`python gm11.py ${JSON.stringify(inputs)}`); + const result = stdout.match(/Forcated next moment value is (\S+)/)[1]; + console.log(result); +} + +gm11(); \ No newline at end of file diff --git a/gm11.py b/gm11.py new file mode 100644 index 0000000..4232f0e --- /dev/null +++ b/gm11.py @@ -0,0 +1,21 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +import sys +import json +from grey_theory import GreyTheory + +# GM11 +gm11 = GreyTheory().gm11 +gm11.alpha = 0.5 +gm11.convolution = True +gm11.stride = 1 +gm11.length = 4 + +numbers = json.loads(sys.argv[1]) +print numbers + +for (i, num) in enumerate(numbers): + gm11.add_pattern(num, str(i)) + +gm11.forecast() +gm11.print_forecasted_results() \ No newline at end of file From 83f6647dfb79cc7a39be85f8c3aed0926a99a6bb Mon Sep 17 00:00:00 2001 From: tz5514 Date: Sat, 14 Oct 2017 16:17:17 +0800 Subject: [PATCH 2/2] remove js file --- gm11.js | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 gm11.js diff --git a/gm11.js b/gm11.js deleted file mode 100644 index 06a91b9..0000000 --- a/gm11.js +++ /dev/null @@ -1,11 +0,0 @@ -const util = require('util'); -const exec = util.promisify(require('child_process').exec); - -async function gm11() { - const inputs = [223.3, 227.3, 230.5, 238.1]; - const { stdout } = await exec(`python gm11.py ${JSON.stringify(inputs)}`); - const result = stdout.match(/Forcated next moment value is (\S+)/)[1]; - console.log(result); -} - -gm11(); \ No newline at end of file