home scroll keras

keras

Keras Version

Do I have keras version 2 or 3?

The version of Keras depends on the installed version of tensorflow.
Before TensorFlow 2.16, installing TensorFlow would install Keras 2.
Starting with TensorFlow 2.16, installing TensorFlow would install Keras 3.

Keras version 3 introduction:

https://keras.io/keras_3/

model metrics

https://keras.io/api/metrics/

The metrics that are available after running model.fit() depend upon the parameters given to model.compile().
Regression Problem
model.compile(loss="mean_squared_error", optimizer="adam")
model.fit(..)
print("model.metrics_names",model.metrics_names)
model.metrics_names ['loss']

model.compile(loss="mean_squared_error", optimizer="adam", metrics=["RootMeanSquaredError"]) model.fit(..)
print("model.metrics_names",model.metrics_names)
model.metrics_names ['loss', 'root_mean_squared_error']

Classification Problem
model.compile(loss="binary_crossentropy", optimizer="adam", metrics=["accuracy"]) model.fit(..)
print("model.metrics_names",model.metrics_names)
model.metrics_names ['loss', 'accuracy']
Note:

Accuracy is typically used for classification tasks, whereas Mean Squared Error is more commonly used for regression tasks.

HDF5 Storage

Viewing hdf5 files
view groups:
h5ls file.h5

view values:
h5ls -rd file.h5

h5dump file.h5

https://pypi.org/project/hdf5view/
Install:
pip install hdf5view
Run:
hdf5view

Find out if an H5 file contains a specific node:

import tables as tb try: node.__contains__(node.training_config) print('contains training_config') except tb.NoSuchNodeError: etc.

Data Types
https://www.pytables.org/usersguide/libref/declarative_classes.html#the-col-class-and-its-descendants


Category

Installation
Usage

Follow Me

discord