client

package
v0.0.0-...-a5060f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Task       = "femnist"
	Attack     = "None" //laber flipping attack
	K          = 5      //local training step
	B          = 64     //batch size
	Beta       = 0.9
	Lr         = 0.1 //client learning rate
	Slr        = 1.0 //server learning rate
	Round      = 50
	M          = 20  //the number of participants in each round
	Cm         = 0.0 //the fraction of malicious clients existed per round
	Rank       = 2   //the rank of the compressed matrix
	ClientsNum = 50
)

Functions

func CreateClients

func CreateClients(attack string) ([]*Client, []*Client, *python3.PyObject, *python3.PyObject, *python3.PyObject, [][]int, []int, [][]float64, [][]float64)

Returns: (clients, test_dataset, unlabeled_dataset, task_model)

Types

type Client

type Client struct {
	ID        int //the id of client
	PublicKey rsa.PublicKey

	Round             int //the current training round
	LocalModelUpdates [][]float64
	// contains filtered or unexported fields
}

FL client

func (*Client) Attack

func (c *Client) Attack(global_model [][]float64, global_r int, K int, B int)

Attacker launch attack: Args: - global_model: the global params of last round - K: the local training step - B: the batch size

func (*Client) GetGlobalModel

func (c *Client) GetGlobalModel(nodes []*node.Node) ([][]float64, int)

Client 'download' global model from a nearest node (randomly picked)

func (*Client) SendUpdates

func (c *Client) SendUpdates(nodes []*node.Node, round int, conn *rpc.Client)

Client 'send' updates to a randomly choosed edge node

func (*Client) Sign

func (c *Client) Sign(modelUpdate [][]float64) []byte

func (*Client) Train

func (c *Client) Train(global_model [][]float64, global_r int, K int, B int)

Client local training: Args: - global_model: the global params of last round - K: the local training step - B: the batch size

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL