/
peerTasks.go
55 lines (46 loc) · 1.28 KB
/
peerTasks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package DAG
import (
"errors"
"github.com/EternallyAscend/GoToolkits/pkg/command"
)
func ExecuteCommandString(str string) *command.Result {
cmd := command.GenerateCommand(str)
if nil == cmd {
return command.GenerateErrorResult(errors.New("Wrong command. "))
}
return ExecuteCommandWithArgs(cmd)
}
func ExecuteCommandWithArgs(command *command.Command) *command.Result {
return command.Execute()
}
// readGradient TODO Read from File or Transfer between Processes.
func (that *Peer) readGradient(path string) []float64 {
return []float64{}
}
func (that *Peer) aggregateGradient() *Peer {
// TODO Accumulative to Threshold. Max Circle, Max Time or Gradient Size.
return that
}
func (that *Peer) ReleaseModel() *Peer {
// TODO Calculate Timestamp 'Start'.
// TODO HE Calculate.
// TODO Calculate Timestamp 'End'.
// TODO Broadcast via TCP.
// TODO 1.Send Id, 2. Confirm Not Reached, 3. Transfer.
return that
}
func (that *Peer) receiveModel() *Peer {
// TODO Calculate Timestamp 'Start'.
// TODO HE Verify.
// TODO Calculate Timestamp 'End'.
return that
}
func (that *Peer) verifyModel() *Peer {
// TODO Communicate between Processes.
return that
}
// Try Train with Test Data and Get Result.
func (that *Peer) Try() {
// TODO Communicate between Processes.
that.verifyModel()
}