gep

package
v0.0.0-...-be03e2a Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Open     = true
	Close    = false
	Detailed = 0
	Simple   = 1
	Simplest = 2
)
 A R I M A : 差 分 整 合 移 动 自 回 归
 时间序列预测:
	 //1.改进的适应度函数<拟合程度参与适应度函数计算>
	 //2.误差分析函数
	 //3.预测新的一组数据集
	 4.避免早熟收敛
		I.  增大变异率
		II. 增大种群数量
		III.在进化一定阶段时引入新个体<种群年龄分层>

Variables

View Source
var Chart = Close

开启遗传记录图表

View Source
var ChartInterval = 0

图表记录跨度 0为每次变异记录

View Source
var ChartPort = 8081

图表端口

View Source
var CsvSampleFileName = "sunspots_sample.csv"
运行参数配置

CSV样本集文件名称(请放置于根目录下) var CsvSampleFileName = "vegetables_sample.csv"

View Source
var DcMutationRate = 0.0385

直接变异率 0.144 0.0385

View Source
var DynamicDcMutation = Open
高阶GEP参数配置

自适应变异率开关

View Source
var DynamicDcMutationRate = 1.0

自适应变异率基数

View Source
var EliteNum = 0

精英策略个数

View Source
var FitnessFunc = 0

适应度函数选择

View Source
var FunSet = []byte{'+', '-', '*', '/', '@'} //,'@','$','N','Q'

函数集

View Source
var GeneLength = HeadLength + TailLength

基因长度

View Source
var GeneTranspositionRate = 0.1

转座概率

View Source
var HeadLength = 7
GEP参数配置

头部长度 7 6 简单/a3

View Source
var ISElementsLength = 3

插入转座元素长度

View Source
var ISTranspositionRate = 0.1

插入转座率

View Source
var LinkFun = byte('+')

连接函数

View Source
var MaxFactorNum = GetMaxFactorNum()

最大操作数(参数个数)

View Source
var MaxFitness float64 = 0
View Source
var MaxGenerations = 8000

最高运行代数 0 - 不限制

View Source
var MoreFunc = Close

开启生成时函数符比例增多

View Source
var NonEliteNum = 2

不变异精英策略个数

View Source
var NumOfGenes = 4

染色体含有基因数 3 4

View Source
var OnePointRecombinationRate = 0.3

单点重组率 0.4 0.3

View Source
var PopulationsSize = 100

基因产生个数 20 30

View Source
var Precision float64 = 0

选择精度

View Source
var R = rand.New(rand.NewSource(time.Now().UnixNano()))
View Source
var RISElementsLength = 3

根转座元素长度

View Source
var RISTranspositionRate = 0.1

根转座率

View Source
var RecombinationRate = 0.1

重组率

View Source
var ResultRang = 0.0

选择结果

View Source
var ResultSampleAvg = 0.0

样本结果平均数

View Source
var SelectRang float64 = 1000

选择范围

View Source
var TailLength = HeadLength*(MaxFactorNum-1) + 1

基因尾部长度

View Source
var TenCheck = Open

开启 10*10 交叉检验

View Source
var TermSet = TermSetAll

终点集

View Source
var TermSetAll = []byte{
	'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
	'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}

转盘赌个数

View Source
var TwoPointRecombinationRate = 0.3

双点重组率 0.2 0.3

View Source
var ViewStyle = Simplest

控制台输出方式 Detailed - 详细,Simple - 简略,Simplest - 最简略

Functions

func CalculateFitnessOpt

func CalculateFitnessOpt(genes []*Gene)

计算种群适应度

func GetEffectGene

func GetEffectGene(s []byte) []byte

将基因缩短为有效长度

func GetEffectGenes

func GetEffectGenes(gene Gene) (k [][]byte)

获得个体最简表达式

func GetInfixExpression

func GetInfixExpression(s []byte) []byte

获得单个基因中缀表达式

func GetInfixExpressions

func GetInfixExpressions(gene Gene) (k [][]byte)

获得个体中缀表达式

func GetMaxFactorNum

func GetMaxFactorNum() int

获得函数集最大参数个数

func GetOperationFactorNum

func GetOperationFactorNum(operationName byte) int

获得函数参数个数

func GetPredictSampleResult

func GetPredictSampleResult(easyEquation [][]byte) []float64

func GetPredictTestResult

func GetPredictTestResult(easyEquation [][]byte) []float64

func GetSampleDataNum

func GetSampleDataNum() int

func GetSampleResult

func GetSampleResult() []float64

func GetSampleResultAvg

func GetSampleResultAvg() float64

func GetTestDataNum

func GetTestDataNum() int

func GetTestResult

func GetTestResult() []float64

func GetVarSetNum

func GetVarSetNum() int

func InitSampleData

func InitSampleData()

func PrintGreat

func PrintGreat(g *Gene)

func PrintMostEasy

func PrintMostEasy(genes []*Gene)

显示最大适应度

func PrintSelf

func PrintSelf(genes []*Gene)

显示自己

func PrintSelfEasy

func PrintSelfEasy(genes []*Gene)

显示最大适应度

Types

type Data

type Data struct {
	TermVarSet []float64
	Result     float64
}

func ReadSampleData

func ReadSampleData() []Data

func ReadTestData

func ReadTestData() []Data

type Gene

type Gene struct {
	Gene            []byte   //基因序列
	InfixExpression [][]byte //中缀表达式
	Fitness         float64  //适应度
	Generation      int      //代数
}

func Change

func Change(gene *Gene, genes []*Gene) *Gene

func CreateGenes

func CreateGenes() []*Gene

随机创建种群

func Elite

func Elite(genes []*Gene, num int, sons []*Gene) []*Gene

精英策略

func EliteNone

func EliteNone(genes []*Gene, num int, sons []*Gene) []*Gene

不变异精英策略

func Evolution

func Evolution(dads []*Gene) []*Gene

个体遗传

func Select

func Select(genes []*Gene, sons []*Gene) []*Gene

选择函数

func Turn

func Turn(genes []*Gene, num int, sons []*Gene) []*Gene

转盘赌

Jump to

Keyboard shortcuts

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