gkhayes / mlrose

Python package for implementing a number of Machine Learning, Randomized Optimization and SEarch algorithms.
https://mlrose.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
237 stars 250 forks source link

adjusting 6 peak fitness to use winning conditional for fitness value #43

Closed davideasaf closed 5 years ago

davideasaf commented 5 years ago

Addressing Issue #41

The resulting graph is now: image

knakamura13 commented 3 months ago

FYI this code is still incorrect (as of July 2024). The evaluation function should be defined as follows:

        _n = len(state)
        _t = np.ceil(self.t_pct * _n)

        # Calculate head and tail values
        head_0 = self.head(0, state)
        tail_0 = self.tail(0, state)
        head_1 = self.head(1, state)
        tail_1 = self.tail(1, state)

        # Calculate max(tail(0, x), head(1, x))
        _max_score = max(tail_0, head_1)

        # Calculate R(x, T)
        _r = _n if tail_0 > _t and head_1 > _t or tail_1 > _t and head_0 > _t else 0

        # Evaluate function
        return _max_score + _r