summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-11 18:47:16 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-11 18:47:16 +0000
commit0b9632845046d9995fab4f23f163a1c4da811b4b (patch)
treea048bea8db13ec603586c5d7825430b29dad3799
parent87862928475ac13f52a175ec09dd37ddc3a4faf6 (diff)
automatic import of python-keras-metrics
-rw-r--r--.gitignore1
-rw-r--r--python-keras-metrics.spec349
-rw-r--r--sources1
3 files changed, 351 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..03fcc84 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/keras-metrics-1.1.0.tar.gz
diff --git a/python-keras-metrics.spec b/python-keras-metrics.spec
new file mode 100644
index 0000000..3e4850c
--- /dev/null
+++ b/python-keras-metrics.spec
@@ -0,0 +1,349 @@
+%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 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..8b7e31a
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+4eef07ad1a57a62f0577fbc030f7b8c6 keras-metrics-1.1.0.tar.gz