consensus

package
v0.0.0-...-4e644ab Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INF                   = 1000
	THRESHOLD             = 0.1
	DECAY_RATE            = 0.0001
	DELTA                 = 0.01
	ALPHA                 = 0.5
	K                     = 10
	TRUST_PURPOSE_ID      = 21
	SIMILARITY_PURPOSE_ID = 22
	ALIGNMENT_PURPOSE_ID  = 23
	GRADIENTS_PURPOSE_ID  = 24
	PHI_PURPOSE_ID        = 25
)
View Source
const (
	LEVELDB_ENDPOINT = "./../ldb"
	VOTE_PURPOSE_ID  = 18
)

Variables

This section is empty.

Functions

func AddContentIPFS

func AddContentIPFS(content []byte) (string, error)

func ComputeAlignmentScore

func ComputeAlignmentScore(modelID string, csMatrix [][]float64) []float64

func ComputeCS

func ComputeCS(a []float64, b []float64) float64

ComputeCS returns the cosine similarity of two vectors

func ComputeCSMatrix

func ComputeCSMatrix(modelID string) ([][]float64, error)

func ComputeClassCS

func ComputeClassCS(a [][]float64, b [][]float64) float64

func ComputeGradients

func ComputeGradients(modelID string) (map[string][][]float64, error)

func ComputePhi

func ComputePhi(algnScores []float64) []float64

func ComputeTrust

func ComputeTrust(modelID string, algnScore []float64) (map[string]float32, error)

func ConvertScoreToNumpy

func ConvertScoreToNumpy(modelID string, score interface{}, purpose uint32) (string, error)

func EvaluatePardoning

func EvaluatePardoning(modelID string, algnScore []float64, csMatrix [][]float64) ([][]float64, []float64, error)

func GetAlignmentFromNumpy

func GetAlignmentFromNumpy(path string) ([]float64, error)

func GetContentIPFS

func GetContentIPFS(path string) ([]byte, error)

func GetLatestGradients

func GetLatestGradients(modelID string) (map[string][][]float64, error)

func GetLatestRoundTimestamp

func GetLatestRoundTimestamp(modelID string) (uint32, error)

func GetLatestTrustScores

func GetLatestTrustScores(modelID string) (map[string]float32, error)

func GetLatestWeights

func GetLatestWeights(modelID string, clientPubkey string) ([][]float64, [][]float64, error)

func GetPhiFromNumpy

func GetPhiFromNumpy(path string) ([]float64, error)

func GetScoreByBlockID

func GetScoreByBlockID(blockID string) (scpb.Score, error)

func GetScorePath

func GetScorePath(modelID string, scoreType string) (*scpb.Score, error)

func GetSimilarityFromNumpy

func GetSimilarityFromNumpy(path string) ([][]float64, error)

func GetTrustFromNumpy

func GetTrustFromNumpy(path string) ([]float64, error)

func GetVote

func GetVote(blockID string) (vpb.Vote, error)

func GetWeightsFromNumpy

func GetWeightsFromNumpy(path string) ([][]float64, error)

func Initialize

func Initialize(modelID string, x int, y int) error

func PublishScore

func PublishScore(modelID string, content interface{}, purpose uint32) error

func RetrieveVote

func RetrieveVote(voteID string) (*vpb.Vote, error)

func Run

func Run(modelID string) error

func SaveVote

func SaveVote(vote vpb.Vote) error

func SendVote

func SendVote(votePayload vpb.Vote) (string, error)

func StoreGradientsIPFS

func StoreGradientsIPFS(gradients map[string][][]float64) (string, error)

func StoreLatestRoundTimestamp

func StoreLatestRoundTimestamp(modelID string, timestamp uint32) error

func StoreScoreLocally

func StoreScoreLocally(modelID string, score scpb.Score) error

func StoreScoreOnTangle

func StoreScoreOnTangle(score scpb.Score) (string, error)

Types

type Block

type Block struct {
	Purpose uint32 `json:"purpose"`
	Data    []byte `json:"data"`
}

type Gradients

type Gradients struct {
	Content map[string][][]float64
}

type Payload

type Payload struct {
	File []byte `json:"file"`
}

Jump to

Keyboard shortcuts

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