diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-mngs.spec | 539 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 541 insertions, 0 deletions
@@ -0,0 +1 @@ +/mngs-0.4.0.tar.gz diff --git a/python-mngs.spec b/python-mngs.spec new file mode 100644 index 0000000..febefa6 --- /dev/null +++ b/python-mngs.spec @@ -0,0 +1,539 @@ +%global _empty_manifest_terminate_build 0 +Name: python-mngs +Version: 0.4.0 +Release: 1 +Summary: For lazy python users (monogusa people in Japanse), especially in ML/DSP fields +License: GPL3.0 +URL: https://github.com/ywatanabe1989/mngs +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f2/95/0bc28b15ac436c49c9becb10049eddf3c0c94860908fbe74e94ca3d20afc/mngs-0.4.0.tar.gz +BuildArch: noarch + +Requires: python3-chardet +Requires: python3-GitPython +Requires: python3-h5py +Requires: python3-joblib +Requires: python3-matplotlib +Requires: python3-natsort +Requires: python3-numpy +Requires: python3-pandas +Requires: python3-pymatreader +Requires: python3-PyYAML +Requires: python3-scipy +Requires: python3-seaborn +Requires: python3-sklearn +Requires: python3-statsmodels +Requires: python3-torch +Requires: python3-xmltodict +Requires: python3-openpyxl +Requires: python3-obspy +Requires: python3-pyro-ppl +Requires: python3-torchaudio +Requires: python3-scikit-learn +Requires: python3-psutil +Requires: python3-pyedflib + +%description +## Requirements +``` +chardet +GitPython +h5py +joblib +matplotlib +natsort +numpy +pandas +pymatreader +PyYAML +scipy +seaborn +sklearn +statsmodels +torch +xmltodict +``` + +## Installation +``` bash +$ pip install mngs + +or + +$ pip install git+https://github.com/ywatanabe1989/mngs.git@develop +``` + + + +## mngs.general.save +``` python +import mngs +import numpy as np +import matplotlib.pyplot as plt +import pandas as pd + +## numpy +arr = np.arange(10) +mngs.general.save(arr, 'spath.npy') + +## pandas +df = pd.DataFrame(arr) +mngs.general.save(df, 'spath.csv') + +## matplotlib +fig, ax = plt.subplots() +ax.plot(arr) +mngs.general.save(fig, 'spath.png) +``` + +## mngs.general.load +``` python +import mngs +arr = mngs.general.load('spath.npy') +arr = mngs.general.load('spath.mat') +df = mngs.general.load('spath.npy') +yaml_dict = mngs.general.load('spath.yaml') +hdf5_dict = mngs.general.load('spath.hdf5') +``` + +## mngs.general.fix_seeds + +``` python +import mngs +import os +import random +import numpy as np +import torch + +mngs.general.fix_seeds(os=os, random=random, np=np, torch=torch, tf=None, seed=42) +``` + +## mngs.general.tee +``` python +import sys +sys.stdout, sys.stderr = tee(sys) +print("abc") # also wrriten in stdout +print(1 / 0) # also wrriten in stderr +``` + +## mngs.plt.configure_mpl +``` python +configure_mpl( + plt, + dpi=100, + figsize=(16.2, 10), + figscale=1.0, + fontsize=16, + labelsize="same", + legendfontsize="xx-small", + tick_size="auto", + tick_width="auto", + hide_spines=False, +) +``` + +## mngs.plt.ax_* +- mngs.plt.ax_extend +- mngs.plt.ax_scientific_notation +- mngs.plt.ax_set_position + +## mngs.ml.Reporter +Now, classification task is available. +``` python +reporter = mngs.ml.Reporter(sdir=log_dir) +for i_fold in range(N_FOLDS): + ... + print("\n--- Metrics ---\n") + reporter.calc_metrics( + T_tes, + pred_class_tes, + pred_proba_tes, + labels=[class_0, class_1, class_2], + i_fold=i_fold, + ) + print("\n---------------\n") + +reporter.summarize() +reporter.save() +``` + +The above lines makes reportes and figures. +``` bash +$ tree $log_dir +├── aucs.csv +├── bACCs.csv +├── balanced_accs.csv +├── clf_reports.csv +├── conf_mat +│ ├── conf_mats.csv +│ ├── fold#0.png +│ ├── fold#1.png +│ ├── fold#2.png +│ └── overall_sum.png +├── mccs.csv +├── pre_rec_curves +│ ├── fold#0.png +│ ├── fold#1.png +│ └── fold#2.png +└── roc_curves + ├── fold#0.png + ├── fold#1.png + └── fold#2.png +``` + + + + +%package -n python3-mngs +Summary: For lazy python users (monogusa people in Japanse), especially in ML/DSP fields +Provides: python-mngs +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-mngs +## Requirements +``` +chardet +GitPython +h5py +joblib +matplotlib +natsort +numpy +pandas +pymatreader +PyYAML +scipy +seaborn +sklearn +statsmodels +torch +xmltodict +``` + +## Installation +``` bash +$ pip install mngs + +or + +$ pip install git+https://github.com/ywatanabe1989/mngs.git@develop +``` + + + +## mngs.general.save +``` python +import mngs +import numpy as np +import matplotlib.pyplot as plt +import pandas as pd + +## numpy +arr = np.arange(10) +mngs.general.save(arr, 'spath.npy') + +## pandas +df = pd.DataFrame(arr) +mngs.general.save(df, 'spath.csv') + +## matplotlib +fig, ax = plt.subplots() +ax.plot(arr) +mngs.general.save(fig, 'spath.png) +``` + +## mngs.general.load +``` python +import mngs +arr = mngs.general.load('spath.npy') +arr = mngs.general.load('spath.mat') +df = mngs.general.load('spath.npy') +yaml_dict = mngs.general.load('spath.yaml') +hdf5_dict = mngs.general.load('spath.hdf5') +``` + +## mngs.general.fix_seeds + +``` python +import mngs +import os +import random +import numpy as np +import torch + +mngs.general.fix_seeds(os=os, random=random, np=np, torch=torch, tf=None, seed=42) +``` + +## mngs.general.tee +``` python +import sys +sys.stdout, sys.stderr = tee(sys) +print("abc") # also wrriten in stdout +print(1 / 0) # also wrriten in stderr +``` + +## mngs.plt.configure_mpl +``` python +configure_mpl( + plt, + dpi=100, + figsize=(16.2, 10), + figscale=1.0, + fontsize=16, + labelsize="same", + legendfontsize="xx-small", + tick_size="auto", + tick_width="auto", + hide_spines=False, +) +``` + +## mngs.plt.ax_* +- mngs.plt.ax_extend +- mngs.plt.ax_scientific_notation +- mngs.plt.ax_set_position + +## mngs.ml.Reporter +Now, classification task is available. +``` python +reporter = mngs.ml.Reporter(sdir=log_dir) +for i_fold in range(N_FOLDS): + ... + print("\n--- Metrics ---\n") + reporter.calc_metrics( + T_tes, + pred_class_tes, + pred_proba_tes, + labels=[class_0, class_1, class_2], + i_fold=i_fold, + ) + print("\n---------------\n") + +reporter.summarize() +reporter.save() +``` + +The above lines makes reportes and figures. +``` bash +$ tree $log_dir +├── aucs.csv +├── bACCs.csv +├── balanced_accs.csv +├── clf_reports.csv +├── conf_mat +│ ├── conf_mats.csv +│ ├── fold#0.png +│ ├── fold#1.png +│ ├── fold#2.png +│ └── overall_sum.png +├── mccs.csv +├── pre_rec_curves +│ ├── fold#0.png +│ ├── fold#1.png +│ └── fold#2.png +└── roc_curves + ├── fold#0.png + ├── fold#1.png + └── fold#2.png +``` + + + + +%package help +Summary: Development documents and examples for mngs +Provides: python3-mngs-doc +%description help +## Requirements +``` +chardet +GitPython +h5py +joblib +matplotlib +natsort +numpy +pandas +pymatreader +PyYAML +scipy +seaborn +sklearn +statsmodels +torch +xmltodict +``` + +## Installation +``` bash +$ pip install mngs + +or + +$ pip install git+https://github.com/ywatanabe1989/mngs.git@develop +``` + + + +## mngs.general.save +``` python +import mngs +import numpy as np +import matplotlib.pyplot as plt +import pandas as pd + +## numpy +arr = np.arange(10) +mngs.general.save(arr, 'spath.npy') + +## pandas +df = pd.DataFrame(arr) +mngs.general.save(df, 'spath.csv') + +## matplotlib +fig, ax = plt.subplots() +ax.plot(arr) +mngs.general.save(fig, 'spath.png) +``` + +## mngs.general.load +``` python +import mngs +arr = mngs.general.load('spath.npy') +arr = mngs.general.load('spath.mat') +df = mngs.general.load('spath.npy') +yaml_dict = mngs.general.load('spath.yaml') +hdf5_dict = mngs.general.load('spath.hdf5') +``` + +## mngs.general.fix_seeds + +``` python +import mngs +import os +import random +import numpy as np +import torch + +mngs.general.fix_seeds(os=os, random=random, np=np, torch=torch, tf=None, seed=42) +``` + +## mngs.general.tee +``` python +import sys +sys.stdout, sys.stderr = tee(sys) +print("abc") # also wrriten in stdout +print(1 / 0) # also wrriten in stderr +``` + +## mngs.plt.configure_mpl +``` python +configure_mpl( + plt, + dpi=100, + figsize=(16.2, 10), + figscale=1.0, + fontsize=16, + labelsize="same", + legendfontsize="xx-small", + tick_size="auto", + tick_width="auto", + hide_spines=False, +) +``` + +## mngs.plt.ax_* +- mngs.plt.ax_extend +- mngs.plt.ax_scientific_notation +- mngs.plt.ax_set_position + +## mngs.ml.Reporter +Now, classification task is available. +``` python +reporter = mngs.ml.Reporter(sdir=log_dir) +for i_fold in range(N_FOLDS): + ... + print("\n--- Metrics ---\n") + reporter.calc_metrics( + T_tes, + pred_class_tes, + pred_proba_tes, + labels=[class_0, class_1, class_2], + i_fold=i_fold, + ) + print("\n---------------\n") + +reporter.summarize() +reporter.save() +``` + +The above lines makes reportes and figures. +``` bash +$ tree $log_dir +├── aucs.csv +├── bACCs.csv +├── balanced_accs.csv +├── clf_reports.csv +├── conf_mat +│ ├── conf_mats.csv +│ ├── fold#0.png +│ ├── fold#1.png +│ ├── fold#2.png +│ └── overall_sum.png +├── mccs.csv +├── pre_rec_curves +│ ├── fold#0.png +│ ├── fold#1.png +│ └── fold#2.png +└── roc_curves + ├── fold#0.png + ├── fold#1.png + └── fold#2.png +``` + + + + +%prep +%autosetup -n mngs-0.4.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-mngs -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 0.4.0-1 +- Package Spec generated @@ -0,0 +1 @@ +e2226fff65b1e9a1b44e233c9db252f9 mngs-0.4.0.tar.gz |