Skip to content

Commit c456057

Browse files
author
Alexander Mead
committed
Updating to latest version
1 parent 75071dd commit c456057

File tree

10 files changed

+1725
-912
lines changed

10 files changed

+1725
-912
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# User info
22
TWINLAB_USER=
33
TWINLAB_API_KEY=
4+
TWINLAB_URL=https://twinlab.digilab.co.uk/v3

notebooks/Classification.ipynb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
"text": [
2929
"\n",
3030
" ====== TwinLab Client Initialisation ======\n",
31-
" Version : 2.10.0\n",
32-
" User : alexander@digilab.co.uk\n",
33-
" Server : http://localhost:8000\n",
34-
" Environment : /Users/mead/digiLab/twinLab/tutorials/.env\n",
31+
" Version : 2.12.0\n",
32+
" User : jamie@digilab.co.uk\n",
33+
" Server : https://twinlab.digilab.co.uk/v3\n",
34+
" Environment : /Users/jamiedonald-mccann/Desktop/twinLab/tutorials/.env\n",
3535
"\n"
3636
]
3737
}
@@ -219,7 +219,7 @@
219219
"cell_type": "markdown",
220220
"metadata": {},
221221
"source": [
222-
"Now, you can train a classification `twinLab` model that identifies the patterns underlying the data and approximates the true function that you established in section one (represented by the red dotted line you generated in the plot)."
222+
"Now, you can train a classification `twinLab` model that identifies the patterns underlying the data and approximates the true function that you established in section one."
223223
]
224224
},
225225
{
@@ -284,7 +284,8 @@
284284
"text": [
285285
"Emulator 'classification' has begun training.\n",
286286
"0:00:00: Job status: processing\n",
287-
"0:00:01: Job status: success\n",
287+
"0:00:01: Job status: processing\n",
288+
"0:00:03: Job status: success\n",
288289
"Training of emulator classification is complete!\n"
289290
]
290291
}
@@ -439,7 +440,7 @@
439440
"source": [
440441
"Note some important differences between the values here compared to those from a regression model: \n",
441442
"\n",
442-
"First, the training data contains only binary values for `y` of either 0 or 1, here the value of `y` is also either 0 or 1. This is the prediction for the class that `X` belongs to. The second column is the probability that the emulator has assigned to the class membership. Values close to indicate that the model has a high degree of certainty that the `X` belongs to class 0; values close to 1 indicate a high degree of certainty that it belongs to class 1."
443+
"First, the training data contains only binary values for `y` of either 0 or 1, here the value of `y` is also either 0 or 1. This is the prediction for the class that `X` belongs to. The second column is the probability that the emulator has assigned to the class membership. Values close to 0 indicate that the model has a high degree of certainty that the `X` belongs to class 0; values close to 1 indicate a high degree of certainty that it belongs to class 1."
443444
]
444445
},
445446
{
@@ -505,6 +506,13 @@
505506
"emulator.delete()\n",
506507
"dataset.delete()"
507508
]
509+
},
510+
{
511+
"cell_type": "code",
512+
"execution_count": null,
513+
"metadata": {},
514+
"outputs": [],
515+
"source": []
508516
}
509517
],
510518
"metadata": {
@@ -523,7 +531,7 @@
523531
"name": "python",
524532
"nbconvert_exporter": "python",
525533
"pygments_lexer": "ipython3",
526-
"version": "3.10.14"
534+
"version": "3.12.5"
527535
}
528536
},
529537
"nbformat": 4,

notebooks/Mixture_of_experts.ipynb

Lines changed: 174 additions & 107 deletions
Large diffs are not rendered by default.

notebooks/Noiseless_data.ipynb

Lines changed: 125 additions & 64 deletions
Large diffs are not rendered by default.

notebooks/Noisy_Data.ipynb

Lines changed: 86 additions & 43 deletions
Large diffs are not rendered by default.

notebooks/Prediction.ipynb

Lines changed: 381 additions & 342 deletions
Large diffs are not rendered by default.

notebooks/Quickstart.ipynb

