cavalab / ellyn

python-wrapped version of ellen, a linear genetic programming system for symbolic regression and classification.
http://cavalab.org/ellyn
Other
54 stars 11 forks source link

Regression parameter problem #17

Open wangsy15 opened 1 year ago

wangsy15 commented 1 year ago

Thank you for providing Python code, great work! I am a beginner, and I attempted to reproduce the Background Inspiration system using the d_bacres1. txt and d_bacres2. txt files you provided, but failed. My code is attached below. I found that there are many parameters that can be set in ellyn(). Which are necessary? How can I determine the range of these parameters? At the same time, I found that the results of each run are random. Is there a way to fix the output results? Looking forward to your reply, thank you!

from ellyn import ellyn
import numpy as np
import  pandas  as pd

df = pd.DataFrame()
#with open("D:\software\software\\anaconda3\envs\ellyn-master\data\\d_bacres1.txt") as file:
with open("d_bacres1.txt") as file:
    for item in file:
        data = np.array(list(map(float,item.split(',')))).reshape((3, 1)).T
        #print(item)
        data1 = pd.DataFrame(data)
        #df = df.append(data1,ignore_index=True)
        df = pd.concat([df, data1], ignore_index=True)
df1 = pd.DataFrame() #创建一个空的dataframe
#with open("D:\software\software\\anaconda3\envs\ellyn-master\data\\d_bacres2.txt") as file:
with open("d_bacres2.txt") as file:
    for item in file:
        data = np.array(list(map(float,item.split(',')))).reshape((3, 1)).T
        #print(item)
        data1 = pd.DataFrame(data)
        #df = df.append(data1,ignore_index=True)
        df1 = pd.concat([df1, data1], ignore_index=True)

inpu = df.iloc[:,1:3].values 
oupu = df.iloc[:,0].values

learner = ellyn(g=100, popsize=100, selection = 'tournament',tourn_size=4,cross_ar=0.8,mut_ar=0.2,verbosity=1,op_list=['n','v','+','-','*','/'])
learner.fit(inpu, oupu)