Skip to content

Commit ed9321f

Browse files
authored
Merge pull request #24 from dmi3coder/feature/saveKernelTypoFix
Feature/save kernel typo fix
2 parents e999685 + a876b00 commit ed9321f

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ publishing {
2222
maven(MavenPublication) {
2323
groupId = 'de.dmi3y.behaiv'
2424
artifactId = 'behaiv'
25-
version = '0.3.9-alpha'
25+
version = '0.4.7-alpha'
2626
from components.java
2727
}
2828
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,12 @@ public void save(BehaivStorage storage) throws IOException {
114114
if (theta == null && (data == null || data.isEmpty())) {
115115
throw new IOException("Not enough data to save, network data is empty");
116116
}
117-
if (labels == null || labels.isEmpty()) {
117+
if(labels == null || labels.isEmpty()) {
118+
labels = toDistinctListOfPairValues(data);
119+
}
120+
if (labels.isEmpty()) {
118121
String message;
119-
message = "Kernel collected labels but failed to get data, couldn't save network.";
122+
message = "Kernel collected data but failed to get labels, couldn't save network.";
120123
throw new IOException(message);
121124
}
122125
if (theta == null) {

src/test/java/de/dmi3y/behaiv/kernel/LogisticRegressionKernelTest.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,6 @@ public void storeResults_saveWhenDataIsNull_expectException() throws IOException
138138
}
139139
}
140140

141-
@Test
142-
public void storeResults_saveWhenLabelsIsNull_expectException() throws IOException, ClassNotFoundException {
143-
LogisticRegressionKernel kernel = new LogisticRegressionKernel("storeTest");
144-
kernel.data = getTrainingData();
145-
try {
146-
kernel.save(storage);
147-
fail();
148-
} catch (IOException e) {
149-
assertEquals(e.getMessage(), "Kernel collected labels but failed to get data, couldn't save network.");
150-
}
151-
}
152141

153142

154143
@Test

0 commit comments

Comments
 (0)