Lines changed: 49 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
"text": [
4444
"\n",
4545
" ====== TwinLab Client Initialisation ======\n",
46-
" Version : 2.10.0\n",
47-
" User : alexander@digilab.co.uk\n",
46+
" Version : 2.12.0\n",
47+
" User : jamie@digilab.co.uk\n",
4848
" Server : https://twinlab.digilab.co.uk/v3\n",
49-
" Environment : /Users/mead/digiLab/twinLab/tutorials/.env\n",
49+
" Environment : /Users/jamiedonald-mccann/Desktop/twinLab/tutorials/.env\n",
5050
"\n"
5151
]
5252
}
@@ -70,7 +70,12 @@
7070
"id": "0Xh_ekNBPyod"
7171
},
7272
"source": [
73-
"First things first, set up your API key. If you don't already have one, vist [https://www.digilab.co.uk/contact](https://www.digilab.co.uk/contact). For security, we normally recommend performing this step with a `.env` file or `secrets`. Uncomment the below code and plug in your twinLab username and API key. Be sure to visit the [Portal](https://portal.twinlab.ai/) to check what your API key is, in case you've forgotten it!\n"
73+
"First things first, set up your API key. If you don't already have one, visit [https://www.digilab.co.uk/contact](https://www.digilab.co.uk/contact). If you've forgotten it, visit the [Portal](https://portal.twinlab.ai/), where you can check what your API key is. \n",
74+
"\n",
75+
"For security and convenience, we normally recommend performing this step with a `.env` file or `secrets`. You will notice that when `twinlab` was imported above the `TwinLab Client` was initialised. If you have setup an `.env` file, you will notice your username appears in the client initialisation report. If you would like to setup an `.env` file, simply copy the `.env.example` file provided in this repository and set the `TWINLAB_USER` and `TWINLAB_API_KEY` equal to your username and API key, respectively. Note that you will need to restart your Jupyter kernel if you have modified your `.env` file after running the first cell of this notebook.\n",
76+
"\n",
77+
"\n",
78+
"Alternatively, these variables can be set within your Python code. Uncomment the below code and plug in your twinLab username and API key. \n"
7479
]
7580
},
7681
{
@@ -82,7 +87,8 @@
8287
"outputs": [],
8388
"source": [
8489
"# tl.set_user(\"<YOUR_USERNAME>\")\n",
85-
"# tl.set_api_key(\"<YOUR_API_KEY>\")"
90+
"# tl.set_api_key(\"<YOUR_API_KEY>\")\n",
91+
"# tl.set_url(\"https://twinlab.digilab.co.uk/v3\")"
8692
]
8793
},
8894
{
@@ -100,7 +106,7 @@
100106
{
101107
"data": {
102108
"text/plain": [
103-
"{'User': 'alexander@digilab.co.uk'}"
109+
"{'User': 'jamie@digilab.co.uk'}"
104110
]
105111
},
106112
"execution_count": 3,
@@ -127,10 +133,10 @@
127133
{
128134
"data": {
129135
"text/plain": [
130-
"{'cloud': '3.0.0',\n",
131-
" 'modal': '1.0.0',\n",
132-
" 'library': '1.12.0',\n",
133-
" 'image': 'twinlab-dev'}"
136+
"{'cloud': '3.2.0',\n",
137+
" 'modal': '1.2.0',\n",
138+
" 'library': '2.1.0',\n",
139+
" 'image': 'twinlab-prod'}"
134140
]
135141
},
136142
"execution_count": 4,
@@ -170,14 +176,14 @@
170176
{
171177
"data": {
172178
"text/plain": [
173-
"['gardening',\n",
174-
" 'tritium-desorption-temperature-grid',\n",
179+
"['tritium-desorption-small',\n",
180+
" 'biscuits',\n",
181+
" 'tritium-desorption',\n",
175182
" 'advancedstart',\n",
176-
" 'quickstart',\n",
177183
" 'jet-confinement',\n",
178-
" 'biscuits',\n",
179-
" 'tritium-desorption-small',\n",
180-
" 'tritium-desorption']"
184+
" 'gardening',\n",
185+
" 'quickstart',\n",
186+
" 'tritium-desorption-temperature-grid']"
181187
]
182188
},
183189
"execution_count": 5,
@@ -328,7 +334,7 @@
328334
},
329335
"outputs": [],
330336
"source": [
331-
"# Intialise a Dataset object and give it a name\n",
337+
"# Initialise a Dataset object and give it a name\n",
332338
"dataset = tl.Dataset(\"quickstart\")\n",
333339
"\n",
334340
"# Upload the dataset, passing in the dataframe\n",
@@ -352,14 +358,7 @@
352358
{
353359
"data": {
354360
"text/plain": [
355-
"['gardening',\n",
356-
" 'tritium-desorption-temperature-grid',\n",
357-
" 'advancedstart',\n",
358-
" 'quickstart',\n",
359-
" 'jet-confinement',\n",
360-
" 'biscuits',\n",
361-
" 'tritium-desorption-small',\n",
362-
" 'tritium-desorption']"
361+
"['quickstart']"
363362
]
364363
},
365364
"execution_count": 8,
@@ -368,11 +367,8 @@
368367
}
369368
],
370369
"source": [
371-
"# List all datasets on cloud\n",
372-
"tl.list_datasets()\n",
373-
"\n",
374-
"# List all example datasets on the cloud\n",
375-
"tl.list_example_datasets()"
370+
"# List all of your datasets on cloud\n",
371+
"tl.list_datasets()"
376372
]
377373
},
378374
{
@@ -636,9 +632,14 @@
636632
"name": "stdout",
637633
"output_type": "stream",
638634
"text": [
639-
"Emulator quickstart-model has begun training.\n",
635+
"Emulator 'quickstart-model' has begun training.\n",
640636
"0:00:00: Job status: processing\n",
641-
"0:00:01: Job status: success\n",
637+
"0:00:01: Job status: processing\n",
638+
"0:00:03: Job status: processing\n",
639+
"0:00:05: Job status: processing\n",
640+
"0:00:07: Job status: processing\n",
641+
"0:00:10: Job status: processing\n",
642+
"0:00:12: Job status: success\n",
642643
"Training of emulator quickstart-model is complete!\n"
643644
]
644645
}
@@ -648,17 +649,10 @@
648649
"# For example, here we set the train_test_ratio to 1, meaning that the entire dataset will be used for training.\n",
649650
"params = tl.TrainParams(train_test_ratio=1.0)\n",
650651
"\n",
651-
"# Train the mulator using the train method\n",
652+
"# Train the emulator using the train method\n",
652653
"emulator.train(dataset=dataset, inputs=[\"x\"], outputs=[\"y\"], params=params)"
653654
]
654655
},
655-
{
656-
"cell_type": "markdown",
657-
"metadata": {},
658-
"source": [
659-
"As you can see, there is a three-word string that gets returned with your training job--\"train-word1-word2-word3\". This is an identifier to make it easy to communicate between yourself and the twinLab team--if ever there's been a problem with your training job, you can report the job ID to us and we can track it down for you."
660-
]
661-
},
662656
{
663657
"cell_type": "markdown",
664658
"metadata": {},
@@ -681,15 +675,7 @@
681675
{
682676
"data": {
683677
"text/plain": [
684-
"['test_model',\n",
685-
" 'SimpleGP',\n",
686-
" 'TritiumDesorptionGP_new',\n",
687-
" 'TritiumDesorptionGP',\n",
688-
" 'quickstart',\n",
689-
" 'error-mwe',\n",
690-
" 'example_emulator',\n",
691-
" 'fusion',\n",
692-
" 'quickstart-model']"
678+
"['quickstart-model']"
693679
]
694680
},
695681
"execution_count": 13,
@@ -719,16 +705,20 @@
719705
{
720706
"data": {
721707
"text/plain": [
722-
"{'meta_data': {'author': 'alexander@digilab.co.uk',\n",
723-
" 'version': '3.0.0',\n",
708+
"{'meta_data': {'author': 'jamie@digilab.co.uk',\n",
709+
" 'version': '3.2.0',\n",
724710
" 'campaign': 'personal',\n",
725711
" 'description': 'A twinLab emulator.',\n",
726-
" 'organization': 'digiLab'},\n",
712+
" 'organization': 'digiLab',\n",
713+
" 'timestamp': '2024-08-27 13:49:02'},\n",
727714
" 'emulator_params': {'inputs': ['x'],\n",
728715
" 'outputs': ['y'],\n",
729-
" 'fidelity': None,\n",
730716
" 'estimator': 'gaussian_process_regression',\n",
731-
" 'estimator_params': {'detrend': False, 'estimator_type': 'single_task_gp'},\n",
717+
" 'estimator_params': {'detrend': False,\n",
718+
" 'kernel': None,\n",
719+
" 'estimator_type': 'single_task_gp'},\n",
720+
" 'fidelity': None,\n",
721+
" 'class_column': None,\n",
732722
" 'decompose_inputs': False,\n",
733723
" 'decompose_outputs': False,\n",
734724
" 'input_explained_variance': None,\n",
@@ -783,10 +773,10 @@
783773
" '(raw_lengthscale_constraint): Positive() '\n",
784774
" ') (outputscale_prior): GammaPrior() '\n",
785775
" '(raw_outputscale_constraint): Positive())',\n",
786-
" 'lengthscale': [[0.42345087635328044]],\n",
787-
" 'outputscale': 1.711559921925465},\n",
788-
" 'mean': {'mean': 0.21062309969367052, 'mean_function_used': 'ConstantMean()'},\n",
789-
" 'properties': {'covariance_noise': [0.03031922037067657]}}\n"
776+
" 'lengthscale': [[0.4234508763532827]],\n",
777+
" 'outputscale': 1.7115599219254776},\n",
778+
" 'mean': {'mean': 0.21062309969363022, 'mean_function_used': 'ConstantMean()'},\n",
779+
" 'properties': {'covariance_noise': [0.030319220370676556]}}\n"
790780
]
791781
}
792782
],
@@ -845,7 +835,7 @@
845835
"name": "python",
846836
"nbconvert_exporter": "python",
847837
"pygments_lexer": "ipython3",
848-
"version": "3.11.0"
838+
"version": "3.12.5"
849839
}
850840
},
851841
"nbformat": 4,

notebooks/Recommend_explore.ipynb

Lines changed: 129 additions & 153 deletions
Large diffs are not rendered by default.

notebooks/Recommend_optimize.ipynb

Lines changed: 117 additions & 136 deletions
Large diffs are not rendered by default.

notebooks/Update.ipynb

Lines changed: 647 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)