In [1]:
%load_ext line_profiler
%load_ext autoreload
%autoreload 2
In [2]:
from functions import *
In [2]:
#optimize_once TEST ---> A-OK
new_pop = Population(10)
x = np.linspace(0.01,math.pi,100)
y = 2*x
data = {"x":x,"y":y}
specimen = new_pop.population[3]
graphtype = lib[specimen.graph[specimen.find_output_node()]["lib_id"]]
#print(graphtype)
for n in range(30):
optimization = specimen.optimize_once(data)
values = optimization["values"]
optimization
/Users/david/Documents/GitHub/Long-Term-Memory-AI/functions.py:183: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
if parameters == None:
Out[2]:
{'X': 0,
'error': 8.2924599120016129e-17,
'values': array([ 0.72602773, 2. ])}
In [6]:
population = Population(10)
x = np.linspace(0.01,math.pi,100)
y = np.sin(x)#2*x+3
data = {"x":x,"y":y}
plt.plot(x,y)
plt.show()
population.evolve(data,generations=300)
for specimen in population.population:
print(specimen.error(data))
specimen.draw()
specimen.plot_with_data(data,x_range=[0.01,math.pi])
specimen = population.best_specimen(data)
lib[specimen.graph[specimen.find_output_node()]["lib_id"]]
print(specimen.variable_position)
print(specimen.values)
print(specimen.error(data))
specimen.draw()
specimen.plot_with_data(data,x_range=[0.01,math.pi])
0-th year, population size = 5
1-th year, population size = 5
2-th year, population size = 5
3-th year, population size = 6
4-th year, population size = 6
/Users/david/Documents/GitHub/Long-Term-Memory-AI/functions.py:183: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
if parameters == None:
5-th year, population size = 6
6-th year, population size = 6
7-th year, population size = 6
8-th year, population size = 6
9-th year, population size = 6
10-th year, population size = 6
11-th year, population size = 6
12-th year, population size = 6
13-th year, population size = 7
14-th year, population size = 7
15-th year, population size = 7
16-th year, population size = 7
17-th year, population size = 7
18-th year, population size = 7
19-th year, population size = 7
20-th year, population size = 8
21-th year, population size = 8
22-th year, population size = 8
23-th year, population size = 8
24-th year, population size = 8
25-th year, population size = 8
26-th year, population size = 8
27-th year, population size = 8
28-th year, population size = 8
29-th year, population size = 8
30-th year, population size = 8
31-th year, population size = 8
32-th year, population size = 8
33-th year, population size = 8
34-th year, population size = 8
35-th year, population size = 8
36-th year, population size = 9
37-th year, population size = 9
38-th year, population size = 9
39-th year, population size = 9
40-th year, population size = 9
41-th year, population size = 9
42-th year, population size = 9
43-th year, population size = 9
44-th year, population size = 9
45-th year, population size = 9
46-th year, population size = 9
47-th year, population size = 9
48-th year, population size = 9
49-th year, population size = 9
50-th year, population size = 9
51-th year, population size = 9
52-th year, population size = 9
53-th year, population size = 9
54-th year, population size = 9
55-th year, population size = 9
56-th year, population size = 9
57-th year, population size = 9
58-th year, population size = 9
59-th year, population size = 9
60-th year, population size = 9
61-th year, population size = 9
62-th year, population size = 10
63-th year, population size = 10
64-th year, population size = 10
65-th year, population size = 10
66-th year, population size = 10
67-th year, population size = 10
68-th year, population size = 10
69-th year, population size = 10
70-th year, population size = 10
71-th year, population size = 10
72-th year, population size = 10
73-th year, population size = 10
74-th year, population size = 10
75-th year, population size = 10
76-th year, population size = 10
77-th year, population size = 10
78-th year, population size = 10
79-th year, population size = 10
80-th year, population size = 10
81-th year, population size = 11
82-th year, population size = 11
83-th year, population size = 11
84-th year, population size = 11
85-th year, population size = 11
86-th year, population size = 11
87-th year, population size = 11
88-th year, population size = 11
89-th year, population size = 11
90-th year, population size = 11
91-th year, population size = 11
92-th year, population size = 11
93-th year, population size = 11
94-th year, population size = 11
95-th year, population size = 11
96-th year, population size = 11
97-th year, population size = 11
98-th year, population size = 11
99-th year, population size = 11
100-th year, population size = 11
101-th year, population size = 11
102-th year, population size = 11
103-th year, population size = 11
104-th year, population size = 11
105-th year, population size = 11
106-th year, population size = 11
107-th year, population size = 11
108-th year, population size = 11
109-th year, population size = 11
110-th year, population size = 11
111-th year, population size = 11
112-th year, population size = 11
113-th year, population size = 11
114-th year, population size = 11
115-th year, population size = 11
116-th year, population size = 11
117-th year, population size = 11
118-th year, population size = 11
119-th year, population size = 11
120-th year, population size = 11
121-th year, population size = 11
122-th year, population size = 11
123-th year, population size = 11
124-th year, population size = 11
125-th year, population size = 11
126-th year, population size = 11
127-th year, population size = 11
128-th year, population size = 11
129-th year, population size = 11
130-th year, population size = 11
131-th year, population size = 12
132-th year, population size = 12
133-th year, population size = 12
134-th year, population size = 12
135-th year, population size = 12
136-th year, population size = 12
137-th year, population size = 12
138-th year, population size = 12
139-th year, population size = 12
140-th year, population size = 12
141-th year, population size = 13
142-th year, population size = 13
143-th year, population size = 13
144-th year, population size = 13
145-th year, population size = 13
146-th year, population size = 13
147-th year, population size = 13
148-th year, population size = 13
149-th year, population size = 13
150-th year, population size = 13
151-th year, population size = 13
152-th year, population size = 13
153-th year, population size = 13
154-th year, population size = 13
155-th year, population size = 13
156-th year, population size = 13
157-th year, population size = 13
158-th year, population size = 13
159-th year, population size = 13
160-th year, population size = 13
161-th year, population size = 13
162-th year, population size = 13
163-th year, population size = 13
164-th year, population size = 13
165-th year, population size = 13
166-th year, population size = 13
167-th year, population size = 13
168-th year, population size = 13
169-th year, population size = 13
170-th year, population size = 13
171-th year, population size = 15
172-th year, population size = 15
173-th year, population size = 15
174-th year, population size = 15
175-th year, population size = 15
176-th year, population size = 15
177-th year, population size = 15
178-th year, population size = 15
179-th year, population size = 15
180-th year, population size = 15
181-th year, population size = 15
182-th year, population size = 15
183-th year, population size = 15
184-th year, population size = 15
185-th year, population size = 15
186-th year, population size = 15
187-th year, population size = 15
188-th year, population size = 15
189-th year, population size = 15
190-th year, population size = 15
191-th year, population size = 15
192-th year, population size = 15
193-th year, population size = 15
194-th year, population size = 15
195-th year, population size = 15
196-th year, population size = 15
197-th year, population size = 15
198-th year, population size = 15
199-th year, population size = 15
200-th year, population size = 15
201-th year, population size = 15
202-th year, population size = 15
203-th year, population size = 15
204-th year, population size = 15
205-th year, population size = 15
206-th year, population size = 15
207-th year, population size = 15
208-th year, population size = 15
209-th year, population size = 15
210-th year, population size = 15
211-th year, population size = 16
212-th year, population size = 16
213-th year, population size = 16
214-th year, population size = 16
215-th year, population size = 16
216-th year, population size = 16
217-th year, population size = 16
218-th year, population size = 16
219-th year, population size = 16
220-th year, population size = 16
221-th year, population size = 16
222-th year, population size = 16
223-th year, population size = 16
224-th year, population size = 16
225-th year, population size = 16
226-th year, population size = 16
227-th year, population size = 16
228-th year, population size = 16
229-th year, population size = 16
230-th year, population size = 16
231-th year, population size = 16
232-th year, population size = 16
233-th year, population size = 16
234-th year, population size = 16
235-th year, population size = 16
236-th year, population size = 16
237-th year, population size = 16
238-th year, population size = 16
239-th year, population size = 16
240-th year, population size = 16
241-th year, population size = 16
242-th year, population size = 16
243-th year, population size = 16
244-th year, population size = 16
245-th year, population size = 16
246-th year, population size = 16
247-th year, population size = 16
248-th year, population size = 16
249-th year, population size = 16
250-th year, population size = 16
251-th year, population size = 15
252-th year, population size = 15
253-th year, population size = 15
254-th year, population size = 15
255-th year, population size = 15
256-th year, population size = 15
257-th year, population size = 15
258-th year, population size = 15
259-th year, population size = 15
260-th year, population size = 15
261-th year, population size = 15
262-th year, population size = 15
263-th year, population size = 16
264-th year, population size = 16
265-th year, population size = 16
266-th year, population size = 16
267-th year, population size = 16
268-th year, population size = 16
269-th year, population size = 16
270-th year, population size = 17
271-th year, population size = 17
272-th year, population size = 17
273-th year, population size = 17
274-th year, population size = 17
275-th year, population size = 17
276-th year, population size = 17
277-th year, population size = 17
278-th year, population size = 17
279-th year, population size = 17
280-th year, population size = 17
281-th year, population size = 17
282-th year, population size = 17
283-th year, population size = 17
284-th year, population size = 17
285-th year, population size = 17
286-th year, population size = 17
287-th year, population size = 17
288-th year, population size = 17
289-th year, population size = 17
290-th year, population size = 17
291-th year, population size = 17
292-th year, population size = 17
293-th year, population size = 17
294-th year, population size = 17
295-th year, population size = 17
296-th year, population size = 17
297-th year, population size = 17
298-th year, population size = 17
299-th year, population size = 17
182.730709435
/Users/david/anaconda/lib/python3.6/site-packages/networkx/drawing/nx_pylab.py:126: MatplotlibDeprecationWarning: pyplot.hold is deprecated.
Future behavior will be consistent with the long-time default:
plot commands add elements without first clearing the
Axes and/or Figure.
b = plt.ishold()
/Users/david/anaconda/lib/python3.6/site-packages/networkx/drawing/nx_pylab.py:138: MatplotlibDeprecationWarning: pyplot.hold is deprecated.
Future behavior will be consistent with the long-time default:
plot commands add elements without first clearing the
Axes and/or Figure.
plt.hold(b)
/Users/david/anaconda/lib/python3.6/site-packages/matplotlib/__init__.py:917: UserWarning: axes.hold is deprecated. Please remove it from your matplotlibrc and/or style files.
warnings.warn(self.msg_depr_set % key)
/Users/david/anaconda/lib/python3.6/site-packages/matplotlib/rcsetup.py:152: UserWarning: axes.hold is deprecated, will be removed in 3.0
warnings.warn("axes.hold is deprecated, will be removed in 3.0")
93.7022918937
93.7022918937
19.9251812281
19.962317382
49.6580532754
9.68310907632
19.9251812281
8.73904029681
9.68434886808
9.68310926112
92.4162589316
93.7022918937
93.7022918937
19.9251812281
20.5584227667
966.810087089
2
[ 0.65602208 0.23627913 0.65816449 -0.04019958]
8.73904029681
In [ ]:
Content source: Xenophyte/Long-Term-Memory-AI
Similar notebooks: