mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 06:18:12 +00:00
Switched back BEAR AWAY + HEAD UP grouping as OTHER maneuver type for
classification + bugfixed boat class filtering for classifier training
This commit is contained in:
1 parent
10f7da1183
commit
12842c7d55
3 files changed
+25
-10
No files matched your search
+17
-4
@@ -1,16 +1,29 @@
|
||||
package com.sap.sailing.windestimation.model.classifier.maneuver;
|
||||
|
||||
import com.sap.sailing.windestimation.data.ManeuverForEstimation;
|
||||
import com.sap.sailing.windestimation.data.ManeuverTypeForClassification;
|
||||
import com.sap.sailing.windestimation.model.classifier.ClassifierScoring;
|
||||
import com.sap.sailing.windestimation.model.classifier.TrainableClassificationModel;
|
||||
import com.sap.sailing.windestimation.model.classifier.maneuver.ManeuverClassifierModelMetadata;
|
||||
|
||||
public class ManeuverClassifierScoring extends ClassifierScoring<ManeuverForEstimation, ManeuverClassifierModelMetadata> {
|
||||
public class ManeuverClassifierScoring
|
||||
extends ClassifierScoring<ManeuverForEstimation, ManeuverClassifierModelMetadata> {
|
||||
|
||||
public ManeuverClassifierScoring(
|
||||
TrainableClassificationModel<ManeuverForEstimation, ManeuverClassifierModelMetadata> trainedClassifierModel) {
|
||||
super(trainedClassifierModel, i -> trainedClassifierModel.getContextSpecificModelMetadata()
|
||||
.getManeuverTypeByMappingIndex(i).toString());
|
||||
super(trainedClassifierModel, i -> {
|
||||
ManeuverClassifierModelMetadata modelMetadata = trainedClassifierModel.getContextSpecificModelMetadata();
|
||||
ManeuverTypeForClassification maneuverType = trainedClassifierModel.getContextSpecificModelMetadata()
|
||||
.getManeuverTypeByMappingIndex(i);
|
||||
if (modelMetadata.getOtherTypes() <= 1) {
|
||||
return maneuverType.toString();
|
||||
}
|
||||
int otherTypesBeginFromOrdinal = ManeuverTypeForClassification.values().length
|
||||
- modelMetadata.getOtherTypes();
|
||||
if (maneuverType.ordinal() < otherTypesBeginFromOrdinal) {
|
||||
return maneuverType.toString();
|
||||
}
|
||||
return "Other";
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+1
-2
@@ -15,8 +15,7 @@ public class ManeuverClassifierModelFactory
|
||||
implements ClassifierModelFactory<ManeuverForEstimation, ManeuverClassifierModelMetadata> {
|
||||
|
||||
public static final ManeuverTypeForClassification[] orderedSupportedTargetValues = {
|
||||
ManeuverTypeForClassification.TACK, ManeuverTypeForClassification.JIBE,
|
||||
ManeuverTypeForClassification.HEAD_UP, ManeuverTypeForClassification.BEAR_AWAY };
|
||||
ManeuverTypeForClassification.TACK, ManeuverTypeForClassification.JIBE };
|
||||
|
||||
@Override
|
||||
public TrainableClassificationModel<ManeuverForEstimation, ManeuverClassifierModelMetadata> getNewModel(
|
||||
|
||||
+7
-4
@@ -119,6 +119,10 @@ public class ManeuverClassifierModelMetadata extends ContextSpecificModelMetadat
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getOtherTypes() {
|
||||
return otherTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getX(ManeuverForEstimation maneuver) {
|
||||
@@ -168,11 +172,10 @@ public class ManeuverClassifierModelMetadata extends ContextSpecificModelMetadat
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (maneuverFeatures.isMarksInformation()) {
|
||||
return maneuver.isMarkPassingDataAvailable();
|
||||
if (maneuverFeatures.isMarksInformation() && !maneuver.isMarkPassingDataAvailable()) {
|
||||
return false;
|
||||
}
|
||||
if (boatClass != null && (maneuver.getBoatClass() == null
|
||||
|| !boatClass.getName().equals(maneuver.getBoatClass().getName()))) {
|
||||
if (boatClass != null && !boatClass.equals(maneuver.getBoatClass())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user