Methods Summary |
---|
private java.util.ArrayList | getArrayList(java.util.HashMap sample)
ArrayList<StringFloat> stringfloat_sample = new ArrayList<StringFloat>();
for (Map.Entry<String, Float> x : sample.entrySet()) {
StringFloat v = new StringFloat();
v.key = x.getKey();
v.value = x.getValue();
stringfloat_sample.add(v);
}
return stringfloat_sample;
|
public boolean | reset()
if (!retrieveRanker()){
Log.e(TAG,"Exception: Ranker is not availible");
return false;
}
try {
mRanker.ResetRanker();
return true;
} catch (RemoteException e) {
}
return false;
|
public boolean | retrieveRanker()
if (mRanker == null)
mRanker = BordeauxManagerService.getRanker(mContext, mName);
// if classifier is not available, return false
if (mRanker == null) {
Log.e(TAG,"Ranker not available.");
return false;
}
return true;
|
public float | scoreSample(java.util.HashMap sample)
if (!retrieveRanker())
throw new RuntimeException(RANKER_NOTAVAILABLE);
try {
return mRanker.ScoreSample(getArrayList(sample));
} catch (RemoteException e) {
Log.e(TAG,"Exception: scoring the sample.");
throw new RuntimeException(RANKER_NOTAVAILABLE);
}
|
public boolean | setParameter(java.lang.String key, java.lang.String value)
if (!retrieveRanker())
throw new RuntimeException(RANKER_NOTAVAILABLE);
try {
return mRanker.SetModelParameter(key, value);
} catch (RemoteException e) {
Log.e(TAG,"Exception: Setting Parameter");
throw new RuntimeException(RANKER_NOTAVAILABLE);
}
|
public boolean | setPriorWeight(java.util.HashMap sample)
if (!retrieveRanker())
throw new RuntimeException(RANKER_NOTAVAILABLE);
try {
return mRanker.SetModelPriorWeight(getArrayList(sample));
} catch (RemoteException e) {
Log.e(TAG,"Exception: set prior Weights");
throw new RuntimeException(RANKER_NOTAVAILABLE);
}
|
public boolean | update(java.util.HashMap sample1, java.util.HashMap sample2)
if (!retrieveRanker())
return false;
try {
mRanker.UpdateClassifier(getArrayList(sample1), getArrayList(sample2));
} catch (RemoteException e) {
Log.e(TAG,"Exception: updateClassifier.");
return false;
}
return true;
|