Closed ghost closed 3 years ago
I can't help if you don't show any detail whatsoever on how you got to this point. Please read the documentation and refer to the examples. https://gplearn.readthedocs.io/
Here is a complete code to reproduce the error.
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_wine, load_diabetes
from sklearn.model_selection import train_test_split
from sklearn.metrics import cohen_kappa_score
from gplearn.genetic import SymbolicClassifier, SymbolicRegressor, SymbolicTransformer
from gplearn.functions import make_function
ds = load_diabetes()
X = ds.data
Y = ds.target
print (X.shape)
print (Y.shape)
X_train, X_test, y_train, y_test = train_test_split(X, Y,
test_size=0.25,
random_state=41652)
print (X_train.shape)
function_sets = (
'add',
'sub',
'mul',
'div',
'sqrt',
'log',
'max',
'min',
'sin',
'cos'
)
est = SymbolicTransformer(function_set=function_sets,
generations=3,
verbose=1,
n_jobs=-1,
n_components=3,
random_state=67894)
X_train = est.fit_transform(X_train, y_train)
print (X_train.shape)
print(est._program)
AttributeError: 'SymbolicTransformer' object has no attribute '_program'
I want it prints the equation to transform the data.
The transformer creates several programs in the _programs
attribute, but you can just print(est)
to see what they are
i see ! thank you so much.
AttributeError: 'SymbolicTransformer' object has no attribute '_program'
I would be really interested to obtain transformed equation. Please help.