import com.mindspore.flclient.model.Client
Client defines the execution process object of the end-side federated learning algorithm.
public abstract List<Callback> initCallbacks(RunType runType, DataSet dataSet)
Initialize the callback list.
Parameters
runType
: Define run phase.dataSet
: DataSet.Returns
The initialized callback list.
public abstract Map<RunType, Integer> initDataSets(Map<RunType, List<String>> files)
Initialize dataset list.
Parameters
files
: Data files.Returns
Data counts in different run type.
public abstract float getEvalAccuracy(List<Callback> evalCallbacks)
Get eval model accuracy.
Parameters
evalCallbacks
: Callback used in eval phase.Returns
The accuracy in eval phase.
public abstract List<Object> getInferResult(List<Callback> inferCallbacks)
Get infer phase result.
Parameters
inferCallbacks
: Callback used in infer phase.Returns
predict results.
public Status trainModel(int epochs)
Execute train model process.
Parameters
epochs
: Epoch num used in train process.Returns
Whether the train model is successful.
public float evalModel()
Execute eval model process.
Returns
The accuracy in eval process.
public Map<String, float[]> genUnsupervisedEvalData(List<Callback> evalCallbacks)
Generate unsupervised training evaluation data, and the subclass needs to rewrite this function.
Parameters
evalCallbacks
: the eval Callback that generates data.Returns
unsupervised training evaluation data
public List<Object> inferModel()
Execute model prediction process.
Returns
The prediction result.
public Status setLearningRate(float lr)
Set learning rate.
Parameters
lr
: Learning rate.Returns
Whether the set is successful.
public void setBatchSize(int batchSize)
Set batch size.
Parameters
batchSize
: batch size.此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。