MilesCranmer commited on
Commit
7156334
1 Parent(s): 7946ec0

Update test notebook

Browse files
Files changed (1) hide show
  1. pysr/test/test_nb.ipynb +77 -414
pysr/test/test_nb.ipynb CHANGED
@@ -4,7 +4,27 @@
4
  "cell_type": "code",
5
  "execution_count": 1,
6
  "metadata": {},
7
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  "source": [
9
  "# NBVAL_IGNORE_OUTPUT\n",
10
  "import numpy as np\n",
@@ -57,415 +77,8 @@
57
  "outputs": [
58
  {
59
  "data": {
60
- "text/html": [
61
- "<style>#sk-container-id-1 {\n",
62
- " /* Definition of color scheme common for light and dark mode */\n",
63
- " --sklearn-color-text: black;\n",
64
- " --sklearn-color-line: gray;\n",
65
- " /* Definition of color scheme for unfitted estimators */\n",
66
- " --sklearn-color-unfitted-level-0: #fff5e6;\n",
67
- " --sklearn-color-unfitted-level-1: #f6e4d2;\n",
68
- " --sklearn-color-unfitted-level-2: #ffe0b3;\n",
69
- " --sklearn-color-unfitted-level-3: chocolate;\n",
70
- " /* Definition of color scheme for fitted estimators */\n",
71
- " --sklearn-color-fitted-level-0: #f0f8ff;\n",
72
- " --sklearn-color-fitted-level-1: #d4ebff;\n",
73
- " --sklearn-color-fitted-level-2: #b3dbfd;\n",
74
- " --sklearn-color-fitted-level-3: cornflowerblue;\n",
75
- "\n",
76
- " /* Specific color for light theme */\n",
77
- " --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n",
78
- " --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));\n",
79
- " --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n",
80
- " --sklearn-color-icon: #696969;\n",
81
- "\n",
82
- " @media (prefers-color-scheme: dark) {\n",
83
- " /* Redefinition of color scheme for dark theme */\n",
84
- " --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n",
85
- " --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));\n",
86
- " --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n",
87
- " --sklearn-color-icon: #878787;\n",
88
- " }\n",
89
- "}\n",
90
- "\n",
91
- "#sk-container-id-1 {\n",
92
- " color: var(--sklearn-color-text);\n",
93
- "}\n",
94
- "\n",
95
- "#sk-container-id-1 pre {\n",
96
- " padding: 0;\n",
97
- "}\n",
98
- "\n",
99
- "#sk-container-id-1 input.sk-hidden--visually {\n",
100
- " border: 0;\n",
101
- " clip: rect(1px 1px 1px 1px);\n",
102
- " clip: rect(1px, 1px, 1px, 1px);\n",
103
- " height: 1px;\n",
104
- " margin: -1px;\n",
105
- " overflow: hidden;\n",
106
- " padding: 0;\n",
107
- " position: absolute;\n",
108
- " width: 1px;\n",
109
- "}\n",
110
- "\n",
111
- "#sk-container-id-1 div.sk-dashed-wrapped {\n",
112
- " border: 1px dashed var(--sklearn-color-line);\n",
113
- " margin: 0 0.4em 0.5em 0.4em;\n",
114
- " box-sizing: border-box;\n",
115
- " padding-bottom: 0.4em;\n",
116
- " background-color: var(--sklearn-color-background);\n",
117
- "}\n",
118
- "\n",
119
- "#sk-container-id-1 div.sk-container {\n",
120
- " /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n",
121
- " but bootstrap.min.css set `[hidden] { display: none !important; }`\n",
122
- " so we also need the `!important` here to be able to override the\n",
123
- " default hidden behavior on the sphinx rendered scikit-learn.org.\n",
124
- " See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n",
125
- " display: inline-block !important;\n",
126
- " position: relative;\n",
127
- "}\n",
128
- "\n",
129
- "#sk-container-id-1 div.sk-text-repr-fallback {\n",
130
- " display: none;\n",
131
- "}\n",
132
- "\n",
133
- "div.sk-parallel-item,\n",
134
- "div.sk-serial,\n",
135
- "div.sk-item {\n",
136
- " /* draw centered vertical line to link estimators */\n",
137
- " background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n",
138
- " background-size: 2px 100%;\n",
139
- " background-repeat: no-repeat;\n",
140
- " background-position: center center;\n",
141
- "}\n",
142
- "\n",
143
- "/* Parallel-specific style estimator block */\n",
144
- "\n",
145
- "#sk-container-id-1 div.sk-parallel-item::after {\n",
146
- " content: \"\";\n",
147
- " width: 100%;\n",
148
- " border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n",
149
- " flex-grow: 1;\n",
150
- "}\n",
151
- "\n",
152
- "#sk-container-id-1 div.sk-parallel {\n",
153
- " display: flex;\n",
154
- " align-items: stretch;\n",
155
- " justify-content: center;\n",
156
- " background-color: var(--sklearn-color-background);\n",
157
- " position: relative;\n",
158
- "}\n",
159
- "\n",
160
- "#sk-container-id-1 div.sk-parallel-item {\n",
161
- " display: flex;\n",
162
- " flex-direction: column;\n",
163
- "}\n",
164
- "\n",
165
- "#sk-container-id-1 div.sk-parallel-item:first-child::after {\n",
166
- " align-self: flex-end;\n",
167
- " width: 50%;\n",
168
- "}\n",
169
- "\n",
170
- "#sk-container-id-1 div.sk-parallel-item:last-child::after {\n",
171
- " align-self: flex-start;\n",
172
- " width: 50%;\n",
173
- "}\n",
174
- "\n",
175
- "#sk-container-id-1 div.sk-parallel-item:only-child::after {\n",
176
- " width: 0;\n",
177
- "}\n",
178
- "\n",
179
- "/* Serial-specific style estimator block */\n",
180
- "\n",
181
- "#sk-container-id-1 div.sk-serial {\n",
182
- " display: flex;\n",
183
- " flex-direction: column;\n",
184
- " align-items: center;\n",
185
- " background-color: var(--sklearn-color-background);\n",
186
- " padding-right: 1em;\n",
187
- " padding-left: 1em;\n",
188
- "}\n",
189
- "\n",
190
- "\n",
191
- "/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\n",
192
- "clickable and can be expanded/collapsed.\n",
193
- "- Pipeline and ColumnTransformer use this feature and define the default style\n",
194
- "- Estimators will overwrite some part of the style using the `sk-estimator` class\n",
195
- "*/\n",
196
- "\n",
197
- "/* Pipeline and ColumnTransformer style (default) */\n",
198
- "\n",
199
- "#sk-container-id-1 div.sk-toggleable {\n",
200
- " /* Default theme specific background. It is overwritten whether we have a\n",
201
- " specific estimator or a Pipeline/ColumnTransformer */\n",
202
- " background-color: var(--sklearn-color-background);\n",
203
- "}\n",
204
- "\n",
205
- "/* Toggleable label */\n",
206
- "#sk-container-id-1 label.sk-toggleable__label {\n",
207
- " cursor: pointer;\n",
208
- " display: block;\n",
209
- " width: 100%;\n",
210
- " margin-bottom: 0;\n",
211
- " padding: 0.5em;\n",
212
- " box-sizing: border-box;\n",
213
- " text-align: center;\n",
214
- "}\n",
215
- "\n",
216
- "#sk-container-id-1 label.sk-toggleable__label-arrow:before {\n",
217
- " /* Arrow on the left of the label */\n",
218
- " content: \"▸\";\n",
219
- " float: left;\n",
220
- " margin-right: 0.25em;\n",
221
- " color: var(--sklearn-color-icon);\n",
222
- "}\n",
223
- "\n",
224
- "#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {\n",
225
- " color: var(--sklearn-color-text);\n",
226
- "}\n",
227
- "\n",
228
- "/* Toggleable content - dropdown */\n",
229
- "\n",
230
- "#sk-container-id-1 div.sk-toggleable__content {\n",
231
- " max-height: 0;\n",
232
- " max-width: 0;\n",
233
- " overflow: hidden;\n",
234
- " text-align: left;\n",
235
- " /* unfitted */\n",
236
- " background-color: var(--sklearn-color-unfitted-level-0);\n",
237
- "}\n",
238
- "\n",
239
- "#sk-container-id-1 div.sk-toggleable__content.fitted {\n",
240
- " /* fitted */\n",
241
- " background-color: var(--sklearn-color-fitted-level-0);\n",
242
- "}\n",
243
- "\n",
244
- "#sk-container-id-1 div.sk-toggleable__content pre {\n",
245
- " margin: 0.2em;\n",
246
- " border-radius: 0.25em;\n",
247
- " color: var(--sklearn-color-text);\n",
248
- " /* unfitted */\n",
249
- " background-color: var(--sklearn-color-unfitted-level-0);\n",
250
- "}\n",
251
- "\n",
252
- "#sk-container-id-1 div.sk-toggleable__content.fitted pre {\n",
253
- " /* unfitted */\n",
254
- " background-color: var(--sklearn-color-fitted-level-0);\n",
255
- "}\n",
256
- "\n",
257
- "#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n",
258
- " /* Expand drop-down */\n",
259
- " max-height: 200px;\n",
260
- " max-width: 100%;\n",
261
- " overflow: auto;\n",
262
- "}\n",
263
- "\n",
264
- "#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n",
265
- " content: \"▾\";\n",
266
- "}\n",
267
- "\n",
268
- "/* Pipeline/ColumnTransformer-specific style */\n",
269
- "\n",
270
- "#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
271
- " color: var(--sklearn-color-text);\n",
272
- " background-color: var(--sklearn-color-unfitted-level-2);\n",
273
- "}\n",
274
- "\n",
275
- "#sk-container-id-1 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
276
- " background-color: var(--sklearn-color-fitted-level-2);\n",
277
- "}\n",
278
- "\n",
279
- "/* Estimator-specific style */\n",
280
- "\n",
281
- "/* Colorize estimator box */\n",
282
- "#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
283
- " /* unfitted */\n",
284
- " background-color: var(--sklearn-color-unfitted-level-2);\n",
285
- "}\n",
286
- "\n",
287
- "#sk-container-id-1 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
288
- " /* fitted */\n",
289
- " background-color: var(--sklearn-color-fitted-level-2);\n",
290
- "}\n",
291
- "\n",
292
- "#sk-container-id-1 div.sk-label label.sk-toggleable__label,\n",
293
- "#sk-container-id-1 div.sk-label label {\n",
294
- " /* The background is the default theme color */\n",
295
- " color: var(--sklearn-color-text-on-default-background);\n",
296
- "}\n",
297
- "\n",
298
- "/* On hover, darken the color of the background */\n",
299
- "#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {\n",
300
- " color: var(--sklearn-color-text);\n",
301
- " background-color: var(--sklearn-color-unfitted-level-2);\n",
302
- "}\n",
303
- "\n",
304
- "/* Label box, darken color on hover, fitted */\n",
305
- "#sk-container-id-1 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n",
306
- " color: var(--sklearn-color-text);\n",
307
- " background-color: var(--sklearn-color-fitted-level-2);\n",
308
- "}\n",
309
- "\n",
310
- "/* Estimator label */\n",
311
- "\n",
312
- "#sk-container-id-1 div.sk-label label {\n",
313
- " font-family: monospace;\n",
314
- " font-weight: bold;\n",
315
- " display: inline-block;\n",
316
- " line-height: 1.2em;\n",
317
- "}\n",
318
- "\n",
319
- "#sk-container-id-1 div.sk-label-container {\n",
320
- " text-align: center;\n",
321
- "}\n",
322
- "\n",
323
- "/* Estimator-specific */\n",
324
- "#sk-container-id-1 div.sk-estimator {\n",
325
- " font-family: monospace;\n",
326
- " border: 1px dotted var(--sklearn-color-border-box);\n",
327
- " border-radius: 0.25em;\n",
328
- " box-sizing: border-box;\n",
329
- " margin-bottom: 0.5em;\n",
330
- " /* unfitted */\n",
331
- " background-color: var(--sklearn-color-unfitted-level-0);\n",
332
- "}\n",
333
- "\n",
334
- "#sk-container-id-1 div.sk-estimator.fitted {\n",
335
- " /* fitted */\n",
336
- " background-color: var(--sklearn-color-fitted-level-0);\n",
337
- "}\n",
338
- "\n",
339
- "/* on hover */\n",
340
- "#sk-container-id-1 div.sk-estimator:hover {\n",
341
- " /* unfitted */\n",
342
- " background-color: var(--sklearn-color-unfitted-level-2);\n",
343
- "}\n",
344
- "\n",
345
- "#sk-container-id-1 div.sk-estimator.fitted:hover {\n",
346
- " /* fitted */\n",
347
- " background-color: var(--sklearn-color-fitted-level-2);\n",
348
- "}\n",
349
- "\n",
350
- "/* Specification for estimator info (e.g. \"i\" and \"?\") */\n",
351
- "\n",
352
- "/* Common style for \"i\" and \"?\" */\n",
353
- "\n",
354
- ".sk-estimator-doc-link,\n",
355
- "a:link.sk-estimator-doc-link,\n",
356
- "a:visited.sk-estimator-doc-link {\n",
357
- " float: right;\n",
358
- " font-size: smaller;\n",
359
- " line-height: 1em;\n",
360
- " font-family: monospace;\n",
361
- " background-color: var(--sklearn-color-background);\n",
362
- " border-radius: 1em;\n",
363
- " height: 1em;\n",
364
- " width: 1em;\n",
365
- " text-decoration: none !important;\n",
366
- " margin-left: 1ex;\n",
367
- " /* unfitted */\n",
368
- " border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
369
- " color: var(--sklearn-color-unfitted-level-1);\n",
370
- "}\n",
371
- "\n",
372
- ".sk-estimator-doc-link.fitted,\n",
373
- "a:link.sk-estimator-doc-link.fitted,\n",
374
- "a:visited.sk-estimator-doc-link.fitted {\n",
375
- " /* fitted */\n",
376
- " border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
377
- " color: var(--sklearn-color-fitted-level-1);\n",
378
- "}\n",
379
- "\n",
380
- "/* On hover */\n",
381
- "div.sk-estimator:hover .sk-estimator-doc-link:hover,\n",
382
- ".sk-estimator-doc-link:hover,\n",
383
- "div.sk-label-container:hover .sk-estimator-doc-link:hover,\n",
384
- ".sk-estimator-doc-link:hover {\n",
385
- " /* unfitted */\n",
386
- " background-color: var(--sklearn-color-unfitted-level-3);\n",
387
- " color: var(--sklearn-color-background);\n",
388
- " text-decoration: none;\n",
389
- "}\n",
390
- "\n",
391
- "div.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n",
392
- ".sk-estimator-doc-link.fitted:hover,\n",
393
- "div.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n",
394
- ".sk-estimator-doc-link.fitted:hover {\n",
395
- " /* fitted */\n",
396
- " background-color: var(--sklearn-color-fitted-level-3);\n",
397
- " color: var(--sklearn-color-background);\n",
398
- " text-decoration: none;\n",
399
- "}\n",
400
- "\n",
401
- "/* Span, style for the box shown on hovering the info icon */\n",
402
- ".sk-estimator-doc-link span {\n",
403
- " display: none;\n",
404
- " z-index: 9999;\n",
405
- " position: relative;\n",
406
- " font-weight: normal;\n",
407
- " right: .2ex;\n",
408
- " padding: .5ex;\n",
409
- " margin: .5ex;\n",
410
- " width: min-content;\n",
411
- " min-width: 20ex;\n",
412
- " max-width: 50ex;\n",
413
- " color: var(--sklearn-color-text);\n",
414
- " box-shadow: 2pt 2pt 4pt #999;\n",
415
- " /* unfitted */\n",
416
- " background: var(--sklearn-color-unfitted-level-0);\n",
417
- " border: .5pt solid var(--sklearn-color-unfitted-level-3);\n",
418
- "}\n",
419
- "\n",
420
- ".sk-estimator-doc-link.fitted span {\n",
421
- " /* fitted */\n",
422
- " background: var(--sklearn-color-fitted-level-0);\n",
423
- " border: var(--sklearn-color-fitted-level-3);\n",
424
- "}\n",
425
- "\n",
426
- ".sk-estimator-doc-link:hover span {\n",
427
- " display: block;\n",
428
- "}\n",
429
- "\n",
430
- "/* \"?\"-specific style due to the `<a>` HTML tag */\n",
431
- "\n",
432
- "#sk-container-id-1 a.estimator_doc_link {\n",
433
- " float: right;\n",
434
- " font-size: 1rem;\n",
435
- " line-height: 1em;\n",
436
- " font-family: monospace;\n",
437
- " background-color: var(--sklearn-color-background);\n",
438
- " border-radius: 1rem;\n",
439
- " height: 1rem;\n",
440
- " width: 1rem;\n",
441
- " text-decoration: none;\n",
442
- " /* unfitted */\n",
443
- " color: var(--sklearn-color-unfitted-level-1);\n",
444
- " border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
445
- "}\n",
446
- "\n",
447
- "#sk-container-id-1 a.estimator_doc_link.fitted {\n",
448
- " /* fitted */\n",
449
- " border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
450
- " color: var(--sklearn-color-fitted-level-1);\n",
451
- "}\n",
452
- "\n",
453
- "/* On hover */\n",
454
- "#sk-container-id-1 a.estimator_doc_link:hover {\n",
455
- " /* unfitted */\n",
456
- " background-color: var(--sklearn-color-unfitted-level-3);\n",
457
- " color: var(--sklearn-color-background);\n",
458
- " text-decoration: none;\n",
459
- "}\n",
460
- "\n",
461
- "#sk-container-id-1 a.estimator_doc_link.fitted:hover {\n",
462
- " /* fitted */\n",
463
- " background-color: var(--sklearn-color-fitted-level-3);\n",
464
- "}\n",
465
- "</style><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>PySRRegressor.equations_ = None</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" checked><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label sk-toggleable__label-arrow \">&nbsp;PySRRegressor<span class=\"sk-estimator-doc-link \">i<span>Not fitted</span></span></label><div class=\"sk-toggleable__content \"><pre>PySRRegressor.equations_ = None</pre></div> </div></div></div></div>"
466
- ],
467
  "text/plain": [
468
- "PySRRegressor.equations_ = None"
469
  ]
470
  },
471
  "execution_count": 4,
@@ -473,18 +86,61 @@
473
  "output_type": "execute_result"
474
  }
475
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
  "source": [
477
  "rstate = np.random.RandomState(0)\n",
478
  "X = np.random.randn(10, 2)\n",
479
  "y = np.random.randn(10)\n",
480
  "\n",
481
- "model = PySRRegressor(deterministic=True, multithreading=False, procs=0, random_state=0, verbosity=0, progress=False)\n",
482
- "model"
483
  ]
484
  },
485
  {
486
  "cell_type": "code",
487
- "execution_count": 5,
488
  "metadata": {},
489
  "outputs": [
490
  {
@@ -501,7 +157,7 @@
501
  "pandas.core.frame.DataFrame"
502
  ]
503
  },
504
- "execution_count": 5,
505
  "metadata": {},
506
  "output_type": "execute_result"
507
  }
@@ -510,6 +166,13 @@
510
  "model.fit(X, y)\n",
511
  "type(model.equations_)"
512
  ]
 
 
 
 
 
 
 
