Giter Site home page Giter Site logo

Comments (15)

ShuhuaGao avatar ShuhuaGao commented on June 15, 2024

I haven't try that yet. However, I think it can be done similarly once you have set up the proper primitive set (terminals + functions). Just be sure that your function node can operate normally on all the possible inputs and intermediate values.

For example, if your input is a tensor, then the ADD function should also be tensor version, that can accept two tensors, or one tensor plus one scalar. I guess general libraries like PyTorch has support for that already. If not, you need to implement your own ADD function by checking the actual parameter types internally.

from geppy.

waynezw0618 avatar waynezw0618 commented on June 15, 2024

Hi Thanks for replying.
where I can find the list of the function? I'd like to know if there is dot, cross, these operator for the tensor?

from geppy.

waynezw0618 avatar waynezw0618 commented on June 15, 2024

Besides, I meet the error message during the installation. it says :
....
deap/tools/_hypervolume/hv.cpp:24:10: fatal error: 'cstdlib' file not found
#include
^~~~~~~~~
...
I am trying to install geppy in my MacBook Pro with python2.7

from geppy.

bolzzzz avatar bolzzzz commented on June 15, 2024

Hi Thanks for replying.
where I can find the list of the function? I'd like to know if there is dot, cross, these operator for the tensor?

Hi, I think you can find these in PyTorch's document. For example: dot operation: https://pytorch.org/docs/stable/torch.html#torch.dot, cross: https://pytorch.org/docs/stable/torch.html#torch.cross

from geppy.

bolzzzz avatar bolzzzz commented on June 15, 2024

Besides, I meet the error message during the installation. it says :
....
deap/tools/_hypervolume/hv.cpp:24:10: fatal error: 'cstdlib' file not found
#include
^~~~~~~~~
...
I am trying to install geppy in my MacBook Pro with python2.7

looks like it's about deap. You may try pip install deap to manually install deap first

from geppy.

ShuhuaGao avatar ShuhuaGao commented on June 15, 2024

Thanks for your help @bolz213 .

@waynezw0618 :
I am afraid you have misunderstood the function concept in geppy. This package geppy only defines a function wrapper essentially, which requires a true function that can do the work and the number of arguments needed by this function. That is, you can provide it with any function you like. Please check the examples for some inspiration.

from geppy.

waynezw0618 avatar waynezw0618 commented on June 15, 2024

@bolz213 @ShuhuaGao thanks for both
I did not notice that I have to install deep manually before geppy(as I suppose it will automatically install the dependency). but now I manually reinstall deap. and later rebuild and install geppy. still have problem to use geppy properly. here is the error message:

import geppy
Traceback (most recent call last):
File "", line 1, in
File "geppy/init.py", line 37, in
from .core.entity import *
File "geppy/core/entity.py", line 415
nonlocal n_rnc
^
SyntaxError: invalid syntax

from geppy.

bolzzzz avatar bolzzzz commented on June 15, 2024

from geppy.

bolzzzz avatar bolzzzz commented on June 15, 2024

@bolz213 @ShuhuaGao thanks for both
I did not notice that I have to install deep manually before geppy(as I suppose it will automatically install the dependency). but now I manually reinstall deap. and later rebuild and install geppy. still have problem to use geppy properly. here is the error message:

import geppy
Traceback (most recent call last):
File "", line 1, in
File "geppy/init.py", line 37, in
from .core.entity import *
File "geppy/core/entity.py", line 415
nonlocal n_rnc
^
SyntaxError: invalid syntax

Hi the author of geppy documents that it requires python3.5 and afterwards. See the "Requirements" in the readme

from geppy.

waynezw0618 avatar waynezw0618 commented on June 15, 2024

@bolz213 thanks, that works now!

from geppy.

waynezw0618 avatar waynezw0618 commented on June 15, 2024

@ShuhuaGao @bolz213
Sorry again seems my installation is not stable. I have installed geppy on MacBook with Mac OS 14.0
I have installed python3.7 manually with numpy-1.16.2,graphviz-0.10.1,sympy-1.4.
as mentioned before, geppy works after installation.
and now the problems, I works only after I install geppy. Once I quit python. I can't even import geppy properly. see below:

