trevorstephens / gplearn

Genetic Programming in Python, with a scikit-learn inspired API
http://gplearn.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.56k stars 274 forks source link

Allow nans in X #298

Closed apexjmr closed 4 months ago

apexjmr commented 4 months ago

I would like to enable nans in X. Is it possible to prevent this check?

apexjmr commented 4 months ago

In genetic.py, I have hard coded gplearn source to what I am hoping to have added as a parameter to gplearn:

fit:

            X, y = self._validate_data(X, y, y_numeric=True, validate_separately=(
               dict(force_all_finite=False),
               dict(force_all_finite=True, ensure_2d=False),
            ))

transform:

           X = check_array(X, force_all_finite=False)
trevorstephens commented 4 months ago

tbh i dont see a lot of demand here. allowing NaN's in X would require all functions used in the evolution to handle them and currently all will propogate NA through to fitness evaluation.