513
  }
514
  ],
515
  "metadata": {
@@ -528,7 +191,7 @@
528
  "name": "python",
529
  "nbconvert_exporter": "python",
530
  "pygments_lexer": "ipython3",
531
- "version": "3.12.0"
532
  }
533
  },
534
  "nbformat": 4,
 
4
  "cell_type": "code",
5
  "execution_count": 1,
6
  "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "Detected Jupyter notebook. Loading juliacall extension. Set `PYSR_AUTOLOAD_EXTENSIONS=no` to disable.\n"
13
+ ]
14
+ },
15
+ {
16
+ "name": "stderr",
17
+ "output_type": "stream",
18
+ "text": [
19
+ "Precompiling SymbolicRegression\n",
20
+ "\u001b[32m ✓ \u001b[39mSymbolicRegression\n",
21
+ " 1 dependency successfully precompiled in 26 seconds. 106 already precompiled.\n",
22
+ "Precompiling SymbolicRegressionJSON3Ext\n",
23
+ "\u001b[32m ✓ \u001b[39m\u001b[90mSymbolicRegression → SymbolicRegressionJSON3Ext\u001b[39m\n",
24
+ " 1 dependency successfully precompiled in 2 seconds. 110 already precompiled.\n"
25
+ ]
26
+ }
27
+ ],
28
  "source": [
29
  "# NBVAL_IGNORE_OUTPUT\n",
30
  "import numpy as np\n",
 
77
  "outputs": [
78
  {
79
  "data": {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  "text/plain": [
81
+ "my_loss (generic function with 1 method)"
82
  ]
83
  },
84
  "execution_count": 4,
 
86
  "output_type": "execute_result"
87
  }
88
  ],
89
+ "source": [
90
+ "%%julia\n",
91
+ "function my_loss(x)\n",
92
+ " x ^ 2\n",
93
+ "end"
94
+ ]
95
+ },
96
+ {
97
+ "cell_type": "code",
98
+ "execution_count": 5,
99
+ "metadata": {},
100
+ "outputs": [
101
+ {
102
+ "data": {
103
+ "text/plain": [
104
+ "4"
105
+ ]
106
+ },
107
+ "execution_count": 5,
108
+ "metadata": {},
109
+ "output_type": "execute_result"
110
+ }
111
+ ],
112
+ "source": [
113
+ "%julia my_loss(2)"
114
+ ]
115
+ },
116
+ {
117
+ "cell_type": "code",
118
+ "execution_count": 6,
119
+ "metadata": {},
120
+ "outputs": [
121
+ {
122
+ "data": {
123
+ "text/plain": [
124
+ "'PySRRegressor.equations_ = None'"
125
+ ]
126
+ },
127
+ "execution_count": 6,
128
+ "metadata": {},
129
+ "output_type": "execute_result"
130
+ }
131
+ ],
132
  "source": [
133
  "rstate = np.random.RandomState(0)\n",
134
  "X = np.random.randn(10, 2)\n",
135
  "y = np.random.randn(10)\n",
136
  "\n",
137
+ "model = PySRRegressor(deterministic=True, multithreading=False, procs=0, random_state=0, verbosity=0, progress=False, niterations=1, ncycles_per_iteration=1)\n",
138
+ "str(model)"
139
  ]
140
  },
141
  {
142
  "cell_type": "code",
143
+ "execution_count": 7,
144
  "metadata": {},
145
  "outputs": [
146
  {
 
157
  "pandas.core.frame.DataFrame"
158
  ]
159
  },
160
+ "execution_count": 7,
161
  "metadata": {},
162
  "output_type": "execute_result"
163
  }
 
166
  "model.fit(X, y)\n",
167
  "type(model.equations_)"
168
  ]
169
+ },
170
+ {
171
+ "cell_type": "code",
172
+ "execution_count": null,
173
+ "metadata": {},
174
+ "outputs": [],
175
+ "source": []
176
  }
177
  ],
178
  "metadata": {
 
191
  "name": "python",
192
  "nbconvert_exporter": "python",
193
  "pygments_lexer": "ipython3",
194
+ "version": "3.12.1"
195
  }
196
  },
197
  "nbformat": 4,