Experimenting with libpython-clj 1.28
(require (quote [libpython-clj.require :as req :refer [require-python] :reload true]) (quote [libpython-clj.python :refer [as-python as-jvm ->python ->jvm get-attr call-attr call-attr-kw get-item att-type-map call call-kw initialize! as-numpy as-tensor ->numpy run-simple-string add-module module-dict import-module python-type] :as py]) (quote [basic-tests.utils :refer [def+ matplotlib->svg]]))nilthe dot in python has multiple meanings what are the elements between the dots :
tfds.Split.TRAIN.subsplit
In the following tutorial: https://www.tensorflow.org/tutorials/keras/classification
We find the following code:
import tensorflow_datasets as tfds
train_validation_split = tfds.Split.TRAIN.subsplit ([6, 4])
We can assume that subsplit is a method But what are Split and TRAIN? Are they modules, classes?
import tensorflow_datasets as tfds
type (tfds.Split)
<class 'type'>
type (tfds.Split.TRAIN)
<class 'tensorflow_datasets.core.splits.NamedSplit'>
The best way to implement in clojure seems to be:
(py/import-as tensorflow tf)(py/import-as tensorflow_datasets tfds)(def train (py/$.. tfds Split TRAIN))(py/call-attr train "subsplit" (py/->py-list [6 4]))(NamedSplit('train')(tfds.percent[0:60]), NamedSplit('train')(tfds.percent[60:100]))