Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
UnravelSports [JB] committed Jul 23, 2024
1 parent f5de05f commit a24aa77
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 373 deletions.
226 changes: 12 additions & 214 deletions examples/0_quick_start_guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,9 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Processing frames: 100%|██████████| 500/500 [00:00<00:00, 561.72it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Loading 477 graphs into CustomSpektralDataset...\n",
"Loading 477 graphs into CustomSpektralDataset...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"outputs": [],
"source": [
"from unravel.soccer import GraphConverter\n",
"from unravel.utils import CustomSpektralDataset\n",
Expand Down Expand Up @@ -93,7 +70,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -116,17 +93,9 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:absl:At this time, the v2.11+ optimizer `tf.keras.optimizers.Adam` runs slowly on M1/M2 Macs, please use the legacy Keras optimizer instead, located at `tf.keras.optimizers.legacy.Adam`.\n"
]
}
],
"outputs": [],
"source": [
"from unravel.classifiers import CrystalGraphClassifier\n",
"\n",
Expand All @@ -153,74 +122,9 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Epoch 1/10\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/jbekkers/PycharmProjects/unravelsports/.venv311/lib/python3.11/site-packages/keras/src/initializers/initializers.py:120: UserWarning: The initializer GlorotUniform is unseeded and being called multiple times, which will return identical values each time (even if the initializer is unseeded). Please update your code to provide a seed to the initializer, or avoid using the same initializer instance more than once.\n",
" warnings.warn(\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"10/10 [==============================] - 2s 26ms/step - loss: 16.1988 - auc: 0.4597 - binary_accuracy: 0.4560 - val_loss: 7.9675 - val_auc: 0.5101 - val_binary_accuracy: 0.4625\n",
"Epoch 2/10\n",
"10/10 [==============================] - ETA: 0s - loss: 8.1257 - auc: 0.5055 - binary_accuracy: 0.5283 WARNING:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches (in this case, 3 batches). You may need to use the repeat() function when building your dataset.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches (in this case, 3 batches). You may need to use the repeat() function when building your dataset.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"10/10 [==============================] - 0s 9ms/step - loss: 8.1257 - auc: 0.5055 - binary_accuracy: 0.5283\n",
"Epoch 3/10\n",
"10/10 [==============================] - 0s 8ms/step - loss: 3.8924 - auc: 0.5408 - binary_accuracy: 0.5535\n",
"Epoch 4/10\n",
"10/10 [==============================] - 0s 10ms/step - loss: 3.6436 - auc: 0.4814 - binary_accuracy: 0.5000\n",
"Epoch 5/10\n",
"10/10 [==============================] - 0s 11ms/step - loss: 2.2543 - auc: 0.4966 - binary_accuracy: 0.4969\n",
"Epoch 6/10\n",
"10/10 [==============================] - 0s 6ms/step - loss: 1.7266 - auc: 0.4905 - binary_accuracy: 0.4780\n",
"Epoch 7/10\n",
"10/10 [==============================] - 0s 6ms/step - loss: 1.4315 - auc: 0.5282 - binary_accuracy: 0.5126\n",
"Epoch 8/10\n",
"10/10 [==============================] - 0s 9ms/step - loss: 1.1989 - auc: 0.5094 - binary_accuracy: 0.4748\n",
"Epoch 9/10\n",
"10/10 [==============================] - 0s 8ms/step - loss: 0.9823 - auc: 0.5714 - binary_accuracy: 0.5440\n",
"Epoch 10/10\n",
"10/10 [==============================] - 0s 6ms/step - loss: 1.0795 - auc: 0.5228 - binary_accuracy: 0.5031\n"
]
},
{
"data": {
"text/plain": [
"<keras.src.callbacks.History at 0x1779b2410>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"from tensorflow.keras.callbacks import EarlyStopping\n",
"\n",
Expand Down Expand Up @@ -254,17 +158,9 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3/3 [==============================] - 0s 22ms/step - loss: 0.7569 - auc: 0.4881 - binary_accuracy: 0.4684\n"
]
}
],
"outputs": [],
"source": [
"loader_te = DisjointLoader(test, epochs=1, shuffle=False, batch_size=batch_size)\n",
"results = model.evaluate(loader_te.load())"
Expand All @@ -283,110 +179,12 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4/4 [==============================] - 0s 11ms/step\n"
]
},
{
"data": {
"text/plain": [
"array([[0.32064953],\n",
" [0.5187207 ],\n",
" [0.36767447],\n",
" [0.58158153],\n",
" [0.648303 ],\n",
" [0.7250808 ],\n",
" [0.45932224],\n",
" [0.17837673],\n",
" [0.40539873],\n",
" [0.4424542 ],\n",
" [0.30549103],\n",
" [0.4686426 ],\n",
" [0.45274827],\n",
" [0.48409605],\n",
" [0.52468264],\n",
" [0.48941866],\n",
" [0.45071444],\n",
" [0.40024903],\n",
" [0.43896046],\n",
" [0.4752483 ],\n",
" [0.6113058 ],\n",
" [0.51407444],\n",
" [0.63001126],\n",
" [0.4740725 ],\n",
" [0.6078143 ],\n",
" [0.42406863],\n",
" [0.42664722],\n",
" [0.5456678 ],\n",
" [0.6497228 ],\n",
" [0.10468224],\n",
" [0.28870958],\n",
" [0.35573283],\n",
" [0.50675493],\n",
" [0.26084217],\n",
" [0.5045665 ],\n",
" [0.4551955 ],\n",
" [0.2941906 ],\n",
" [0.17870983],\n",
" [0.645881 ],\n",
" [0.44119328],\n",
" [0.5141012 ],\n",
" [0.4944313 ],\n",
" [0.5526908 ],\n",
" [0.3726117 ],\n",
" [0.01953349],\n",
" [0.43424365],\n",
" [0.6119593 ],\n",
" [0.17366503],\n",
" [0.32349864],\n",
" [0.23837146],\n",
" [0.36960262],\n",
" [0.40078542],\n",
" [0.60070145],\n",
" [0.38831863],\n",
" [0.4297107 ],\n",
" [0.30132666],\n",
" [0.19354764],\n",
" [0.33943865],\n",
" [0.6698272 ],\n",
" [0.493429 ],\n",
" [0.71516454],\n",
" [0.47075588],\n",
" [0.9052064 ],\n",
" [0.48426422],\n",
" [0.51765573],\n",
" [0.621886 ],\n",
" [0.56246924],\n",
" [0.5652972 ],\n",
" [0.46242762],\n",
" [0.57170457],\n",
" [0.18469568],\n",
" [0.42506087],\n",
" [0.69418275],\n",
" [0.37345868],\n",
" [0.50700355],\n",
" [0.4964876 ],\n",
" [0.32357928],\n",
" [0.692147 ],\n",
" [0.5441656 ]], dtype=float32)"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"loader_te = DisjointLoader(test, batch_size=batch_size, epochs=1, shuffle=False)\n",
"loaded_pred = model.predict(loader_te.load(), use_multiprocessing=True)\n",
"\n",
"loaded_pred"
"loaded_pred = model.predict(loader_te.load(), use_multiprocessing=True)"
]
}
],
Expand Down
Loading

0 comments on commit a24aa77

Please sign in to comment.