[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import geppy
Traceback (most recent call last):
File "", line 1, in
File "geppy/init.py", line 37, in
from .core.entity import *
File "geppy/core/entity.py", line 415
nonlocal n_rnc
^

from geppy.

bolzzzz avatar bolzzzz commented on June 15, 2024

@ShuhuaGao @bolz213
Sorry again seems my installation is not stable. I have installed geppy on MacBook with Mac OS 14.0
I have installed python3.7 manually with numpy-1.16.2,graphviz-0.10.1,sympy-1.4.
as mentioned before, geppy works after installation.
and now the problems, I works only after I install geppy. Once I quit python. I can't even import geppy properly. see below:

[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import geppy
Traceback (most recent call last):
File "", line 1, in
File "geppy/init.py", line 37, in
from .core.entity import *
File "geppy/core/entity.py", line 415
nonlocal n_rnc
^

It's still about the python version. Could you try "python --version" and see its version?

In addition, for convenience of trying something, I recommend you to use conda and create an environment which is isolated and you can try anything inside it. The cool thing is that in this isolated environment you can install packages of certain versions and won't affect other environments.

from geppy.

bolzzzz avatar bolzzzz commented on June 15, 2024

@ShuhuaGao @bolz213
Sorry again seems my installation is not stable. I have installed geppy on MacBook with Mac OS 14.0
I have installed python3.7 manually with numpy-1.16.2,graphviz-0.10.1,sympy-1.4.
as mentioned before, geppy works after installation.
and now the problems, I works only after I install geppy. Once I quit python. I can't even import geppy properly. see below:

[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import geppy
Traceback (most recent call last):
File "", line 1, in
File "geppy/init.py", line 37, in
from .core.entity import *
File "geppy/core/entity.py", line 415
nonlocal n_rnc
^

The default python version of Mac 14.0 seems python2. You may need to use python3 to invoke python3 (and maybe you need use pip3 install ... to install geppy for python3). Or a better way is to use conda environment.

from geppy.

ShuhuaGao avatar ShuhuaGao commented on June 15, 2024

@waynezw0618 I guess you are new to Python. Apart from using an environment manager, as said by @bolz213 , you can set the default Python to the 3.7 version. See this stackoverflow How to set Python's default version to 3.x on OS X?.

from geppy.

waynezw0618 avatar waynezw0618 commented on June 15, 2024

Hello Again @ShuhuaGao @bolz213

I am trying geppy to fit N 3X3 tensor Bij with two scalar list I1,I2 of size N and two 3X3 tensor list V1,V2 with fitness defined as tensorDot(Bij, PBij)/(tensordot(Bij,Bji)*tensordot(PBij, PBji)). but I get errors in my evaluation function like this:
[[ATraceback (most recent call last):
File "testGEPPY_DNS.py", line 109, in
stats=stats, hall_of_fame=hof, verbose=True)
File "/Users/weizhang/software/backup/geppy-master/geppy/algorithms/basic.py", line 100, in gep_simple
for ind, fit in zip(invalid_individuals, fitnesses):
File "testGEPPY_DNS.py", line 71, in evaluate
Rp_i=np.array([[Yp[i,1],Yp[i,2],Yp[i,3]],[Yp[i,2],Yp[i,4],Yp[i,5]],[Yp[i,3],Yp[i,5],Yp[i,:6]]])
IndexError: too many indices for array

here is my evaluation function:
`
def evaluate(individual):
"""Evalute the fitness of an individual: MSE (mean squared error)"""
func = toolbox.compile(individual)
Yp = np.array(list(map(func,T1,T2,T3))) # predictions with the GEP model

#print (np.shape(Yp),Yp)
a=0
b=0
c=0
for i in range(size):
   Ri=np.array([[bij[i,1],bij[i,2],bij[i,3]],[bij[i,2],bij[i,4],bij[i,5]],[bij[i,3],bij[i,5],bij[i,6]]])
   Rp_i=np.array([[Yp[i,1],Yp[i,2],Yp[i,3]],[Yp[i,2],Yp[i,4],Yp[i,5]],[Yp[i,3],Yp[i,5],Yp[i,6]]])
#   print (Ri,np.shape(Ri))
   a=a+np.tensordot(Rp_i,Ri)
   b=a+np.tensordot(Ri,Ri.T) 
   c=c+np.tensordot(Rp_i,Rp_i.T) 

return a/(b*c),

`
I tried to print the PB, seems give me a array of(N,1) rather than expected (N,3,3)
can you please give me some suggestion

from geppy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.