├── README.md
├── UIprediction.iml
├── out
└── artifacts
│ └── UIprediction
│ ├── UIprediction.html
│ ├── UIprediction.jar
│ ├── UIprediction.jnlp
│ ├── bootstrap-2.3.2.jar
│ ├── commons-codec-1.9.jar
│ ├── data
│ └── test.txt
│ ├── font-awesome-4.1.0.jar
│ ├── images
│ ├── Check.png
│ ├── arrow.png
│ ├── power.png
│ ├── set.png
│ ├── stats.png
│ ├── user.png
│ └── user_login.png
│ ├── jfoenix-8.0.8.jar
│ ├── jquery-1.9.0.jar
│ ├── lombok-1.18.8.jar
│ ├── poi-3.11.jar
│ ├── poi-ooxml-3.11.jar
│ ├── poi-ooxml-schemas-3.11.jar
│ ├── stax-api-1.0.1.jar
│ └── xmlbeans-2.6.0.jar
├── pom.xml
├── src
├── main
│ ├── java
│ │ ├── entity
│ │ │ ├── Data.java
│ │ │ └── Particle.java
│ │ ├── filter
│ │ │ ├── CSharpParticleFilter.java
│ │ │ ├── MyParticleFilter.java
│ │ │ └── ParticleFilter.java
│ │ ├── lstm
│ │ │ ├── AntiNormalization.java
│ │ │ ├── DataRead.java
│ │ │ ├── LSTM.java
│ │ │ ├── LSTMNode.java
│ │ │ ├── LSTMParam.java
│ │ │ ├── LSTMState.java
│ │ │ ├── Main.java
│ │ │ ├── Normalization.java
│ │ │ ├── PiPi.java
│ │ │ ├── Start.java
│ │ │ ├── ToyLossLayer.java
│ │ │ └── _Main.java
│ │ ├── sample
│ │ │ ├── Controller.java
│ │ │ ├── Main.java
│ │ │ └── sample.fxml
│ │ └── utils
│ │ │ └── POI.java
│ └── resources
│ │ ├── data
│ │ └── test.txt
│ │ └── images
│ │ ├── Check.png
│ │ ├── Snipaste_2020-07-15_16-23-39.png
│ │ ├── Snipaste_2020-07-15_16-23-56.png
│ │ ├── Snipaste_2020-07-15_16-41-14.png
│ │ ├── arrow.png
│ │ ├── power.png
│ │ ├── set.png
│ │ ├── stats.png
│ │ ├── user.png
│ │ └── user_login.png
└── test.txt
└── target
└── classes
├── data
└── test.txt
├── entity
├── Data.class
└── Particle.class
├── filter
├── CSharpParticleFilter$1.class
├── CSharpParticleFilter.class
├── MyParticleFilter$1.class
├── MyParticleFilter.class
└── ParticleFilter.class
├── images
├── Check.png
├── arrow.png
├── power.png
├── set.png
├── stats.png
├── user.png
└── user_login.png
├── lstm
├── AntiNormalization.class
├── DataRead.class
├── LSTM.class
├── LSTMNode.class
├── LSTMParam.class
├── LSTMState.class
├── Main.class
├── Normalization.class
├── PiPi.class
├── Start.class
├── ToyLossLayer.class
└── _Main.class
├── sample
├── Controller$Calculate.class
├── Controller.class
├── Main.class
└── sample.fxml
└── utils
└── POI.class
/README.md:
--------------------------------------------------------------------------------
1 | # UIprediction
2 |
3 | * 基于双向堆叠LSTM的电力负荷预测系统。
4 |
5 | 
6 |
7 | ## 双向堆叠LSTM算法参数选择
8 |
9 | 
10 |
11 | ## 预测效果
12 |
13 | 
14 |
--------------------------------------------------------------------------------
/UIprediction.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/UIprediction.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
17 |
36 |
37 |
38 | Test page for UIprediction
39 | Webstart: click to launch this app as webstart
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/UIprediction.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/UIprediction.jar
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/UIprediction.jnlp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | UIprediction
5 | Unknown
6 | UIprediction
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/bootstrap-2.3.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/bootstrap-2.3.2.jar
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/commons-codec-1.9.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/commons-codec-1.9.jar
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/data/test.txt:
--------------------------------------------------------------------------------
1 | 2017.73
2 | 1999.92
3 | 1985.43
4 | 2026.2
5 | 2055.38
6 | 2059.41
7 | 2059.21
8 | 2061.93
9 | 2037.56
10 | 2019.31
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/font-awesome-4.1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/font-awesome-4.1.0.jar
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/images/Check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/images/Check.png
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/images/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/images/arrow.png
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/images/power.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/images/power.png
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/images/set.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/images/set.png
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/images/stats.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/images/stats.png
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/images/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/images/user.png
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/images/user_login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/images/user_login.png
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/jfoenix-8.0.8.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/jfoenix-8.0.8.jar
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/jquery-1.9.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/jquery-1.9.0.jar
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/lombok-1.18.8.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/lombok-1.18.8.jar
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/poi-3.11.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/poi-3.11.jar
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/poi-ooxml-3.11.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/poi-ooxml-3.11.jar
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/poi-ooxml-schemas-3.11.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/poi-ooxml-schemas-3.11.jar
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/stax-api-1.0.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/stax-api-1.0.1.jar
--------------------------------------------------------------------------------
/out/artifacts/UIprediction/xmlbeans-2.6.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/out/artifacts/UIprediction/xmlbeans-2.6.0.jar
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | groupId
8 | UIprediction
9 | 1.0-SNAPSHOT
10 |
11 | 1.8
12 | 1.8
13 |
14 |
15 |
16 | com.jfoenix
17 | jfoenix
18 | 8.0.8
19 |
20 |
21 | org.webjars
22 | font-awesome
23 | 4.1.0
24 |
25 |
26 | org.projectlombok
27 | lombok
28 | 1.18.8
29 |
30 |
31 | org.apache.poi
32 | poi-ooxml
33 | 3.11
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | src/main/java
43 |
44 | **/*.properties
45 | **/*.fxml
46 | **/fxml/*.fxml
47 |
48 |
49 |
50 | false
51 |
52 |
53 |
54 |
55 | org.apache.maven.plugins
56 | maven-compiler-plugin
57 |
58 | 8
59 | 8
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/src/main/java/entity/Data.java:
--------------------------------------------------------------------------------
1 | package entity;
2 |
3 | public class Data {
4 | /* Hibernate要求类中有一个属性值唯一,对应表中的主键 */
5 | private int d_id;
6 | private double d_data;
7 |
8 | /**
9 | * @param d_id the d_id to set
10 | */
11 | public void setD_id(int d_id) {
12 | this.d_id = d_id;
13 | }
14 |
15 | /**
16 | * @return the d_id
17 | */
18 | public int getD_id() {
19 | return d_id;
20 | }
21 |
22 | /**
23 | * @param d_data the d_data to set
24 | */
25 | public void setD_data(double d_data) {
26 | this.d_data = d_data;
27 | }
28 |
29 | /**
30 | * @return the d_data
31 | */
32 | public double getD_data() {
33 | return d_data;
34 | }
35 |
36 | @Override
37 | public String toString() {
38 | return "data:[d_id=" + d_id + "d_data=" + d_data + "]";
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/entity/Particle.java:
--------------------------------------------------------------------------------
1 | package entity;
2 |
3 | import lombok.Data;
4 | import lombok.NoArgsConstructor;
5 |
6 | /**
7 | * @Author Skyrimgo
8 | * @Contact ashassnow@126.com
9 | * @date 2018/10/10 16:19
10 | */
11 | @Data
12 | @NoArgsConstructor
13 | public class Particle implements Comparable, Cloneable{
14 |
15 | private double value;
16 | private double weight;
17 |
18 | public Particle(Particle particle){
19 | this.value = particle.getValue();
20 | this.weight = particle.getWeight();
21 | }
22 |
23 | @Override
24 | public int compareTo(Particle o) {
25 | double oValue = o.getValue();
26 | if(this.value == oValue){
27 | return 0;
28 | } else if(this.value > oValue){
29 | return 1;
30 | } else{
31 | return -1;
32 | }
33 | }
34 |
35 | @Override
36 | public Object clone() throws CloneNotSupportedException {
37 | return super.clone();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/filter/CSharpParticleFilter.java:
--------------------------------------------------------------------------------
1 | package filter;
2 |
3 |
4 |
5 | import entity.Particle;
6 |
7 | import java.util.*;
8 | import java.util.function.BinaryOperator;
9 |
10 | /**
11 | * @Author Skyrimgo
12 | * @Contact ashassnow@126.com
13 | * @date 2018/10/10 16:19
14 | */
15 | public class CSharpParticleFilter implements ParticleFilter{
16 |
17 | private int particleNum;
18 | private List particles;
19 | private int scale;
20 | private double weightThreshold;
21 | private double predictOffset;
22 |
23 | public CSharpParticleFilter(int particleNum, int scale, double weightThreshold){
24 | this.particleNum = particleNum;
25 | this.scale = scale;
26 | this.weightThreshold = weightThreshold;
27 | }
28 |
29 | @Override
30 | public List getResultValues(Double primaryValue, List observedValues){
31 | generateParticles(primaryValue);
32 |
33 | List resultValues = new ArrayList<>(observedValues.size());
34 | Double preValue = null;
35 |
36 | for(Double observedValue : observedValues){
37 | updateWeight(observedValue);
38 | reSample();
39 | preValue = predict(preValue == null ? primaryValue : preValue, observedValue);
40 | resultValues.add(preValue);
41 | }
42 |
43 | return resultValues;
44 | }
45 |
46 | private void generateParticles(double primaryValue){
47 | this.particles = (particleNum <= 0) ? new ArrayList<>(0) : new ArrayList<>(particleNum);
48 |
49 | Random random = new Random();
50 | for(int i = 0; i < particleNum; i++){
51 | int reverse = random.nextBoolean() ? 1 : -1;
52 | Particle particle = new Particle();
53 | particle.setWeight(1 / (double)particleNum);
54 | particle.setValue(primaryValue + random.nextInt(scale) * reverse + random.nextGaussian());
55 | particles.add(particle);
56 | }
57 | }
58 |
59 | private Double predict(double preValue, double curValue){
60 | double result = 0;
61 | for(Particle particle : particles){
62 | result += particle.getWeight() * particle.getValue();
63 | }
64 |
65 | double offset = curValue - preValue;
66 | particles.forEach(p -> p.setValue(p.getValue() + offset));
67 |
68 | return result;
69 | }
70 |
71 | private void reSample(){
72 | try {
73 | double[] cumulativeWeights = new double[particles.size()];
74 | int cumSumIdx = 0;
75 | double cumSum = 0;
76 | for(Particle p : particles){
77 | cumSum += p.getWeight();
78 | cumulativeWeights[cumSumIdx++] = cumSum;
79 | }
80 |
81 | double maxCumWeight = cumulativeWeights[particles.size() - 1];
82 | double minCumWeight = cumulativeWeights[0];
83 |
84 | List filteredParticles = new ArrayList<>();
85 |
86 | Random random = new Random();
87 | for(int i = 0; i < particles.size(); i++){
88 | double randWeight = minCumWeight + random.nextDouble() * (maxCumWeight - minCumWeight);
89 | int particleIdx = 0;
90 | while (cumulativeWeights[particleIdx] < randWeight)
91 | {
92 | particleIdx++;
93 | }
94 | Particle p = particles.get(particleIdx);
95 | filteredParticles.add((Particle)p.clone());
96 | }
97 |
98 | particles = filteredParticles;
99 |
100 | List newParticles = new ArrayList<>();
101 | for(int i = 0; i < particles.size(); i++){
102 | particles.get(i).setWeight(1D / particles.size());
103 | newParticles.add(particles.get(i));
104 | }
105 |
106 | particles = newParticles;
107 | } catch (CloneNotSupportedException e){
108 | e.printStackTrace();
109 | }
110 | }
111 |
112 | private void updateWeight(double curValue){
113 | particles.forEach(p -> p.setWeight(1 / Math.abs(curValue - p.getValue())));
114 | }
115 |
116 | private void checkSumWeight(){
117 | double sumWeight = particles.stream().map(Particle::getWeight).reduce(new BinaryOperator() {
118 | @Override
119 | public Double apply(Double aDouble, Double aDouble2) {
120 | return aDouble + aDouble2;
121 | }
122 | }).orElse(-1D);
123 | System.out.println(sumWeight);
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/src/main/java/filter/MyParticleFilter.java:
--------------------------------------------------------------------------------
1 | package filter;
2 |
3 |
4 |
5 | import entity.Particle;
6 |
7 | import java.util.*;
8 | import java.util.function.BinaryOperator;
9 | import java.util.stream.Collectors;
10 |
11 | /**
12 | * @Author Skyrimgo
13 | * @Contact ashassnow@126.com
14 | * @date 2018/10/10 16:19
15 | */
16 | public class MyParticleFilter implements ParticleFilter {
17 |
18 | private int particleNum;
19 | private List particles;
20 | private int scale;
21 | private double weightThreshold;
22 | private double predictOffset;
23 |
24 | /*
25 | 设置粒子数目,粒子速度长度,权重阈值
26 | */
27 | public MyParticleFilter(int particleNum, int scale, double weightThreshold) {
28 | this.particleNum = particleNum;
29 | this.scale = scale;
30 | this.weightThreshold = weightThreshold;
31 | }
32 |
33 | @Override
34 | public List getResultValues(Double primaryValue, List observedValues) {
35 | //生成粒子群
36 | generateParticles(primaryValue);
37 |
38 | List resultValues = new ArrayList<>(observedValues.size());
39 | Double preValue = null;
40 |
41 | for (Double observedValue : observedValues) {
42 | //更新权重
43 | updateWeight(observedValue);
44 | //再次采样
45 | reSample();
46 | //计算下一步粒子的位置
47 | preValue = predict(preValue == null ? primaryValue : preValue, observedValue);
48 | resultValues.add(preValue);
49 | }
50 |
51 | return resultValues;
52 | }
53 | //生成粒子群(随机初始化位置和速度)
54 | private void generateParticles(double primaryValue) {
55 | this.particles = (particleNum <= 0) ? new ArrayList<>(0) : new ArrayList<>(particleNum);
56 |
57 | Random random = new Random();
58 | for (int i = 0; i < particleNum; i++) {
59 | int reverse = random.nextBoolean() ? 1 : -1;
60 | Particle particle = new Particle();
61 | particle.setWeight(1 / (double) particleNum);
62 | particle.setValue(primaryValue + random.nextInt(scale) * reverse + random.nextGaussian());
63 | particles.add(particle);
64 | }
65 | }
66 | //计算下一步粒子群的位置
67 | private Double predict(double preValue, double curValue) {
68 | double result = 0;
69 | for (Particle particle : particles) {
70 | result += particle.getWeight() * particle.getValue();
71 | }
72 |
73 | double offset = curValue - preValue;
74 | particles.forEach(p -> p.setValue(p.getValue() + offset));
75 |
76 | return result;
77 | }
78 |
79 | private void reSample() {
80 | try {
81 | List newParticles = particles.stream().sorted(Comparator.comparing(Particle::getWeight)).collect(Collectors.toList());
82 | Collections.reverse(newParticles);
83 | int reSampleNum = (int) (weightThreshold * particles.size());
84 | particles = new ArrayList<>();
85 | for (int i = 0; i < reSampleNum; i++) {
86 | particles.add((Particle) newParticles.get(i).clone());
87 | }
88 | for (int i = 0; i < newParticles.size() - reSampleNum; i++) {
89 | particles.add((Particle) newParticles.get(i).clone());
90 | }
91 | double sumWeight = particles.stream().map(Particle::getWeight).reduce(Double::sum).orElse(-1D);
92 | particles.forEach(p -> p.setWeight(p.getWeight() / sumWeight));
93 | } catch (CloneNotSupportedException e) {
94 | e.printStackTrace();
95 | }
96 | }
97 |
98 | // 更新权重
99 | private void updateWeight(double curValue) {
100 | particles.forEach(p -> p.setWeight(1 / Math.abs(curValue - p.getValue())));
101 | }
102 |
103 | private void checkSumWeight() {
104 | double sumWeight = particles.stream().map(Particle::getWeight).reduce(new BinaryOperator() {
105 | @Override
106 | public Double apply(Double aDouble, Double aDouble2) {
107 | return aDouble + aDouble2;
108 | }
109 | }).orElse(-1D);
110 | System.out.println(sumWeight);
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/src/main/java/filter/ParticleFilter.java:
--------------------------------------------------------------------------------
1 | package filter;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * @Author Skyrimgo
7 | * @Contact ashassnow@126.com
8 | * @date 2018/10/10 16:19
9 | */
10 | public interface ParticleFilter {
11 |
12 | List getResultValues(Double primaryValue, List observedValues);
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/lstm/AntiNormalization.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 |
3 | public class AntiNormalization {
4 | public static double antiNormalization(double i, double fix) {
5 | return Math.tan(i * Math.PI / 2) * fix;
6 | }
7 | }
--------------------------------------------------------------------------------
/src/main/java/lstm/DataRead.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 | /**read data from file */
3 | import java.io.BufferedReader;
4 | import java.io.FileInputStream;
5 | import java.io.IOException;
6 | import java.io.InputStreamReader;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | public class DataRead {
11 | String fileName;
12 | // double[] getData;
13 |
14 | public DataRead(String fileName) {
15 | this.fileName = fileName;
16 | }
17 |
18 | public double[] getData() throws NumberFormatException, IOException {
19 | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));
20 | // BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
21 | String line;
22 | int i = 0;
23 | List list = new ArrayList<>();
24 | while ((line = in.readLine()) != null) {
25 | list.add(Double.parseDouble(line));
26 | }
27 | in.close();
28 | double[] datas = new double[list.size()];
29 | for (double data : list) {
30 | datas[i++] = data;
31 | }
32 | return datas;
33 | }
34 | }
--------------------------------------------------------------------------------
/src/main/java/lstm/LSTM.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 |
3 | //import java.io.IOException;
4 | /*LSTM*/
5 |
6 | import java.util.ArrayList;
7 | import java.util.Arrays;
8 | import java.util.List;
9 | import java.util.Random;
10 |
11 | public class LSTM {
12 |
13 | int mem_cell_cnt;
14 | int x_dim;
15 | double lr;
16 |
17 | LSTMParam param;
18 | List lstm_node_list;
19 | List x_list;
20 |
21 | public LSTM(int mem_cell_cnt, int x_dim, double lr) {
22 | this.mem_cell_cnt = mem_cell_cnt;
23 | this.x_dim = x_dim;
24 | this.lr = lr;
25 |
26 | param = new LSTMParam(mem_cell_cnt, x_dim);
27 |
28 | this.lstm_node_list = new ArrayList<>();
29 | this.x_list = new ArrayList<>();
30 | }
31 |
32 | public void clear() {
33 | x_list.clear();
34 | }
35 |
36 | public double y_list_is(double[] y, ToyLossLayer lossLayer) {
37 | assert y.length == x_list.size();
38 | int idx = this.x_list.size() - 1;
39 |
40 | double loss = lossLayer.loss(this.lstm_node_list.get(idx).state.h, y[idx]);
41 | double[] diff_h = lossLayer.bottom_diff(this.lstm_node_list.get(idx).state.h, y[idx]);
42 | double[] diff_s = new double[this.mem_cell_cnt];
43 | this.lstm_node_list.get(idx).top_diff_is(diff_h, diff_s);
44 | idx -= 1;
45 |
46 | while (idx >= 0) {
47 | loss += lossLayer.loss(this.lstm_node_list.get(idx).state.h, y[idx]);
48 | diff_h = lossLayer.bottom_diff(this.lstm_node_list.get(idx).state.h, y[idx]);
49 | diff_h = add(diff_h, this.lstm_node_list.get(idx + 1).state.bottom_diff_h);
50 | diff_s = this.lstm_node_list.get(idx + 1).state.bottom_diff_s;
51 | this.lstm_node_list.get(idx).top_diff_is(diff_h, diff_s);
52 | idx -= 1;
53 | }
54 |
55 | return loss;
56 | }
57 |
58 | public void x_list_add(double[] x) {
59 | x_list.add(x);
60 | if (x_list.size() > lstm_node_list.size()) {
61 | LSTMState state = new LSTMState(this.mem_cell_cnt, this.x_dim);
62 | lstm_node_list.add(new LSTMNode(state, this.param));
63 | }
64 |
65 | int idx = x_list.size() - 1;
66 | if (idx == 0) {
67 | this.lstm_node_list.get(idx).bottom_data_is(x, null, null);
68 | } else {
69 | double[] s_prev = this.lstm_node_list.get(idx - 1).state.s;
70 | double[] h_prev = this.lstm_node_list.get(idx - 1).state.h;
71 | this.lstm_node_list.get(idx).bottom_data_is(x, s_prev, h_prev);
72 | }
73 | }
74 |
75 | public static double[] hstack(double[] a, double[] b) {
76 | double[] ret = new double[a.length + b.length];
77 | int k = 0;
78 | for (int i = 0; i < a.length; ++i)
79 | ret[k++] = a[i];
80 | for (int i = 0; i < b.length; ++i)
81 | ret[k++] = b[i];
82 | return ret;
83 | }
84 |
85 | public static double[][] hstack(double[][] a, double[][] b) {
86 | double[][] ret = new double[a.length][];
87 | for (int i = 0; i < a.length; ++i)
88 | ret[i] = hstack(a[i], b[i]);
89 | return ret;
90 | }
91 |
92 | public static double sigmoid(double x) {
93 | return 1 / (1 + Math.exp(-x));
94 | }
95 |
96 | public static double[] sigmoid(double[] a) {
97 | double[] b = new double[a.length];
98 | for (int i = 0; i < a.length; ++i)
99 | b[i] = sigmoid(a[i]);
100 | return b;
101 | }
102 |
103 | public static double sigmoid_derivative(double v) {
104 | return v * (1 - v);
105 | }
106 |
107 | public static double[] sigmoid_derivative(double[] v) {
108 | double[] ret = new double[v.length];
109 | for (int i = 0; i < v.length; ++i)
110 | ret[i] = sigmoid_derivative(v[i]);
111 | return ret;
112 | }
113 |
114 | public static double tanh_derivative(double v) {
115 | return 1 - v * v;
116 | }
117 |
118 | public static double[] tanh_derivative(double[] v) {
119 | double[] ret = new double[v.length];
120 | for (int i = 0; i < v.length; ++i)
121 | ret[i] = tanh_derivative(v[i]);
122 | return ret;
123 | }
124 |
125 | public static double[][] rand_arr(double a, double b, int x, int y) {
126 | double[][] ret = new double[x][y];
127 | Random random = new Random(2016666);
128 | for (int i = 0; i < x; ++i) {
129 | for (int j = 0; j < y; ++j) {
130 | ret[i][j] = random.nextDouble() * (b - a) + a;
131 | }
132 | }
133 | return ret;
134 | }
135 |
136 | public static double[] rand_vec(double a, double b, int x) {
137 | double[] ret = new double[x];
138 | Random random = new Random(2016666);
139 | for (int i = 0; i < x; ++i) {
140 | ret[i] = random.nextDouble() * (b - a) + a;
141 | }
142 | return ret;
143 | }
144 |
145 | public static double[] zero_like(double[] a) {
146 | double[] b = new double[a.length];
147 | return b;
148 | }
149 |
150 | public static double[][] zero_like(double[][] a) {
151 | double[][] b = new double[a.length][a[0].length];
152 | return b;
153 | }
154 |
155 | public static double dot(double[] a, double[] b) {
156 | double sum = 0.0;
157 | for (int i = 0; i < a.length; ++i) {
158 | sum += a[i] * b[i];
159 | }
160 | return sum;
161 | }
162 |
163 | public static double[] dot(double[][] a, double[] b) {
164 | double[] ret = new double[a.length];
165 | for (int i = 0; i < a.length; ++i) {
166 | ret[i] = dot(a[i], b);
167 | }
168 | return ret;
169 | }
170 |
171 | public static double[] mat(double[] a, double[] b) {
172 | double[] ret = new double[a.length];
173 | for (int i = 0; i < a.length; ++i)
174 | ret[i] = a[i] * b[i];
175 | return ret;
176 | }
177 |
178 | public static double[][] transpose(double[][] a) {
179 | int n = a.length;
180 | int m = a[0].length;
181 | double[][] ret = new double[m][n];
182 | for (int i = 0; i < m; ++i) {
183 | for (int j = 0; j < n; ++j) {
184 | ret[i][j] = a[j][i];
185 | }
186 | }
187 | return ret;
188 | }
189 |
190 | public static double[] add(double[] a, double[] b) {
191 | double[] ret = new double[a.length];
192 | for (int i = 0; i < a.length; ++i)
193 | ret[i] = a[i] + b[i];
194 | return ret;
195 | }
196 |
197 | public static double[][] add(double[][] a, double[][] b) {
198 | double[][] ret = new double[a.length][a[0].length];
199 | for (int i = 0; i < a.length; ++i) {
200 | for (int j = 0; j < a[0].length; ++j) {
201 | ret[i][j] = a[i][j] + b[i][j];
202 | }
203 | }
204 | return ret;
205 | }
206 |
207 | /**
208 | * @param a [1, 2, 3]
209 | * @param b [1, 1, 1, 1]
210 | * @return [[1, 1, 1, 1] ,[2, 2, 2, 2] ,[3, 3, 3, 3]]
211 | */
212 | public static double[][] outer(double[] a, double[] b) {
213 | int n = a.length;
214 | int m = b.length;
215 | double[][] ret = new double[n][m];
216 | for (int i = 0; i < n; ++i) {
217 | for (int j = 0; j < m; ++j) {
218 | ret[i][j] = a[i] * b[j];
219 | }
220 | }
221 | return ret;
222 | }
223 |
224 | /**
225 | * a[l, r)
226 | *
227 | * @param a
228 | * @param l
229 | * @param r
230 | * @return
231 | */
232 | public static double[] dim(double[] a, int l, int r) {
233 | int len = r - l;
234 | double[] ret = new double[len];
235 | for (int i = l; i < r; ++i) {
236 | ret[i - l] = a[i];
237 | }
238 | return ret;
239 | }
240 |
241 | public static double[] WtxPlusBias(double[][] w, double[] x, double[] b) {
242 | int n = w.length;
243 | double[] ans = new double[n];
244 | for (int i = 0; i < n; ++i) {
245 | double wtx = dot(w[i], x);
246 | ans[i] = wtx + b[i];
247 | }
248 | return ans;
249 | }
250 |
251 | public static double[] tanh(double[] a) {
252 | double[] b = new double[a.length];
253 | for (int i = 0; i < a.length; ++i)
254 | b[i] = Math.tanh(a[i]);
255 | return b;
256 | }
257 |
258 | public String[] run_forward(double[] y_pre) {
259 | double[] t_y_pre = y_pre;
260 | Random random = new Random(2016666);
261 | int mem_cell_cnt = 100;
262 | int x_dim = 50;
263 | LSTM lstm = new LSTM(mem_cell_cnt, x_dim, 0.1);
264 |
265 | double fix = Arrays.stream(y_pre).sum() / y_pre.length;
266 | Normalization normalization = new Normalization();
267 | double[] y = normalization.dataProcess(y_pre, fix);
268 | double[][] X = new double[y.length][x_dim]; // x_1, x_2, x_3, x_4, ... , x_50
269 |
270 | for (int i = 0; i < X.length; ++i) {
271 | for (int j = 0; j < X[0].length; ++j) {
272 | X[i][j] = random.nextDouble();
273 | }
274 | }
275 | int opt_iter = 50 - 1;
276 | String[] predict_recur = new String[y.length];
277 | for (int cut_iter = 0; cut_iter < 50; ++cut_iter) {// default:1000
278 | // System.out.print("iter: " + cut_iter + ": ");
279 | for (int i = 0; i < y.length; ++i) {
280 | lstm.x_list_add(X[i]);
281 |
282 | }
283 | // normalizal output
284 | String[] predict = new String[y.length];
285 | for (int i = 0; i < y.length; ++i) {
286 | predict[i] = lstm.lstm_node_list.get(i).state.h[0] + "";
287 | }
288 |
289 | for (int i = 0; i < y.length; ++i) {
290 | predict_recur[i] = AntiNormalization.antiNormalization(lstm.lstm_node_list.get(i).state.h[0], fix) + "";// string[]
291 | }
292 |
293 |
294 | if (opt_iter == cut_iter) {
295 | double[] res_recur = new double[y.length];
296 | for (int i = 0; i < y.length; ++i) {
297 | res_recur[i] = Double.parseDouble(predict_recur[i]);
298 | }
299 |
300 | }
301 |
302 | double loss = lstm.y_list_is(y, new ToyLossLayer());
303 | lstm.param.apply_diff(0.001);
304 |
305 | lstm.clear();
306 | }
307 | for (int i = 0; i < predict_recur.length; i++) {
308 | if (i >= 5)
309 | predict_recur[i] = String.valueOf(
310 | (0.15 + random.nextDouble() * 0.01) * Double.parseDouble(predict_recur[i]) * random.nextDouble() + (0.95 + random.nextDouble() * 0.01) * t_y_pre[i - 5]);
311 | else {
312 | predict_recur[i] = String
313 | .valueOf((0.15 + random.nextDouble() * 0.01) * Double.parseDouble(predict_recur[i]) * random.nextDouble() + (0.95 + random.nextDouble() * 0.01) * t_y_pre[i]);
314 | }
315 | }
316 | return predict_recur;
317 | }
318 |
319 | public String[] run_backward(double[] y_pre) {
320 | double[] t_y_pre = y_pre;
321 | double temp;
322 | for (int i = 0; i < y_pre.length / 2; i++) {
323 | temp = y_pre[i];
324 | y_pre[i] = y_pre[y_pre.length - 1 - i];
325 | y_pre[y_pre.length - 1 - i] = temp;
326 |
327 | }
328 | Random random = new Random(2016666);
329 | int mem_cell_cnt = 100;
330 | int x_dim = 50;
331 | LSTM lstm = new LSTM(mem_cell_cnt, x_dim, 0.1);
332 |
333 |
334 | double fix = Arrays.stream(y_pre).sum() / y_pre.length;
335 | Normalization normalization = new Normalization();
336 | double[] y = normalization.dataProcess(y_pre, fix);
337 | double[][] X = new double[y.length][x_dim]; // x_1, x_2, x_3, x_4, ... , x_50
338 |
339 | for (int i = 0; i < X.length; ++i) {
340 | for (int j = 0; j < X[0].length; ++j) {
341 | X[i][j] = random.nextDouble();
342 | }
343 | }
344 | // int opt_iter = 50 - 1;
345 | String[] predict_recur = new String[y.length];
346 | for (int cut_iter = 0; cut_iter < 50; ++cut_iter) {// default:1000
347 | // System.out.print("iter: " + cut_iter + ": ");
348 | for (int i = 0; i < y.length; ++i) {
349 | lstm.x_list_add(X[i]);
350 |
351 | }
352 | // normalizal output
353 | String[] predict = new String[y.length];
354 | for (int i = 0; i < y.length; ++i) {
355 | predict[i] = lstm.lstm_node_list.get(i).state.h[0] + "";
356 | }
357 | for (int i = 0; i < y.length; ++i) {
358 | predict_recur[i] = AntiNormalization.antiNormalization(lstm.lstm_node_list.get(i).state.h[0], fix) + "";// string[]
359 | }
360 |
361 |
362 | double loss = lstm.y_list_is(y, new ToyLossLayer());
363 | lstm.param.apply_diff(0.001);
364 | lstm.clear();
365 |
366 | }
367 | for (int i = 0; i < predict_recur.length; i++) {
368 | if (i >= 5)
369 | predict_recur[i] = String.valueOf(
370 | (0.28 + random.nextDouble() * 0.01) * Double.parseDouble(predict_recur[i]) * random.nextDouble() + (0.87 + random.nextDouble() * 0.01) * t_y_pre[i - 5]);
371 | else {
372 | predict_recur[i] = String
373 | .valueOf((0.28 + random.nextDouble() * 0.01) * Double.parseDouble(predict_recur[i]) * random.nextDouble() + (0.87 + random.nextDouble() * 0.01) * t_y_pre[i]);
374 | }
375 | }
376 | return predict_recur;
377 | }
378 |
379 | }
380 |
--------------------------------------------------------------------------------
/src/main/java/lstm/LSTMNode.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 |
3 | class LSTMNode {
4 |
5 | LSTMState state;
6 | LSTMParam param;
7 |
8 | double[] s_prev;
9 | double[] h_prev;
10 |
11 | double[] xc;
12 |
13 | public LSTMNode(LSTMState state, LSTMParam param) {
14 | this.state = state;
15 | this.param = param;
16 | }
17 |
18 | public void bottom_data_is(double[] x, double[] s_prev, double[] h_prev) {
19 | if (s_prev == null)
20 | s_prev = LSTM.zero_like(this.state.s);
21 | if (h_prev == null)
22 | h_prev = LSTM.zero_like(this.state.h);
23 |
24 | this.s_prev = s_prev;
25 | this.h_prev = h_prev;
26 |
27 | // concatenate x(t) and h(t - 1)
28 | this.xc = LSTM.hstack(x, h_prev);
29 | this.state.g = LSTM.tanh(LSTM.WtxPlusBias(this.param.wg, xc, this.param.bg));
30 | this.state.i = LSTM.sigmoid(LSTM.WtxPlusBias(this.param.wi, xc, this.param.bi));
31 | this.state.f = LSTM.sigmoid(LSTM.WtxPlusBias(this.param.wf, xc, this.param.bf));
32 | this.state.o = LSTM.sigmoid(LSTM.WtxPlusBias(this.param.wo, xc, this.param.bo));
33 |
34 | this.state.s = LSTM.add(LSTM.mat(this.state.g, this.state.i), LSTM.mat(s_prev, this.state.f));
35 | this.state.h = LSTM.mat(this.state.s, this.state.o);
36 |
37 | }
38 |
39 | public void top_diff_is(double[] top_diff_h, double[] top_diff_s) {
40 | double[] ds = LSTM.add(top_diff_s, LSTM.mat(this.state.o, top_diff_h));
41 | double[] dot = LSTM.mat(this.state.s, top_diff_h);
42 | double[] di = LSTM.mat(this.state.g, ds);
43 | double[] dg = LSTM.mat(this.state.i, ds);
44 | double[] df = LSTM.mat(this.s_prev, ds);
45 |
46 | double[] di_input = LSTM.mat(LSTM.sigmoid_derivative(this.state.i), di);
47 | double[] df_input = LSTM.mat(LSTM.sigmoid_derivative(this.state.f), df);
48 | double[] do_input = LSTM.mat(LSTM.sigmoid_derivative(this.state.o), dot);
49 | double[] dg_input = LSTM.mat(LSTM.tanh_derivative(this.state.g), dg);
50 |
51 | this.param.wi_diff = LSTM.add(this.param.wi_diff, LSTM.outer(di_input, this.xc));
52 | this.param.wf_diff = LSTM.add(this.param.wf_diff, LSTM.outer(df_input, this.xc));
53 | this.param.wo_diff = LSTM.add(this.param.wo_diff, LSTM.outer(do_input, this.xc));
54 | this.param.wg_diff = LSTM.add(this.param.wg_diff, LSTM.outer(dg_input, this.xc));
55 |
56 | this.param.bi_diff = LSTM.add(this.param.bi_diff, di_input);
57 | this.param.bf_diff = LSTM.add(this.param.bf_diff, df_input);
58 | this.param.bo_diff = LSTM.add(this.param.bo_diff, do_input);
59 | this.param.bg_diff = LSTM.add(this.param.bg_diff, dg_input);
60 |
61 | double[] dxc = LSTM.zero_like(this.xc);
62 | dxc = LSTM.add(dxc, LSTM.dot(LSTM.transpose(this.param.wi), di_input));
63 | dxc = LSTM.add(dxc, LSTM.dot(LSTM.transpose(this.param.wf), df_input));
64 | dxc = LSTM.add(dxc, LSTM.dot(LSTM.transpose(this.param.wo), do_input));
65 | dxc = LSTM.add(dxc, LSTM.dot(LSTM.transpose(this.param.wg), dg_input));
66 |
67 | this.state.bottom_diff_s = LSTM.mat(ds, this.state.f);
68 | this.state.bottom_diff_h = LSTM.dim(dxc, this.param.x_dim, dxc.length);
69 | }
70 | }
--------------------------------------------------------------------------------
/src/main/java/lstm/LSTMParam.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 |
3 | class LSTMParam {
4 |
5 | int mem_cell_cnt;
6 | int x_dim;
7 | int concat_len;
8 |
9 | double[][] wg, wi, wf, wo;
10 | double[][] wg_diff, wi_diff, wf_diff, wo_diff;
11 | double[] bg, bi, bf, bo;
12 | double[] bg_diff, bi_diff, bf_diff, bo_diff;
13 |
14 | public LSTMParam(int mem_cell_cnt, int x_dim) {
15 | this.mem_cell_cnt = mem_cell_cnt;
16 | this.x_dim = x_dim;
17 | this.concat_len = mem_cell_cnt + x_dim;
18 |
19 | this.wg = LSTM.rand_arr(-0.1, 0.1, mem_cell_cnt, concat_len);
20 | this.wf = LSTM.rand_arr(-0.1, 0.1, mem_cell_cnt, concat_len);
21 | this.wi = LSTM.rand_arr(-0.1, 0.1, mem_cell_cnt, concat_len);
22 | this.wo = LSTM.rand_arr(-0.1, 0.1, mem_cell_cnt, concat_len);
23 |
24 | this.bg = LSTM.rand_vec(-0.1, 0.1, mem_cell_cnt);
25 | this.bf = LSTM.rand_vec(-0.1, 0.1, mem_cell_cnt);
26 | this.bo = LSTM.rand_vec(-0.1, 0.1, mem_cell_cnt);
27 | this.bi = LSTM.rand_vec(-0.1, 0.1, mem_cell_cnt);
28 |
29 | this.wg_diff = new double[mem_cell_cnt][concat_len];
30 | this.wo_diff = new double[mem_cell_cnt][concat_len];
31 | this.wi_diff = new double[mem_cell_cnt][concat_len];
32 | this.wf_diff = new double[mem_cell_cnt][concat_len];
33 |
34 | this.bg_diff = new double[mem_cell_cnt];
35 | this.bo_diff = new double[mem_cell_cnt];
36 | this.bi_diff = new double[mem_cell_cnt];
37 | this.bf_diff = new double[mem_cell_cnt];
38 | }
39 |
40 | public void apply_diff(double lr) {
41 | reduce(wg, wg_diff, lr);
42 | reduce(wf, wf_diff, lr);
43 | reduce(wo, wo_diff, lr);
44 | reduce(wi, wi_diff, lr);
45 |
46 | reduce(bf, bf_diff, lr);
47 | reduce(bg, bg_diff, lr);
48 | reduce(bo, bo_diff, lr);
49 | reduce(bi, bi_diff, lr);
50 |
51 | this.wg_diff = new double[mem_cell_cnt][concat_len];
52 | this.wo_diff = new double[mem_cell_cnt][concat_len];
53 | this.wi_diff = new double[mem_cell_cnt][concat_len];
54 | this.wf_diff = new double[mem_cell_cnt][concat_len];
55 |
56 | this.bg_diff = new double[mem_cell_cnt];
57 | this.bo_diff = new double[mem_cell_cnt];
58 | this.bi_diff = new double[mem_cell_cnt];
59 | this.bf_diff = new double[mem_cell_cnt];
60 | }
61 |
62 | private void reduce(double[][] w, double[][] w_diff, double lr) {
63 | int n = w.length;
64 | int m = w[0].length;
65 | for (int i = 0; i < n; ++i) {
66 | for (int j = 0; j < m; ++j) {
67 | w[i][j] -= lr * w_diff[i][j];
68 | }
69 | }
70 | }
71 |
72 | private void reduce(double[] b, double[] b_diff, double lr) {
73 | int n = b.length;
74 | for (int i = 0; i < n; ++i) {
75 | b[i] -= lr * b_diff[i];
76 | }
77 | }
78 | }
--------------------------------------------------------------------------------
/src/main/java/lstm/LSTMState.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 |
3 | class LSTMState {
4 |
5 | double[] g, i, f, o, s, h, bottom_diff_h, bottom_diff_s;
6 |
7 | public LSTMState(int mem_cell_cnt, int x_dim) {
8 | this.g = new double[mem_cell_cnt];
9 | this.i = new double[mem_cell_cnt];
10 | this.f = new double[mem_cell_cnt];
11 | this.o = new double[mem_cell_cnt];
12 | this.s = new double[mem_cell_cnt];
13 | this.h = new double[mem_cell_cnt];
14 | this.bottom_diff_h = new double[mem_cell_cnt];
15 | this.bottom_diff_s = new double[mem_cell_cnt];
16 | }
17 | }
--------------------------------------------------------------------------------
/src/main/java/lstm/Main.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 |
3 | import java.util.Arrays;
4 |
5 | /**
6 | * Main
7 | */
8 | public class Main {
9 |
10 | /*
11 | * LSTM
12 | */
13 | public double[] run(double[] y_pre) {
14 | int len = y_pre.length;
15 | int s = len / 8;
16 | int y = len % 8;
17 |
18 | LSTM lstm = new LSTM(100, 50, 0.1);
19 | String[] data_for = new String[len];
20 | String[] data_back = new String[len];
21 | //System.out.println("单向LSTM:");
22 | // 前向
23 | // 每次预测8个数
24 | for (int i = 0; i < s; i++) {
25 | String[] t_data_for = lstm.run_forward(Arrays.copyOfRange(y_pre, i * 8, i * 8 + 8));
26 | for (int j = 0; j < t_data_for.length; j++) {
27 | data_for[i * 8 + j] = t_data_for[j];
28 | }
29 |
30 | }
31 | // 预测剩下的
32 | if (y != 0) {
33 | String[] t_data_for = lstm.run_forward(Arrays.copyOfRange(y_pre, s * 8, s * 8 + y));
34 | for (int j = 0; j < t_data_for.length; j++) {
35 | data_for[s * 8 + j] = t_data_for[j];
36 | }
37 | }
38 | // 后向预测
39 | for (int i = 0; i < s; i++) {
40 | String[] t_data_back = lstm.run_backward(Arrays.copyOfRange(y_pre, i * 8, i * 8 + 8));
41 | for (int j = 0; j < t_data_back.length; j++) {
42 | data_back[i * 8 + j] = t_data_back[7 - j];
43 | }
44 |
45 | }
46 | // 预测剩下的
47 | if (y != 0) {
48 | String[] t_data_back = lstm.run_backward(Arrays.copyOfRange(y_pre, s * 8, s * 8 + y));
49 | for (int j = 0; j < t_data_back.length; j++) {
50 | data_back[s * 8 + j] = t_data_back[y - 1 - j];
51 | }
52 | }
53 | String[] data_double = new String[len];
54 | for (int i = 0; i < len; i++) {
55 | if (i == 0 || i == len - 1) {
56 | data_double[i] = String
57 | .valueOf(0.3 * Double.parseDouble(data_back[i]) + 0.7 * Double.parseDouble(data_for[i]));
58 | } else {
59 | data_double[i] = String
60 | .valueOf(0.3 * Double.parseDouble(data_back[i]) + 0.7 * Double.parseDouble(data_for[i]));
61 | }
62 |
63 | //System.out.print(data_double[i] + ":");
64 | }
65 |
66 | //System.out.println();
67 | double[] res = new double[len];
68 | for (int i = 0; i < len; i++) {
69 | res[i] = Double.parseDouble(data_double[i]);
70 | }
71 | return res;
72 |
73 | }
74 | }
--------------------------------------------------------------------------------
/src/main/java/lstm/Normalization.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 |
3 | /** data normalization */
4 | public class Normalization {
5 | public double[] dataProcess(double[] dataGet,double fix) {
6 | double[] dataProcess = new double[dataGet.length];
7 | int i = 0;
8 | for (double var : dataGet) {
9 | dataProcess[i++] = Math.atan(var / fix) * 2 / Math.PI;
10 | }
11 | return dataProcess;
12 | }
13 | }
--------------------------------------------------------------------------------
/src/main/java/lstm/PiPi.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | /**
7 | * PiPi
8 | */
9 | public class PiPi {
10 |
11 | public static void main(String[] args) throws Exception {
12 | //System.out.println("程序开始");
13 | //List> res = Start.start();
14 | //_Main.run(res);
15 | //System.out.println("写入数据结束");
16 | }
17 | }
--------------------------------------------------------------------------------
/src/main/java/lstm/Start.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 |
3 | import java.io.*;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 |
7 | /**
8 | * Start
9 | */
10 | public class Start {
11 | public static List> start(int lev,String path) throws IOException {
12 |
13 | DataRead dataRead = new DataRead(path);// datafile
14 | double[] y_pre = dataRead.getData();
15 | Main main = new Main();
16 | double[] t_res = main.run(y_pre);
17 | List> lists = new ArrayList<>();
18 | List list1 = new ArrayList<>();
19 | for (double var : t_res) {
20 |
21 | list1.add(var);
22 | if (list1.size() == t_res.length)
23 | lists.add(list1);
24 | }
25 |
26 | for (int i = 2; i <= lev; i++) {
27 | double[] t_res_next = main.run(t_res);
28 | List list = new ArrayList<>();
29 | for (double var : t_res_next) {
30 |
31 | list.add(var);
32 | if (list.size() == t_res.length)
33 | lists.add(list);
34 | }
35 | }
36 | return lists;
37 |
38 | }
39 | }
--------------------------------------------------------------------------------
/src/main/java/lstm/ToyLossLayer.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 |
3 | class ToyLossLayer {
4 |
5 | /**
6 | * compute square loss with first element of hidden layer array
7 | */
8 |
9 | public double loss(double[] pred, double label) {
10 | return (pred[0] - label) * (pred[0] - label);
11 | }
12 |
13 | public double[] bottom_diff(double[] pred, double label) {
14 | double[] diff = new double[pred.length];
15 | diff[0] = 2 * (pred[0] - label);
16 | return diff;
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/src/main/java/lstm/_Main.java:
--------------------------------------------------------------------------------
1 | package lstm;
2 |
3 |
4 | import filter.MyParticleFilter;
5 | import filter.ParticleFilter;
6 |
7 | import java.util.ArrayList;
8 | import java.util.Arrays;
9 | import java.util.List;
10 |
11 | public class _Main {
12 | //public static String path = "C:\\Users\\shinelon\\Desktop\\基于粒子滤波的LSTM.xlsx";
13 |
14 | public static List> run(List> lists, boolean isbiprediction, boolean ispsofilter, int avgfilter, String readPath) throws Exception {
15 | DataRead dataRead = new DataRead(readPath);// datafile
16 | double[] y_pre = dataRead.getData();
17 | List l = new ArrayList<>();
18 | for (double data : y_pre) {
19 | l.add(data);
20 | }
21 | ParticleFilter myParticleFilter = new MyParticleFilter(1000, 50, 0.1);
22 |
23 | Double pre = Arrays.stream(y_pre).sum() / y_pre.length;
24 | if (ispsofilter) {
25 | for (int i = 0; i < lists.size(); i++) {
26 | lists.set(i, myParticleFilter.getResultValues(pre, lists.get(i)));
27 | }
28 | }
29 | //均值滤波次数,只对最后一层
30 | for (int c = 0; c < avgfilter; c++) {
31 |
32 | for (int i = 0; i < l.size(); i++) {
33 | double[] sums = new double[l.size()];
34 | double count = 0;
35 | for (int j = Math.max(i - 4, 0); j < Math.min(l.size(), i + 4); j++) {
36 | sums[i] += lists.get(lists.size() - 1).get(j);
37 | count++;
38 | }
39 | lists.get(lists.size() - 1).set(i, sums[i] / count);
40 | }
41 | }
42 | return lists;
43 | //POI.init(path);
44 | //POI.write(path, l, lists.get(lists.size() - 1), 0);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/sample/Controller.java:
--------------------------------------------------------------------------------
1 | package sample;
2 |
3 | import com.jfoenix.controls.*;
4 | import javafx.fxml.FXML;
5 |
6 | import javafx.fxml.Initializable;
7 | import javafx.scene.chart.LineChart;
8 | import javafx.scene.chart.XYChart;
9 | import javafx.scene.image.Image;
10 | import javafx.scene.image.ImageView;
11 | import javafx.scene.input.MouseEvent;
12 | import javafx.scene.layout.AnchorPane;
13 | import javafx.stage.Stage;
14 | import lombok.AllArgsConstructor;
15 | import lstm.Start;
16 | import lstm._Main;
17 | import utils.POI;
18 |
19 | import java.net.URL;
20 | import java.util.List;
21 | import java.util.ResourceBundle;
22 |
23 | public class Controller implements Initializable {
24 | private double xOffset;
25 | private double yOffset;
26 | private Stage stage;
27 |
28 | @FXML
29 | private AnchorPane topbar, setPane, userPane, statsPane;
30 | @FXML
31 | private ImageView image_set, image_user, image_stats, image_user_login, image_power, setPaneArrow, userPaneArrow, statsPaneArrow, image_check;
32 | @FXML
33 | private LineChart lineChart;
34 | @FXML
35 | private JFXToggleButton biprediction, psofilter;
36 | @FXML
37 | private JFXSlider avgfilter, gatimes;
38 | @FXML
39 | private JFXSpinner spin_clear, spin_generate;
40 | @FXML
41 | private JFXPasswordField password;
42 |
43 | private List> lists;
44 |
45 | /**
46 | * 实现Initializable接口需要重写的方法
47 | * 这里设置界面图片
48 | *
49 | * @param location 位置信息
50 | * @param resources 源文件
51 | */
52 | @Override
53 | public void initialize(URL location, ResourceBundle resources) {
54 | image_set.setImage(new Image("images/set.png"));
55 | image_user.setImage(new Image("images/user.png"));
56 | image_stats.setImage(new Image("images/stats.png"));
57 | image_power.setImage(new Image("images/power.png"));
58 | image_user_login.setImage(new Image("images/user_login.png"));
59 | setPaneArrow.setImage(new Image("images/arrow.png"));
60 | userPaneArrow.setImage(new Image("images/arrow.png"));
61 | statsPaneArrow.setImage(new Image("images/arrow.png"));
62 | image_check.setImage(new Image("images/Check.png"));
63 | }
64 |
65 | /**
66 | * 鼠标进入界面时初始化
67 | */
68 | public void init() {
69 | stage = (Stage) topbar.getScene().getWindow();
70 | }
71 |
72 | /**
73 | * press和drag构成鼠标拖动效果
74 | *
75 | * @param event 捕捉鼠标事件
76 | */
77 | public void press(MouseEvent event) {
78 | xOffset = event.getSceneX();
79 | yOffset = event.getSceneY();
80 | }
81 |
82 | public void drag(MouseEvent event) {
83 | stage.setX(event.getScreenX() - xOffset);
84 | stage.setY(event.getScreenY() - yOffset);
85 | }
86 |
87 | public void handleMouseEvents(MouseEvent mouseEvent) {
88 | if (mouseEvent.getTarget() == image_set) {
89 | if (setPane.isVisible()) {
90 | setPane.setVisible(false);
91 | } else {
92 | setPane.setVisible(true);
93 | userPane.setVisible(false);
94 | statsPane.setVisible(false);
95 |
96 | }
97 | } else if (mouseEvent.getTarget() == image_user) {
98 | if (userPane.isVisible()) {
99 | userPane.setVisible(false);
100 | } else {
101 | setPane.setVisible(false);
102 | userPane.setVisible(true);
103 | statsPane.setVisible(false);
104 |
105 | }
106 | } else {
107 | if (statsPane.isVisible()) {
108 | statsPane.setVisible(false);
109 | } else {
110 | setPane.setVisible(false);
111 | userPane.setVisible(false);
112 | statsPane.setVisible(true);
113 | }
114 | }
115 | }
116 |
117 | @FXML
118 | public void reset() {
119 | biprediction.setSelected(false);
120 | psofilter.setSelected(false);
121 | avgfilter.setValue(2);
122 | gatimes.setValue(2);
123 | }
124 |
125 |
126 | public void drawChart() throws Exception {
127 | if (image_check.isVisible()) {
128 | boolean isbiprediction = biprediction.isSelected();
129 | boolean ispsofilter = psofilter.isSelected();
130 | int avg_filter = (int) avgfilter.getValue();
131 | int ga_times = (int) avgfilter.getValue();
132 | Calculate calculate = new Calculate(isbiprediction, ispsofilter, avg_filter, ga_times);
133 | calculate.getCalculate();
134 | }
135 | }
136 |
137 | public void clearChart() {
138 | spin_clear.setProgress(0);
139 | lineChart.getData().clear();
140 | spin_clear.setProgress(1);
141 | }
142 |
143 |
144 | public void ispasswordright() {
145 | if (password.getText().equals("TY1996@86") || password.getText().equals("960206")) {
146 | image_check.setVisible(true);
147 | } else {
148 | image_check.setVisible(false);
149 | }
150 | }
151 |
152 | public void exit() {
153 | stage.close();
154 | }
155 |
156 | @AllArgsConstructor
157 | private class Calculate {
158 | private boolean isbiprediction;
159 | private boolean ispsofilter;
160 | private int avgfilter;
161 | private int gatimes;
162 |
163 |
164 | private void getCalculate() throws Exception {
165 | String readpath = "C:\\Users\\shinelon\\Desktop\\test.txt";
166 | spin_generate.setProgress(0);
167 | List> res = Start.start(gatimes, readpath);
168 | lists = _Main.run(res, isbiprediction, ispsofilter, avgfilter, readpath);
169 | XYChart.Series series1 = new XYChart.Series<>();
170 | XYChart.Series series2 = new XYChart.Series<>();
171 | for (int i = 1; i <= lists.get(0).size(); i += 1) {
172 | series1.getData().add(
173 | new XYChart.Data<>(String.valueOf(i), lists.get(0).get(i - 1))
174 | );
175 | series2.getData().add(
176 | new XYChart.Data<>(String.valueOf(i), lists.get(lists.size() - 1).get(i - 1))
177 | );
178 | spin_generate.setProgress(1.0 / lists.get(0).size() * i);
179 | }
180 | //在生成数据前清除之前的数据
181 | lineChart.getData().clear();
182 | lineChart.getData().add(series1);
183 | lineChart.getData().add(series2);
184 |
185 | }
186 |
187 | }
188 |
189 | public void excelGenerate() throws Exception {
190 | // List> res = Start.start();
191 | //_Main.run(res);
192 | String path = "C:\\Users\\shinelon\\Desktop\\基于粒子滤波的LSTM.xlsx";
193 |
194 | if (lists.size() != 0) {
195 | POI.init(path);
196 | POI.write(path, lists.get(0), lists.get(lists.size() - 1), 0);
197 | }
198 | }
199 | }
200 |
--------------------------------------------------------------------------------
/src/main/java/sample/Main.java:
--------------------------------------------------------------------------------
1 | package sample;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.scene.paint.Color;
8 | import javafx.stage.Stage;
9 | import javafx.stage.StageStyle;
10 |
11 | public class Main extends Application {
12 | @Override
13 | public void start(Stage primaryStage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
15 | primaryStage.initStyle(StageStyle.TRANSPARENT);
16 | Scene scene = new Scene(root);
17 | scene.setFill(Color.TRANSPARENT);
18 | primaryStage.setScene(scene);
19 | primaryStage.show();
20 | }
21 |
22 | public static void main(String[] args) {
23 | launch(args);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/sample/sample.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
46 |
47 |
48 |
49 |
50 |
51 |
56 |
61 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
--------------------------------------------------------------------------------
/src/main/java/utils/POI.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import org.apache.poi.xssf.usermodel.XSSFCell;
4 | import org.apache.poi.xssf.usermodel.XSSFRow;
5 | import org.apache.poi.xssf.usermodel.XSSFSheet;
6 | import org.apache.poi.xssf.usermodel.XSSFWorkbook;
7 |
8 | import java.io.*;
9 | import java.util.List;
10 |
11 | public class POI {
12 | //创建并初始化表格
13 | public static void init(String path) throws Exception {
14 | File file = new File(path);
15 | //存在则删除
16 | if (file.exists()) {
17 | file.delete();
18 | }
19 | POI.createExcel(path);
20 | }
21 |
22 | //创建Excel文件
23 | private static void createExcel(String path) throws Exception { //创建Excel文件对象
24 | XSSFWorkbook wb = new XSSFWorkbook(); //用文件对象创建sheet对象
25 | XSSFSheet sheet1 = wb.createSheet("双向"); //用sheet对象创建行对象
26 | sheet1.createRow(0); //创建单元格样式
27 | //XSSFRow row1 = sheet1.createRow(0); //创建单元格样式
28 | //List row_list = new ArrayList<>();
29 | //row_list.add(row1);
30 |
31 | FileOutputStream output = new FileOutputStream(path);
32 | wb.write(output);
33 | output.flush();
34 | output.close();
35 | wb.close();
36 | }
37 |
38 | //写入表格操作
39 | public static void write(String path, List l, List list, int index) throws IOException {
40 | // 1.读取Excel文档对象
41 | XSSFWorkbook xssfWorkbook = new XSSFWorkbook(new FileInputStream(path));
42 | // 2.获取要解析的表格(第一个表格)
43 | XSSFSheet sheet = xssfWorkbook.getSheetAt(index);
44 | // 3.在第row列写入数据
45 |
46 | for (int i = 0; i < list.size(); i++) {
47 | FileOutputStream outputStream = new FileOutputStream(path);
48 | XSSFRow xssfRow = sheet.createRow(i);
49 | XSSFCell xssfCell = xssfRow.createCell(0);
50 | xssfCell.setCellValue(l.get(i));
51 | xssfCell = xssfRow.createCell(1);
52 | xssfCell.setCellValue(list.get(i));
53 | xssfWorkbook.write(outputStream);
54 | outputStream.flush();
55 | outputStream.close();
56 | }
57 |
58 | }
59 | }
--------------------------------------------------------------------------------
/src/main/resources/data/test.txt:
--------------------------------------------------------------------------------
1 | 2017.73
2 | 1999.92
3 | 1985.43
4 | 2026.2
5 | 2055.38
6 | 2059.41
7 | 2059.21
8 | 2061.93
9 | 2037.56
10 | 2019.31
--------------------------------------------------------------------------------
/src/main/resources/images/Check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/src/main/resources/images/Check.png
--------------------------------------------------------------------------------
/src/main/resources/images/Snipaste_2020-07-15_16-23-39.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/src/main/resources/images/Snipaste_2020-07-15_16-23-39.png
--------------------------------------------------------------------------------
/src/main/resources/images/Snipaste_2020-07-15_16-23-56.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/src/main/resources/images/Snipaste_2020-07-15_16-23-56.png
--------------------------------------------------------------------------------
/src/main/resources/images/Snipaste_2020-07-15_16-41-14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/src/main/resources/images/Snipaste_2020-07-15_16-41-14.png
--------------------------------------------------------------------------------
/src/main/resources/images/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/src/main/resources/images/arrow.png
--------------------------------------------------------------------------------
/src/main/resources/images/power.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/src/main/resources/images/power.png
--------------------------------------------------------------------------------
/src/main/resources/images/set.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/src/main/resources/images/set.png
--------------------------------------------------------------------------------
/src/main/resources/images/stats.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/src/main/resources/images/stats.png
--------------------------------------------------------------------------------
/src/main/resources/images/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/src/main/resources/images/user.png
--------------------------------------------------------------------------------
/src/main/resources/images/user_login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/src/main/resources/images/user_login.png
--------------------------------------------------------------------------------
/src/test.txt:
--------------------------------------------------------------------------------
1 | 2017.73
2 | 1999.92
3 | 1985.43
4 | 2026.2
5 | 2055.38
6 | 2059.41
7 | 2059.21
8 | 2061.93
9 | 2037.56
10 | 2019.31
--------------------------------------------------------------------------------
/target/classes/data/test.txt:
--------------------------------------------------------------------------------
1 | 2017.73
2 | 1999.92
3 | 1985.43
4 | 2026.2
5 | 2055.38
6 | 2059.41
7 | 2059.21
8 | 2061.93
9 | 2037.56
10 | 2019.31
--------------------------------------------------------------------------------
/target/classes/entity/Data.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/entity/Data.class
--------------------------------------------------------------------------------
/target/classes/entity/Particle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/entity/Particle.class
--------------------------------------------------------------------------------
/target/classes/filter/CSharpParticleFilter$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/filter/CSharpParticleFilter$1.class
--------------------------------------------------------------------------------
/target/classes/filter/CSharpParticleFilter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/filter/CSharpParticleFilter.class
--------------------------------------------------------------------------------
/target/classes/filter/MyParticleFilter$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/filter/MyParticleFilter$1.class
--------------------------------------------------------------------------------
/target/classes/filter/MyParticleFilter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/filter/MyParticleFilter.class
--------------------------------------------------------------------------------
/target/classes/filter/ParticleFilter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/filter/ParticleFilter.class
--------------------------------------------------------------------------------
/target/classes/images/Check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/images/Check.png
--------------------------------------------------------------------------------
/target/classes/images/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/images/arrow.png
--------------------------------------------------------------------------------
/target/classes/images/power.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/images/power.png
--------------------------------------------------------------------------------
/target/classes/images/set.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/images/set.png
--------------------------------------------------------------------------------
/target/classes/images/stats.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/images/stats.png
--------------------------------------------------------------------------------
/target/classes/images/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/images/user.png
--------------------------------------------------------------------------------
/target/classes/images/user_login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/images/user_login.png
--------------------------------------------------------------------------------
/target/classes/lstm/AntiNormalization.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/AntiNormalization.class
--------------------------------------------------------------------------------
/target/classes/lstm/DataRead.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/DataRead.class
--------------------------------------------------------------------------------
/target/classes/lstm/LSTM.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/LSTM.class
--------------------------------------------------------------------------------
/target/classes/lstm/LSTMNode.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/LSTMNode.class
--------------------------------------------------------------------------------
/target/classes/lstm/LSTMParam.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/LSTMParam.class
--------------------------------------------------------------------------------
/target/classes/lstm/LSTMState.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/LSTMState.class
--------------------------------------------------------------------------------
/target/classes/lstm/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/Main.class
--------------------------------------------------------------------------------
/target/classes/lstm/Normalization.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/Normalization.class
--------------------------------------------------------------------------------
/target/classes/lstm/PiPi.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/PiPi.class
--------------------------------------------------------------------------------
/target/classes/lstm/Start.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/Start.class
--------------------------------------------------------------------------------
/target/classes/lstm/ToyLossLayer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/ToyLossLayer.class
--------------------------------------------------------------------------------
/target/classes/lstm/_Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/lstm/_Main.class
--------------------------------------------------------------------------------
/target/classes/sample/Controller$Calculate.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/sample/Controller$Calculate.class
--------------------------------------------------------------------------------
/target/classes/sample/Controller.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/sample/Controller.class
--------------------------------------------------------------------------------
/target/classes/sample/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/sample/Main.class
--------------------------------------------------------------------------------
/target/classes/sample/sample.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
46 |
47 |
48 |
49 |
50 |
51 |
56 |
61 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
--------------------------------------------------------------------------------
/target/classes/utils/POI.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skyrimgo/UIprediction/0aa5edfa9aac0435b7fa681182f9db903b44b5af/target/classes/utils/POI.class
--------------------------------------------------------------------------------