models

package
Version: v3.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: MIT Imports: 5 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NChooseK

func NChooseK(n float64, k float64) float64

Types

type AlgorithmPrediction

type AlgorithmPrediction struct {
	Locations     []string  `json:"locations"`
	Name          string    `json:"name"`
	Probabilities []float64 `json:"probabilities"`
}

type BinaryStats

type BinaryStats struct {
	TruePositives  int `json:"true_positives"`
	FalsePositives int `json:"false_positives"`
	TrueNegatives  int `json:"true_negatives"`
	FalseNegatives int `json:"false_negatives"`

	// Sensitivity or true positive rate
	Sensitivity float64 `json:"sensitivity"`
	// Specificity or true negative rate
	Specificity float64 `json:"specificity"`
	// Informedness (TPR + SPC - 1)
	Informedness float64 `json:"informedness"`
	// Martthews Correlation coefficient
	MCC float64 `json:"mcc"`
	// Fisher's P test
	FisherP float64 `json:"fisher_p"`
}

BinaryStats is a structure that derives the following metrics https://en.wikipedia.org/wiki/Sensitivity_and_specificity

func NewBinaryStats

func NewBinaryStats(tp, fp, tn, fn int) BinaryStats

NewBinaryStats returns a binary stats object

type ByLocation

type ByLocation struct {
	Devices  []ByLocationDevice `json:"devices"`
	Location string             `json:"location"`
	Total    int                `json:"total"`
}

type ByLocationDevice

type ByLocationDevice struct {
	Device      string    `json:"device"`
	Vendor      string    `json:"vendor,omitempty"`
	Timestamp   time.Time `json:"timestamp"`
	Probability float64   `json:"probability"`
	Randomized  bool      `json:"randomized"`
	NumScanners int       `json:"num_scanners"`
	ActiveMins  int       `json:"active_mins"`
	FirstSeen   time.Time `json:"first_seen"`
}

type FINDFingerprint

type FINDFingerprint struct {
	Group           string   `json:"group"`
	Username        string   `json:"username"`
	Location        string   `json:"location"`
	Timestamp       int64    `json:"timestamp"`
	WifiFingerprint []Router `json:"wifi-fingerprint"`
}

FINDFingerprint is the prototypical information from the fingerprinting device

func (FINDFingerprint) Convert

func (f FINDFingerprint) Convert() (d SensorData)

Convert will convert a FINDFingerprint into the new type of data, for backwards compatibility with FIND.

type GPS

type GPS struct {
	Latitude  float64 `json:"lat,omitempty"`
	Longitude float64 `json:"lon,omitempty"`
	Altitude  float64 `json:"alt,omitempty"`
}

GPS contains GPS data

type LocationAnalysis

type LocationAnalysis struct {
	IsUnknown     bool                  `json:"is_unknown,omitempty"`
	LocationNames map[string]string     `json:"location_names"`
	Predictions   []AlgorithmPrediction `json:"predictions"`
	Guesses       []LocationPrediction  `json:"guesses,omitempty"`
}

type LocationPrediction

type LocationPrediction struct {
	Location    string  `json:"location,omitempty"`
	Probability float64 `json:"probability,omitempty"`
}

type ReverseRollingData

type ReverseRollingData struct {
	HasData        bool
	Family         string
	Datas          []SensorData
	Timestamp      time.Time
	TimeBlock      time.Duration
	MinimumPassive int
	DeviceLocation map[string]string // Device -> Location for learning
	DeviceGPS      map[string]GPS    // Device -> GPS for learning
}

type Router

type Router struct {
	Mac  string `json:"mac"`
	Rssi int    `json:"rssi"`
}

Router is the router information for each invdividual mac address

type SensorData

type SensorData struct {
	// Timestamp is the unique identifier, the time in milliseconds
	Timestamp int64 `json:"t"`
	// Family is a group of devices
	Family string `json:"f"`
	// Device are unique within a family
	Device string `json:"d"`
	// Location is optional, used for classification
	Location string `json:"l,omitempty"`
	// Sensors contains a map of map of sensor data
	Sensors map[string]map[string]interface{} `json:"s"`
	// GPS is optional
	GPS GPS `json:"gps,omitempty"`
}

SensorData is the typical data structure for storing sensor data.

func (*SensorData) Validate

func (d *SensorData) Validate() (err error)

Validate will validate that the fingerprint is okay

Jump to

Keyboard shortcuts

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