rfm

package module
v0.0.0-...-321f6c7 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ml-rfm

Machine Learning K-mean for generate Cluster of RFM Model

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterStat

type ClusterStat struct {
	ClusterNum   int
	Stat         *Stat
	Points       []Point `json:"point"`
	PointsCenter *Point  `json:"point_center"`
}

ClusterStat is struct for keep statistic data

type DataRaw

type DataRaw struct {
	UserID              string
	Recency             int
	PurchaseTransaction int
	Price               float64
}

DataRaw is function for keep raw RFM data

type DataRawSet

type DataRawSet struct {
	// contains filtered or unexported fields
}

DataRawSet is function for keep RFM data

func InitRawData

func InitRawData() *DataRawSet

InitRawData is function for create DataRawSet

func (*DataRawSet) AddRFMRawData

func (rd *DataRawSet) AddRFMRawData(userID string, recencyNum int, purchaseTransaction int, price float64) (*DataRawSet, error)

AddRFMRawData is function for show raw data in n (row) after skip (row)

func (*DataRawSet) GetRFMRawData

func (rd *DataRawSet) GetRFMRawData() (*DataRawSet, error)

GetRFMRawData is function for show raw data in n (row) after skip (row)

func (*DataRawSet) GetRFMRawDataByRange

func (rd *DataRawSet) GetRFMRawDataByRange(row int, skip int) (*DataRawSet, error)

GetRFMRawDataByRange is function for show raw data in n (row) after skip (row)

type Point

type Point struct {
	X     float64 `json:"x"`
	Y     float64 `json:"y"`
	Value float64 `json:"value"`
}

Point is contain data point in chart x and y should contain float64 between 0.00 to 1.00

type RFM

type RFM struct {
	ClusterSize int
	OverallStat *Stat
	Recency     *Recency
	// contains filtered or unexported fields
}

RFM is struct for contain Recency

func (*RFM) GenerateRecency

func (rfm *RFM) GenerateRecency(rd *DataRawSet) (*RFM, error)

GenerateRecency is function for process recency

func (*RFM) SetClusterSize

func (rfm *RFM) SetClusterSize(n int) (*RFM, error)

SetClusterSize is function for edit cluster size

type Recency

type Recency struct {
	ClusterSize int
	Cluster     []ClusterStat
	Stat        *Stat
}

Recency is struct for keep Recency

type Stat

type Stat struct {
	Count int     `json:"count"`
	Mean  float64 `json:"mean"`
	STD   float64 `json:"std"`
	Min   float64 `json:"min"`
	Max   float64 `json:"max"`
	P25   float64 `json:"percent_25"`
	P50   float64 `json:"percent_50"`
	P75   float64 `json:"percent_75"`
}

Stat is struct for keep statistic data

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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