<commit_before>from simplex.algorithm import NelderMeadSimplex

import numpy as np
import matplotlib.pyplot as plt

from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
## for Palatino and other serif fonts use:
#rc('font',**{'family':'serif','serif':['Palatino']})
rc('text', usetex=True)

# Define objective function
def objective(xs):
    x1, x2 = xs[0], xs[1]
    return x1*x2

# Define callback function
simplices = []
def callback(args):
    simplices.append(args[0])

# Initial simplex
simplex = np.array([[0,0], [1,1], [0,1]], dtype=np.float)

# Initialise NelderMead simplex algorithm
nm = NelderMeadSimplex(objective, simplex, epsilon=1e-6, callback=callback)

# Minimise the objective function
solution = nm.solve()

print("Minimum at {}".format(solution))

# Tabulate objective function
x = np.linspace(-3, 3, 1000)
y = np.linspace(-3, 3, 1000)
X, Y = np.meshgrid(x, y)<commit_msg>Modify no minimum example.<commit_after>from simplex.algorithm import NelderMeadSimplex

import numpy as np
import matplotlib.pyplot as plt

from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
## for Palatino and other serif fonts use:
#rc('font',**{'family':'serif','serif':['Palatino']})
rc('text', usetex=True)

# Define objective function
def objective(xs):
    x1, x2 = xs[0], xs[1]
    return x1*x2

# Define callback function
simplices = []
def callback(args):
    simplices.append(args[0])

# Initial simplex
simplex = np.array([[0,0], [1,1], [0,1]], dtype=np.float)

# Initialise NelderMead simplex algorithm
nm = NelderMeadSimplex(objective, simplex, epsilon=1e-6, max_iter=8, callback=callback)

# Minimise the objective function
solution = nm.solve()

print("Minimum at {}".format(solution))

# Tabulate objective function
x = np.linspace(-10, 10, 1000)
y = np.linspace(-10, 10, 1000)
X, Y = np.meshgrid(x, y)
{'fraction_non_alphanumeric': 0.16146109052408683, 'fraction_numerical': 0.03123345685547909, 'mean_word_length': 5.798561151079137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7449374', 'n_tokens_mistral': 723, 'n_tokens_neox': 673, 'n_words': 173}