diff --git a/Bachelor_application.iml b/Bachelor_application.iml index e44eb08e2ddc937de337a2975eda2ef53dc4f301..f8154df5a6a0bb9048b52fc21433f278efd739cf 100644 --- a/Bachelor_application.iml +++ b/Bachelor_application.iml @@ -54,37 +54,6 @@ <orderEntry type="library" name="Maven: com.google.auto.value:auto-value-annotations:1.9" level="project" /> <orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.6.1" level="project" /> <orderEntry type="library" name="Maven: joda-time:joda-time:2.10.14" level="project" /> - <orderEntry type="library" name="Maven: org.python:jython-slim:2.7.2" level="project" /> - <orderEntry type="library" name="Maven: org.antlr:antlr:3.5.2" level="project" /> - <orderEntry type="library" name="Maven: org.antlr:ST4:4.0.8" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" /> - <orderEntry type="library" name="Maven: org.antlr:antlr-runtime:3.5.2" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.commons:commons-compress:1.19" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.62" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.bouncycastle:bcprov-jdk15on:1.62" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm:7.1" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm-commons:7.1" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm-tree:7.1" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm-analysis:7.1" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm-util:7.1" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: com.ibm.icu:icu4j:59.1" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: com.carrotsearch:java-sizeof:0.0.5" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jffi:1.2.20" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-netdb:1.1.6" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-ffi:2.1.10" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jffi:native:1.2.19" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-a64asm:1.0.0" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-x86asm:1.0.2" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-posix:3.0.50" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jnr-constants:0.9.12" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: jline:jline:2.14.5" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-buffer:4.1.45.Final" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-codec:4.1.45.Final" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-common:4.1.45.Final" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-handler:4.1.45.Final" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-resolver:4.1.45.Final" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: io.netty:netty-transport:4.1.45.Final" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.ant:ant:1.9.7" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.ant:ant-launcher:1.9.7" level="project" /> + <orderEntry type="library" name="Maven: org.jblas:jblas:1.2.4" level="project" /> </component> </module> \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6c3d1d181a6b761cddbf8b2bdfa0624b573f07ad..221d396532975bb209aa47db1d85c44ec971bf1f 100644 --- a/pom.xml +++ b/pom.xml @@ -41,9 +41,9 @@ <version>2.10.14</version> </dependency> <dependency> - <groupId>org.python</groupId> - <artifactId>jython-slim</artifactId> - <version>2.7.2</version> + <groupId>org.jblas</groupId> + <artifactId>jblas</artifactId> + <version>1.2.4</version> </dependency> </dependencies> diff --git a/src/main/java/com/application/DB/DB.java b/src/main/java/com/application/DB/DB.java index 6b14b5690907b645ed3717a4f11d01a0b26a8e31..53f86216d67dd7d5f29f94e185d59ecdbec57030 100644 --- a/src/main/java/com/application/DB/DB.java +++ b/src/main/java/com/application/DB/DB.java @@ -511,6 +511,7 @@ public class DB { formatedUtTidTorkPlussDays = addedDays.plusDays(ARJANG_NR_ADDED_DAYS).toString(); formatedUtTidTorkPlussDays = formatedUtTidTorkPlussDays.split("T")[0]; + /* if (locationID == ARJANG_LOCATION_ID) { // Sqlstatement @@ -543,8 +544,12 @@ public class DB { if(!moistureMeasured.isEmpty()){ manMoistData.put(formatedUtTidTork,moistureMeasured); } + + } + */ + diff --git a/src/main/java/com/application/GUI/LineChartFunctionality.java b/src/main/java/com/application/GUI/LineChartFunctionality.java index 0bc011d3ceabfde64ec794211be23dc89270df61..b2d08071de66da16391459605356385ad23c0904 100644 --- a/src/main/java/com/application/GUI/LineChartFunctionality.java +++ b/src/main/java/com/application/GUI/LineChartFunctionality.java @@ -9,7 +9,6 @@ import org.apache.commons.math3.distribution.TDistribution; import org.apache.commons.math3.exception.MathIllegalArgumentException; import org.apache.commons.math3.stat.descriptive.SummaryStatistics; import org.apache.commons.math3.stat.regression.SimpleRegression; -import org.python.util.PythonInterpreter; import java.util.*; @@ -117,7 +116,7 @@ public class LineChartFunctionality { index++; } //allSeries.add(newSeries); - updateLineChart(newSeries); + //updateLineChart(newSeries); //lineChart.setOpacity(1); } @@ -126,6 +125,8 @@ public class LineChartFunctionality { // Stores the data from the confidence interval in a new map Map<Integer, ArrayList<Double>> confidenceIntervalData = statistics(multiMap); + //getNonLinearRegression(confidenceIntervalData); + // Checks the max size for the arraylists needed for the data array later int jMaxSize = 0; for (int i = 0; i < confidenceIntervalData.size(); i++) { @@ -181,13 +182,12 @@ public class LineChartFunctionality { for (double[] datum : data) { + //System.out.println(""); for (double v : datum) { //System.out.println("Data: "+v); } } - PythonInterpreter pythonInterpreter = new PythonInterpreter(); - //pythonInterpreter @@ -196,9 +196,10 @@ public class LineChartFunctionality { // Connect the data to a series //System.out.println(simpleRegression.predict(i)); - regressionSeries.getData().add(new XYChart.Data<String, Number>(String.valueOf(i), simpleRegression.predict(i))); + //regressionSeries.getData().add(new XYChart.Data<String, Number>(String.valueOf(i), simpleRegression.predict(i))); + regressionSeries.getData().add(new XYChart.Data<String, Number>(String.valueOf(i), getNonLinearRegression(confidenceIntervalData,simpleRegression.getIntercept(),simpleRegression.getSlope(),i))); } - //updateLineChart(regressionSeries); + updateLineChart(regressionSeries); //lineChart.setOpacity(1); @@ -219,6 +220,36 @@ public class LineChartFunctionality { //simpleRegression.add + + return getLineChart(); } + + + public static double getNonLinearRegression(Map<Integer, ArrayList<Double>> confidenceIntervalData, double slope, double intercept, double j) { + //return Math.exp(intercept+slope*i)/(1+Math.exp(intercept+slope*i)); + + + double alpha = intercept/100; + double beta = alpha/(slope/100); + double maxYValue = 0.0; + double n = confidenceIntervalData.size(); + for (Map.Entry<Integer, ArrayList<Double>> entry : confidenceIntervalData.entrySet()) { + for (int i = 0; i < entry.getValue().size(); i++) { + if(maxYValue < entry.getValue().get(i)){ + maxYValue = entry.getValue().get(i); + } + } + } + //System.out.println("maxYValue: " + maxYValue); + //System.out.println("j*n: "+j/n); + + double p_t = ((beta*maxYValue)/(maxYValue+((beta-maxYValue)*Math.exp(-alpha*(j))))); + + System.out.println("---------------------------"); + System.out.println(p_t); + + return p_t; + + } } diff --git a/target/classes/com/application/DB/DB.class b/target/classes/com/application/DB/DB.class index dc3e7ef07457159c4cffad723fd086a463c4bef4..9d33fb5ed445c83a81f92756eb4ca1881531e601 100644 Binary files a/target/classes/com/application/DB/DB.class and b/target/classes/com/application/DB/DB.class differ diff --git a/target/classes/com/application/GUI/LineChartFunctionality.class b/target/classes/com/application/GUI/LineChartFunctionality.class index 5a32389b113ac7d683fcb180754a030be228f01d..074d021597c64fa7a2a3e9ef449d69717f744a45 100644 Binary files a/target/classes/com/application/GUI/LineChartFunctionality.class and b/target/classes/com/application/GUI/LineChartFunctionality.class differ