OSDN Git Service

comit latest2 master
authorshuepluter <shupeluter@hotmail.com>
Sun, 30 Dec 2018 10:29:32 +0000 (19:29 +0900)
committershuepluter <shupeluter@hotmail.com>
Sun, 30 Dec 2018 10:29:32 +0000 (19:29 +0900)
14 files changed:
setup.py [new file with mode: 0644]
src/main/Python/Learning.py
src/main/Python/Predictor.py [new file with mode: 0644]
src/main/Python/__pycache__/Data.cpython-36.pyc
src/main/Python/__pycache__/DataReader.cpython-36.pyc
src/main/Python/__pycache__/Exceptions.cpython-36.pyc [new file with mode: 0644]
src/main/Python/data.yml [new file with mode: 0644]
src/main/Python/foo.py
src/main/Python/param.hdf5 [new file with mode: 0644]
src/main/Python/ultreron.egg-info/PKG-INFO [new file with mode: 0644]
src/main/Python/ultreron.egg-info/SOURCES.txt [new file with mode: 0644]
src/main/Python/ultreron.egg-info/dependency_links.txt [new file with mode: 0644]
src/main/Python/ultreron.egg-info/top_level.txt [new file with mode: 0644]
src/main/resources/swagger .yaml [new file with mode: 0644]

diff --git a/setup.py b/setup.py
new file mode 100644 (file)
index 0000000..5db7c8f
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,13 @@
+from setuptools import setup
+
+setup(
+    name='ultreron',
+    version='0.0.1',
+    packages=[''],
+    package_dir={'': 'src/main/Python'},
+    url='',
+    license='',
+    author='Saitoh Yosihiro',
+    author_email='shupeluter@hotmail.com',
+    description=''
+)
index d203e5e..0975e0b 100644 (file)
@@ -6,8 +6,18 @@ from keras.utils.np_utils import to_categorical
 from keras.models import Model
 from keras.models import model_from_yaml
 from keras.layers import Dense, Input, Dropout
-import yaml
-import os.path
+
+
+class ModelGenerator:
+    """
+    学習モデルを生成するクラス。主に以下の処理を実施する。
+        1. 指定ディレクトリ配下に配置されてる学習データから、テストデータ、訓練データを作成する。
+        2. 訓練データを用いてモデルの重みを生成
+        3. モデルの定義および重みづけデータを外部ファイルに出力
+        4. 外部ファイルに定義されたモデルデータをよび重みづけデータをもとに学習モデルを再現
+
+    """
+
 
 def generate_data():
 
@@ -69,7 +79,6 @@ def generate_leaning_model():
 
 def regenerate_leaning_model(model_path='data.yml', param_path='param.hdf5'):
 
-
     with open(model_path) as model_yaml_file:
         model_yaml = model_yaml_file.read()
 
diff --git a/src/main/Python/Predictor.py b/src/main/Python/Predictor.py
new file mode 100644 (file)
index 0000000..953b2bc
--- /dev/null
@@ -0,0 +1,31 @@
+from keras.models import Model
+from Learning import ModelGenerator
+import Learning
+import numpy
+
+
+def predict(target: str):
+    """
+    与えられたパターン(50 x 10)を使い、連続期間を判定する。
+    :param target:
+    :return:
+    """
+    # データ分割
+    target = target.split(",")
+
+    # データサイズ確認
+    if(500 != len(target)):
+        # 例外をスロー
+        print("Unsuported Process. yet")
+
+    # データ変換
+    target = numpy.array(target, dtype=numpy.float32)
+    target = target.reshape(1, 500).astype(float)
+    model = Learning.regenerate_leaning_model() #type: Model
+    result = model.predict(target,batch_size=1).astype(float)
+
+    # 結果をログ出力(debug)
+    numpy.set_printoptions(precision=3, suppress=True)
+    return result
+
+
index 813ff91..c1a2b08 100644 (file)
Binary files a/src/main/Python/__pycache__/Data.cpython-36.pyc and b/src/main/Python/__pycache__/Data.cpython-36.pyc differ
index a3dee3d..d892add 100644 (file)
Binary files a/src/main/Python/__pycache__/DataReader.cpython-36.pyc and b/src/main/Python/__pycache__/DataReader.cpython-36.pyc differ
diff --git a/src/main/Python/__pycache__/Exceptions.cpython-36.pyc b/src/main/Python/__pycache__/Exceptions.cpython-36.pyc
new file mode 100644 (file)
index 0000000..b679a4c
Binary files /dev/null and b/src/main/Python/__pycache__/Exceptions.cpython-36.pyc differ
diff --git a/src/main/Python/data.yml b/src/main/Python/data.yml
new file mode 100644 (file)
index 0000000..ab90ae1
--- /dev/null
@@ -0,0 +1,106 @@
+backend: tensorflow
+class_name: Model
+config:
+  input_layers:
+  - [input_1, 0, 0]
+  layers:
+  - class_name: InputLayer
+    config:
+      batch_input_shape: !!python/tuple [null, 500]
+      dtype: float32
+      name: input_1
+      sparse: false
+    inbound_nodes: []
+    name: input_1
+  - class_name: Dense
+    config:
+      activation: relu
+      activity_regularizer: null
+      bias_constraint: null
+      bias_initializer:
+        class_name: Zeros
+        config: {}
+      bias_regularizer: null
+      kernel_constraint: null
+      kernel_initializer:
+        class_name: VarianceScaling
+        config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
+      kernel_regularizer: null
+      name: dense_1
+      trainable: true
+      units: 200
+      use_bias: true
+    inbound_nodes:
+    - - - input_1
+        - 0
+        - 0
+        - {}
+    name: dense_1
+  - class_name: Dropout
+    config: {name: dropout_1, noise_shape: null, rate: 0.5, seed: null, trainable: true}
+    inbound_nodes:
+    - - - dense_1
+        - 0
+        - 0
+        - {}
+    name: dropout_1
+  - class_name: Dense
+    config:
+      activation: relu
+      activity_regularizer: null
+      bias_constraint: null
+      bias_initializer:
+        class_name: Zeros
+        config: {}
+      bias_regularizer: null
+      kernel_constraint: null
+      kernel_initializer:
+        class_name: VarianceScaling
+        config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
+      kernel_regularizer: null
+      name: dense_2
+      trainable: true
+      units: 100
+      use_bias: true
+    inbound_nodes:
+    - - - dropout_1
+        - 0
+        - 0
+        - {}
+    name: dense_2
+  - class_name: Dropout
+    config: {name: dropout_2, noise_shape: null, rate: 0.5, seed: null, trainable: true}
+    inbound_nodes:
+    - - - dense_2
+        - 0
+        - 0
+        - {}
+    name: dropout_2
+  - class_name: Dense
+    config:
+      activation: softmax
+      activity_regularizer: null
+      bias_constraint: null
+      bias_initializer:
+        class_name: Zeros
+        config: {}
+      bias_regularizer: null
+      kernel_constraint: null
+      kernel_initializer:
+        class_name: VarianceScaling
+        config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
+      kernel_regularizer: null
+      name: dense_3
+      trainable: true
+      units: 11
+      use_bias: true
+    inbound_nodes:
+    - - - dropout_2
+        - 0
+        - 0
+        - {}
+    name: dense_3
+  name: model_1
+  output_layers:
+  - [dense_3, 0, 0]
+keras_version: 2.1.6
index d48abb6..543e9c8 100644 (file)
@@ -1,6 +1,5 @@
 from keras.datasets import mnist
 from keras.layers import Dense,Input,Dropout
