Giter Site home page Giter Site logo

Comments (3)

foolnotion avatar foolnotion commented on July 17, 2024 1

you were right, there was a bug in the python wrapper. after a model is fit, we try to apply linear scaling to bring it in the range of the target: https://github.com/heal-research/operon/blob/master/python/operon/sklearn.py#L318
however, this did not work correctly when the variance of the target was zero (y = np.ones(100)). should be fixed in e7b8326

from operon.

foolnotion avatar foolnotion commented on July 17, 2024

Hi,

You are trying to train a model on random data. It can happen that inside cross-validation, the model prediction on the test fold is NaN, infinity or too large, hence the error. My suggestion would be to just catch this exception when it happens, or implement some logic to handle the invalid values in the model prediction.

from operon.

hengzhe-zhang avatar hengzhe-zhang commented on July 17, 2024

I believe this problem is related to the implementation of this package. In fact, other machine learning algorithms, such as linear regression, can work well in this situation. For example, the following code does not work properly even if it is a rather common situation.

import numpy as np
from operon.sklearn import SymbolicRegressor
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split

X = np.random.rand(100, 5)
y = np.ones(100)
est = SymbolicRegressor(
    local_iterations=5,
    generations=10,  # just large enough since we have an evaluation budget
    n_threads=1,
    random_state=None,
    time_limit=2 * 60 * 60,  # 2 hours
    max_evaluations=int(5e5),
    population_size=10
)
# est = LinearRegression()
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
est.fit(x_train, y_train)
print(est.predict(x_test))
print(np.any(np.isnan(est.predict(x_test))))

In fact, I'm trying to replicate the experiment of the "srbench" benchmark (https://github.com/EpistasisLab/srbench/), but I find this issue will happen during the running procedure.

from operon.

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.