%global _empty_manifest_terminate_build 0 Name: python-keras-metrics Version: 1.1.0 Release: 1 Summary: Metrics for Keras model evaluation License: MIT License URL: https://github.com/netrack/keras-metrics Source0: https://mirrors.nju.edu.cn/pypi/web/packages/3c/39/46e985d0718d692384c5feb006bb2dcb5846ce60b1ec94db323747b53c90/keras-metrics-1.1.0.tar.gz BuildArch: noarch Requires: python3-Keras %description # Keras Metrics [![Build Status][BuildStatus]](https://travis-ci.org/netrack/keras-metrics) This package provides metrics for evaluation of Keras classification models. The metrics are safe to use for batch-based model evaluation. ## Installation To install the package from the PyPi repository you can execute the following command: ```sh pip install keras-metrics ``` ## Usage The usage of the package is simple: ```py import keras import keras_metrics as km model = models.Sequential() model.add(keras.layers.Dense(1, activation="sigmoid", input_dim=2)) model.add(keras.layers.Dense(1, activation="softmax")) model.compile(optimizer="sgd", loss="binary_crossentropy", metrics=[km.binary_precision(), km.binary_recall()]) ``` Similar configuration for multi-label binary crossentropy: ```py import keras import keras_metrics as km model = models.Sequential() model.add(keras.layers.Dense(1, activation="sigmoid", input_dim=2)) model.add(keras.layers.Dense(2, activation="softmax")) # Calculate precision for the second label. precision = km.binary_precision(label=1) # Calculate recall for the first label. recall = km.binary_recall(label=0) model.compile(optimizer="sgd", loss="binary_crossentropy", metrics=[precision, recall]) ``` Keras metrics package also supports metrics for categorical crossentropy and sparse categorical crossentropy: ```py import keras_metrics as km c_precision = km.categorical_precision() sc_precision = km.sparse_categorical_precision() # ... ``` ## Tensorflow Keras Tensorflow library provides the ```keras``` package as parts of its API, in order to use ```keras_metrics``` with Tensorflow Keras, you are advised to perform model training with initialized global variables: ```py import numpy as np import keras_metrics as km import tensorflow as tf import tensorflow.keras as keras model = keras.Sequential() model.add(keras.layers.Dense(1, activation="softmax")) model.compile(optimizer="sgd", loss="binary_crossentropy", metrics=[km.binary_true_positive()]) x = np.array([[0], [1], [0], [1]]) y = np.array([1, 0, 1, 0] # Wrap model.fit into the session with global # variables initialization. with tf.Session() as s: s.run(tf.global_variables_initializer()) model.fit(x=x, y=y) ``` [BuildStatus]: https://travis-ci.org/netrack/keras-metrics.svg?branch=master %package -n python3-keras-metrics Summary: Metrics for Keras model evaluation Provides: python-keras-metrics BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-keras-metrics # Keras Metrics [![Build Status][BuildStatus]](https://travis-ci.org/netrack/keras-metrics) This package provides metrics for evaluation of Keras classification models. The metrics are safe to use for batch-based model evaluation. ## Installation To install the package from the PyPi repository you can execute the following command: ```sh pip install keras-metrics ``` ## Usage The usage of the package is simple: ```py import keras import keras_metrics as km model = models.Sequential() model.add(keras.layers.Dense(1, activation="sigmoid", input_dim=2)) model.add(keras.layers.Dense(1, activation="softmax")) model.compile(optimizer="sgd", loss="binary_crossentropy", metrics=[km.binary_precision(), km.binary_recall()]) ``` Similar configuration for multi-label binary crossentropy: ```py import keras import keras_metrics as km model = models.Sequential() model.add(keras.layers.Dense(1, activation="sigmoid", input_dim=2)) model.add(keras.layers.Dense(2, activation="softmax")) # Calculate precision for the second label. precision = km.binary_precision(label=1) # Calculate recall for the first label. recall = km.binary_recall(label=0) model.compile(optimizer="sgd", loss="binary_crossentropy", metrics=[precision, recall]) ``` Keras metrics package also supports metrics for categorical crossentropy and sparse categorical crossentropy: ```py import keras_metrics as km c_precision = km.categorical_precision() sc_precision = km.sparse_categorical_precision() # ... ``` ## Tensorflow Keras Tensorflow library provides the ```keras``` package as parts of its API, in order to use ```keras_metrics``` with Tensorflow Keras, you are advised to perform model training with initialized global variables: ```py import numpy as np import keras_metrics as km import tensorflow as tf import tensorflow.keras as keras model = keras.Sequential() model.add(keras.layers.Dense(1, activation="softmax")) model.compile(optimizer="sgd", loss="binary_crossentropy", metrics=[km.binary_true_positive()]) x = np.array([[0], [1], [0], [1]]) y = np.array([1, 0, 1, 0] # Wrap model.fit into the session with global # variables initialization. with tf.Session() as s: s.run(tf.global_variables_initializer()) model.fit(x=x, y=y) ``` [BuildStatus]: https://travis-ci.org/netrack/keras-metrics.svg?branch=master %package help Summary: Development documents and examples for keras-metrics Provides: python3-keras-metrics-doc %description help # Keras Metrics [![Build Status][BuildStatus]](https://travis-ci.org/netrack/keras-metrics) This package provides metrics for evaluation of Keras classification models. The metrics are safe to use for batch-based model evaluation. ## Installation To install the package from the PyPi repository you can execute the following command: ```sh pip install keras-metrics ``` ## Usage The usage of the package is simple: ```py import keras import keras_metrics as km model = models.Sequential() model.add(keras.layers.Dense(1, activation="sigmoid", input_dim=2)) model.add(keras.layers.Dense(1, activation="softmax")) model.compile(optimizer="sgd", loss="binary_crossentropy", metrics=[km.binary_precision(), km.binary_recall()]) ``` Similar configuration for multi-label binary crossentropy: ```py import keras import keras_metrics as km model = models.Sequential() model.add(keras.layers.Dense(1, activation="sigmoid", input_dim=2)) model.add(keras.layers.Dense(2, activation="softmax")) # Calculate precision for the second label. precision = km.binary_precision(label=1) # Calculate recall for the first label. recall = km.binary_recall(label=0) model.compile(optimizer="sgd", loss="binary_crossentropy", metrics=[precision, recall]) ``` Keras metrics package also supports metrics for categorical crossentropy and sparse categorical crossentropy: ```py import keras_metrics as km c_precision = km.categorical_precision() sc_precision = km.sparse_categorical_precision() # ... ``` ## Tensorflow Keras Tensorflow library provides the ```keras``` package as parts of its API, in order to use ```keras_metrics``` with Tensorflow Keras, you are advised to perform model training with initialized global variables: ```py import numpy as np import keras_metrics as km import tensorflow as tf import tensorflow.keras as keras model = keras.Sequential() model.add(keras.layers.Dense(1, activation="softmax")) model.compile(optimizer="sgd", loss="binary_crossentropy", metrics=[km.binary_true_positive()]) x = np.array([[0], [1], [0], [1]]) y = np.array([1, 0, 1, 0] # Wrap model.fit into the session with global # variables initialization. with tf.Session() as s: s.run(tf.global_variables_initializer()) model.fit(x=x, y=y) ``` [BuildStatus]: https://travis-ci.org/netrack/keras-metrics.svg?branch=master %prep %autosetup -n keras-metrics-1.1.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-keras-metrics -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Apr 25 2023 Python_Bot - 1.1.0-1 - Package Spec generated