-from keras.models import Model
 import keras
 
 
diff --git a/src/main/Python/param.hdf5 b/src/main/Python/param.hdf5
new file mode 100644 (file)
index 0000000..3e7fc18
Binary files /dev/null and b/src/main/Python/param.hdf5 differ
diff --git a/src/main/Python/ultreron.egg-info/PKG-INFO b/src/main/Python/ultreron.egg-info/PKG-INFO
new file mode 100644 (file)
index 0000000..acd59d6
--- /dev/null
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: ultreron
+Version: 0.0.1
+Summary: UNKNOWN
+Home-page: UNKNOWN
+Author: Saitoh Yosihiro
+Author-email: shupeluter@hotmail.com
+License: UNKNOWN
+Description: UNKNOWN
+Platform: UNKNOWN
diff --git a/src/main/Python/ultreron.egg-info/SOURCES.txt b/src/main/Python/ultreron.egg-info/SOURCES.txt
new file mode 100644 (file)
index 0000000..2c2445b
--- /dev/null
@@ -0,0 +1,16 @@
+setup.py
+src/main/Python/ultreron.egg-info/PKG-INFO
+src/main/Python/ultreron.egg-info/SOURCES.txt
+src/main/Python/ultreron.egg-info/dependency_links.txt
+src/main/Python/ultreron.egg-info/top_level.txt
+src/main/Python/Data.py
+src/main/Python/DataReader.py
+src/main/Python/DatasetGenerator.py
+src/main/Python/Exceptions.py
+src/main/Python/Learning.py
+src/main/Python/Predictor.py
+src/main/Python/foo.py
+src/main/Python/ultreron.egg-info/PKG-INFO
+src/main/Python/ultreron.egg-info/SOURCES.txt
+src/main/Python/ultreron.egg-info/dependency_links.txt
+src/main/Python/ultreron.egg-info/top_level.txt
\ No newline at end of file
diff --git a/src/main/Python/ultreron.egg-info/dependency_links.txt b/src/main/Python/ultreron.egg-info/dependency_links.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/src/main/Python/ultreron.egg-info/top_level.txt b/src/main/Python/ultreron.egg-info/top_level.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/src/main/resources/swagger .yaml b/src/main/resources/swagger .yaml
new file mode 100644 (file)
index 0000000..9cfd846
--- /dev/null
@@ -0,0 +1,32 @@
+swagger: "2.0"
+info:
+  description: "連続データ幅を返却する"
+  title: "連続データ取得"
+  version: "1.0.0"
+paths:
+  /sequencewidth:
+    get:
+      summary: "連続幅取得API"
+      parameters: 
+        - name: target_name
+          in: query
+          description: 判定したいデータ 現状サイズ固定(サイズはおって記載)
+          type: string
+        - name: data_model
+          in: query
+          description: 利用するデータモデルを確定させる。現状Not service yet.
+          type: string
+          
+      responses: 
+        200:
+          description: "データ取得成功"
+          schema:
+            type: "object"
+            properties:
+                fulldata:
+                  type: "array"
+                  items:
+                   type: number
+                result:
+                  type: number
+