Fixes from DG (#74)

* Work on bug fixes in CTD classifier

* couple of final neatenings up of CTD
This commit is contained in:
Douglas Gillespie 2022-09-30 14:50:33 +01:00 committed by GitHub
parent 4015461fbc
commit 3a452936c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 4 deletions

View File

@ -36,7 +36,7 @@ public class CTClassifierParams implements Cloneable, Serializable, ManagedParam
/**
* A unique ID for the classifier that never changes. This is important for accessing data selectors.
*/
public String uniqueID = UUID.randomUUID().toString();
private String uniqueID = UUID.randomUUID().toString();
/**
@ -72,4 +72,21 @@ public class CTClassifierParams implements Cloneable, Serializable, ManagedParam
return ps;
}
/**
* @return the uniqueID
*/
public String getUniqueID() {
if (uniqueID == null) {
uniqueID = UUID.randomUUID().toString();
}
return uniqueID;
}
/**
* @param uniqueID the uniqueID to set
*/
public void setUniqueID(String uniqueID) {
this.uniqueID = uniqueID;
}
}

View File

@ -119,14 +119,13 @@ public class Chi2ThresholdClassifier implements CTClassifier {
public void createDataSelector(PamDataBlock<?> source) {
//System.out.println("Create data selector " +" " + clssfrParams.classifierName + " " + clssfrParams.speciesFlag + " " + clssfrParams.uniqueID );
if (clssfrParams.uniqueID==null) clssfrParams.newUniqueID();
if (dataSelector==null || dataSelector.getPamDataBlock()!=source) {
//create the data selector
//System.out.println("Data selector: " + dataSelector);
if (source!=null) {
dataSelector=source.getDataSelectCreator().getDataSelector(clickTrainControl.getUnitName() + "_" + clssfrParams.uniqueID
dataSelector=source.getDataSelectCreator().getDataSelector(clickTrainControl.getUnitName() + "_" + clssfrParams.getUniqueID()
+ "_X2_threshold_classifier", false, null);
}
else {

View File

@ -132,6 +132,10 @@ public class CTDataSelector extends DataSelector {
if (clickTrain.ctClassifications==null) return false;
if (ctSelectParams.classifier == null) {
return false;
}
int nClass = clickTrain.ctClassifications.size();
if (ctSelectParams.allowMultipleChoices == false) {
int clsInd = clickTrain.getClassificationIndex();

View File

@ -229,7 +229,7 @@ public class SimpleCTClassifierPane extends SettingsPane<Chi2ThresholdParams> {
simpleChi2Classifier.getDataSelector().getDialogPaneFX().getParams(true);
}
if (this.currParams != null) {
currParams.uniqueID = this.currParams.uniqueID;
currParams.setUniqueID(this.currParams.getUniqueID());
}
return this.currParams=currParams;