Skip to content

Commit 179e87e

Browse files
committed
Added nodes, refactored Kernels
1 parent 9d70d97 commit 179e87e

File tree

10 files changed

+203
-212
lines changed

10 files changed

+203
-212
lines changed

.idea/dictionaries/dmi3y.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 140 additions & 194 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/img/get_features_flow.png

204 KB
Loading

docs/img/get_prediction_flow.png

195 KB
Loading

readme.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ Predict what users want to open and take appropriate actions
1111
1. `RemoteKernel`, sends data to a API, depending on type of an API receives suggested action or receives model
1212
1. Set threshold after which Behaiv can start suggesting
1313
1. Register each view that can be tracked and opened by implementing interfaces
14-
1. `Actionable` is a type of view that can be opened by *Behaiv*
15-
1. `Routable` is a type of View that only cannot be opened but only route into next Views
16-
1. `Conditionable` is a type of View which will perform additional actions before proceeding
14+
1. `InitiableNode` is a type of view that can initiate capturing of features
15+
1. `ActionableNode` is a type of view that can be opened by *Behaiv*, as well as capture labels
16+
1. `RoutableNode` is a type of View that only cannot be opened but only route into next Views
17+
1. `ConditionableNode` is a type of View which will perform additional actions before proceeding
1718
1. Provide external factors sich as GPS, Wifi/Bluetooth and headphons info.
1819
1. Use `GeoProvider` for adding GPS feature into prediction
1920
1. Use `NetworkProvider` for adding Wifi, Bluetooth and Network features into prediction

src/main/java/de/dmi3y/behaiv/Behaiv.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,29 @@
33
*/
44
package de.dmi3y.behaiv;
55

6+
import de.dmi3y.behaiv.kernel.Kernel;
7+
68
public class Behaiv {
7-
public boolean someLibraryMethod() {
8-
return true;
9+
10+
private Kernel kernel;
11+
12+
private Behaiv() {
13+
14+
}
15+
16+
public synchronized static Behaiv with(Kernel kernel) {
17+
Behaiv behaiv = new Behaiv();
18+
behaiv.setKernel(kernel);
19+
return behaiv;
20+
21+
}
22+
23+
public Behaiv setKernel(Kernel kernel){
24+
this.kernel = kernel;
25+
return this;
26+
}
27+
28+
public Behaiv setBehaivNode() {
29+
return this;
930
}
1031
}

src/main/java/de/dmi3y/behaiv/kernel/DummyKernel.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@
77

88
public class DummyKernel extends Kernel {
99

10-
private ArrayList<Pair<ArrayList<Double>, String>> data;
11-
12-
@Override
13-
public void fit(ArrayList<Pair<ArrayList<Double>, String>> data) {
14-
this.data = data;
15-
}
16-
17-
@Override
18-
public void update(ArrayList<Pair<ArrayList<Double>, String>> data) {
19-
}
20-
2110
@Override
2211
public String predictOne(ArrayList<Double> features) {
2312

src/main/java/de/dmi3y/behaiv/kernel/Kernel.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,24 @@
66

77
public abstract class Kernel {
88

9-
public abstract void fit(ArrayList<Pair<ArrayList<Double>, String>> data);
9+
private Long treshold = 10L;
1010

11-
public abstract void update(ArrayList<Pair<ArrayList<Double>, String>> data);
11+
protected ArrayList<Pair<ArrayList<Double>, String>> data;
12+
13+
public void fit(ArrayList<Pair<ArrayList<Double>, String>> data) {
14+
this.data = data;
15+
}
16+
17+
public void setTreshold(Long treshold) {
18+
this.treshold = treshold;
19+
}
20+
21+
public boolean readyToPredict() {
22+
return data.size() > treshold;
23+
}
24+
25+
public void update(ArrayList<Pair<ArrayList<Double>, String>> data) {
26+
}
1227

1328
public abstract String predictOne(ArrayList<Double> features);
1429
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package de.dmi3y.behaiv.node;
2+
3+
import de.dmi3y.behaiv.Behaiv;
4+
5+
public interface ActionableNode {
6+
void register(Behaiv behaiv);
7+
void captureResult(Behaiv behaiv);
8+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package de.dmi3y.behaiv.node;
2+
3+
public interface BehaivNode {
4+
}

0 commit comments

Comments
 (0)