Methods Summary |
---|
public void | ResetRanker()
if (mLearningSlRanker == null)
mLearningSlRanker = new StochasticLinearRankerWithPrior();
mLearningSlRanker.resetRanker();
|
public float | ScoreSample(java.util.List sample)
ArrayList<StringFloat> temp = (ArrayList<StringFloat>)sample;
String[] keys = new String[temp.size()];
float[] values = new float[temp.size()];
for (int i = 0; i < temp.size(); i++){
keys[i] = temp.get(i).key;
values[i] = temp.get(i).value;
}
if (mLearningSlRanker == null)
mLearningSlRanker = new StochasticLinearRankerWithPrior();
return mLearningSlRanker.scoreSample(keys,values);
|
public boolean | SetModelParameter(java.lang.String key, java.lang.String value)
if (mLearningSlRanker == null)
mLearningSlRanker = new StochasticLinearRankerWithPrior();
return mLearningSlRanker.setModelParameter(key,value);
|
public boolean | SetModelPriorWeight(java.util.List sample)
ArrayList<StringFloat> temp = (ArrayList<StringFloat>)sample;
HashMap<String, Float> weights = new HashMap<String, Float>();
for (int i = 0; i < temp.size(); i++)
weights.put(temp.get(i).key, temp.get(i).value);
if (mLearningSlRanker == null)
mLearningSlRanker = new StochasticLinearRankerWithPrior();
return mLearningSlRanker.setModelPriorWeights(weights);
|
public boolean | UpdateClassifier(java.util.List sample_1, java.util.List sample_2)
ArrayList<StringFloat> temp_1 = (ArrayList<StringFloat>)sample_1;
String[] keys_1 = new String[temp_1.size()];
float[] values_1 = new float[temp_1.size()];
for (int i = 0; i < temp_1.size(); i++){
keys_1[i] = temp_1.get(i).key;
values_1[i] = temp_1.get(i).value;
}
ArrayList<StringFloat> temp_2 = (ArrayList<StringFloat>)sample_2;
String[] keys_2 = new String[temp_2.size()];
float[] values_2 = new float[temp_2.size()];
for (int i = 0; i < temp_2.size(); i++){
keys_2[i] = temp_2.get(i).key;
values_2[i] = temp_2.get(i).value;
}
if (mLearningSlRanker == null)
mLearningSlRanker = new StochasticLinearRankerWithPrior();
boolean res = mLearningSlRanker.updateClassifier(keys_1,values_1,keys_2,values_2);
if (res && modelChangeCallback != null) {
modelChangeCallback.modelChanged(this);
}
return res;
|
public android.os.IBinder | getBinder()
return this;
|
public byte[] | getModel()
if (mLearningSlRanker == null)
mLearningSlRanker = new StochasticLinearRankerWithPrior();
StochasticLinearRankerWithPrior.Model model = mLearningSlRanker.getModel();
try {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
ObjectOutputStream objStream = new ObjectOutputStream(byteStream);
objStream.writeObject(model);
//return byteStream.toByteArray();
byte[] bytes = byteStream.toByteArray();
return bytes;
} catch (IOException e) {
throw new RuntimeException("Can't get model");
}
|
public boolean | setModel(byte[] modelData)
try {
ByteArrayInputStream input = new ByteArrayInputStream(modelData);
ObjectInputStream objStream = new ObjectInputStream(input);
StochasticLinearRankerWithPrior.Model model =
(StochasticLinearRankerWithPrior.Model) objStream.readObject();
if (mLearningSlRanker == null)
mLearningSlRanker = new StochasticLinearRankerWithPrior();
boolean res = mLearningSlRanker.loadModel(model);
return res;
} catch (IOException e) {
throw new RuntimeException("Can't load model");
} catch (ClassNotFoundException e) {
throw new RuntimeException("Learning class not found");
}
|
public void | setModelChangeCallback(android.bordeaux.services.IBordeauxLearner.ModelChangeCallback callback)
modelChangeCallback = callback;
|