Skip to content

Commit 1ab0d29

Browse files
committed
release as PyPI package
1 parent 50d73c6 commit 1ab0d29

File tree

7 files changed

+91
-73
lines changed

7 files changed

+91
-73
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
__pycache__
2-
32
*.egg-info
3+
build
4+
dist

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
rev: 20.8b1
1111
hooks:
1212
- id: black
13-
- repo: https://gitlab.com/pycqa/flake8
13+
- repo: https://github.com/PyCQA/flake8
1414
rev: 3.9.0
1515
hooks:
1616
- id: flake8

ml_matrics/elements.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from matplotlib.cm import get_cmap
88
from matplotlib.colors import LogNorm, Normalize
99
from matplotlib.patches import Rectangle
10-
from pymatgen import Composition
10+
from pymatgen.core import Composition
1111

1212
from ml_matrics.utils import ROOT, annotate_bar_heights
1313

readme.md

+37-51
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ A toolkit of metrics and visualizations for model performance in data-driven mat
66

77
[![Tests](https://github.com/janosh/ml-matrics/workflows/Tests/badge.svg)](https://github.com/janosh/ml-matrics/actions)
88
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/janosh/ml-matrics/main.svg)](https://results.pre-commit.ci/latest/github/janosh/ml-matrics/main)
9+
[![PyPI](https://img.shields.io/pypi/v/ml-matrics)](https://pypi.org/project/ml-matrics)
10+
[![This project supports Python 3.8+](https://img.shields.io/badge/Python-3.8+-blue.svg)](https://python.org/downloads)
911
[![License](https://img.shields.io/github/license/janosh/ml-matrics?label=License)](/license)
1012
[![GitHub Repo Size](https://img.shields.io/github/repo-size/janosh/ml-matrics?label=Repo+Size)](https://github.com/janosh/ml-matrics/graphs/contributors)
11-
[![This project supports Python 3.8+](https://img.shields.io/badge/Python-3.8+-blue.svg)](https://python.org/downloads)
1213

1314
</h4>
1415

1516
## Installation
1617

1718
```sh
18-
pip install -U git+https://github.com/janosh/ml-matrics
19+
pip install ml-matrics
1920
```
2021

2122
For a locally editable install, use
@@ -24,94 +25,79 @@ For a locally editable install, use
2425
git clone https://github.com/janosh/ml-matrics && pip install -e ml-matrics
2526
```
2627

27-
To specify a dependence on this package in `requirements.txt`, use
28-
29-
```txt
30-
pandas==1.1.2
31-
numpy==1.20.1
32-
git+git://github.com/janosh/ml-matrics
33-
```
34-
35-
To specify a specific branch or commit, append its name or hash, e.g.
36-
37-
```txt
38-
git+git://github.com/janosh/ml-matrics@main # default
39-
git+git://github.com/janosh/ml-matrics@41b95ec
40-
```
41-
4228
## Parity Plots
4329

4430
See [`ml_matrics/parity.py`](ml_matrics/parity.py).
4531

46-
| [`density_scatter(xs, ys, ...)`](ml_matrics/parity.py) | [`density_scatter_with_hist(xs, ys, ...)`](ml_matrics/parity.py) |
47-
| :---------------------------------------------------------------: | :----------------------------------------------------------------: |
48-
| ![density_scatter](assets/density_scatter.svg) | ![density_scatter_with_hist](assets/density_scatter_with_hist.svg) |
49-
| [`density_hexbin(xs, ys, ...)`](ml_matrics/parity.py) | [`density_hexbin_with_hist(xs, ys, ...)`](ml_matrics/parity.py) |
50-
| ![density_hexbin](assets/density_hexbin.svg) | ![density_hexbin_with_hist](assets/density_hexbin_with_hist.svg) |
51-
| [`scatter_with_err_bar(xs, ys, yerr, ...)`](ml_matrics/parity.py) | [`residual_vs_actual(y_true, y_pred, ...)`](ml_matrics/parity.py) |
52-
| ![scatter_with_err_bar](assets/scatter_with_err_bar.svg) | ![residual_vs_actual](assets/residual_vs_actual.svg) |
32+
| [`density_scatter(xs, ys, ...)`](ml_matrics/parity.py) | [`density_scatter_with_hist(xs, ys, ...)`](ml_matrics/parity.py) |
33+
| :---------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------: |
34+
| ![density_scatter](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/density_scatter.svg) | ![density_scatter_with_hist](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/density_scatter_with_hist.svg) |
35+
| [`density_hexbin(xs, ys, ...)`](ml_matrics/parity.py) | [`density_hexbin_with_hist(xs, ys, ...)`](ml_matrics/parity.py) |
36+
| ![density_hexbin](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/density_hexbin.svg) | ![density_hexbin_with_hist](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/density_hexbin_with_hist.svg) |
37+
| [`scatter_with_err_bar(xs, ys, yerr, ...)`](ml_matrics/parity.py) | [`residual_vs_actual(y_true, y_pred, ...)`](ml_matrics/parity.py) |
38+
| ![scatter_with_err_bar](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/scatter_with_err_bar.svg) | ![residual_vs_actual](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/residual_vs_actual.svg) |
5339

5440
## Elements
5541

5642
See [`ml_matrics/elements.py`](ml_matrics/elements.py).
5743

58-
| [`ptable_elemental_prevalence(compositions)`](ml_matrics/elements.py) | [`ptable_elemental_prevalence(compositions, log=True)`](ml_matrics/elements.py) |
59-
| :--------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------: |
60-
| ![ptable_elemental_prevalence](assets/ptable_elemental_prevalence.svg) | ![ptable_elemental_prevalence_log](assets/ptable_elemental_prevalence_log.svg) |
61-
| [`hist_elemental_prevalence(compositions)`](ml_matrics/elements.py) | [`hist_elemental_prevalence(compositions, log=True, bar_values='count')`](ml_matrics/elements.py) |
62-
| ![hist_elemental_prevalence](assets/hist_elemental_prevalence.svg) | ![hist_elemental_prevalence_log_count](assets/hist_elemental_prevalence_log_count.svg) |
63-
| [`ptable_elemental_ratio(comps_a, comps_b)`](ml_matrics/elements.py) | [`ptable_elemental_ratio(comps_b, comps_a, log=True)`](ml_matrics/elements.py) |
64-
| ![ptable_elemental_ratio](assets/ptable_elemental_ratio.svg) | ![ptable_elemental_ratio_log](assets/ptable_elemental_ratio_log.svg) |
44+
| [`ptable_elemental_prevalence(compositions)`](ml_matrics/elements.py) | [`ptable_elemental_prevalence(compositions, log=True)`](ml_matrics/elements.py) |
45+
| :-----------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------: |
46+
| ![ptable_elemental_prevalence](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/ptable_elemental_prevalence.svg) | ![ptable_elemental_prevalence_log](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/ptable_elemental_prevalence_log.svg) |
47+
| [`hist_elemental_prevalence(compositions)`](ml_matrics/elements.py) | [`hist_elemental_prevalence(compositions, log=True, bar_values='count')`](ml_matrics/elements.py) |
48+
| ![hist_elemental_prevalence](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/hist_elemental_prevalence.svg) | ![hist_elemental_prevalence_log_count](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/hist_elemental_prevalence_log_count.svg) |
49+
| [`ptable_elemental_ratio(comps_a, comps_b)`](ml_matrics/elements.py) | [`ptable_elemental_ratio(comps_b, comps_a, log=True)`](ml_matrics/elements.py) |
50+
| ![ptable_elemental_ratio](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/ptable_elemental_ratio.svg) | ![ptable_elemental_ratio_log](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/ptable_elemental_ratio_log.svg) |
6551

6652
## Uncertainty Calibration
6753

6854
See [`ml_matrics/quantile.py`](ml_matrics/quantile.py).
6955

70-
| [`qq_gaussian(y_true, y_pred, y_std)`](ml_matrics/quantile.py) | [`qq_gaussian(y_true, y_pred, y_std: dict)`](ml_matrics/quantile.py) |
71-
| :------------------------------------------------------------: | :------------------------------------------------------------------: |
72-
| ![normal_prob_plot](assets/normal_prob_plot.svg) | ![normal_prob_plot_multiple](assets/normal_prob_plot_multiple.svg) |
56+
| [`qq_gaussian(y_true, y_pred, y_std)`](ml_matrics/quantile.py) | [`qq_gaussian(y_true, y_pred, y_std: dict)`](ml_matrics/quantile.py) |
57+
| :-------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------: |
58+
| ![normal_prob_plot](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/normal_prob_plot.svg) | ![normal_prob_plot_multiple](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/normal_prob_plot_multiple.svg) |
7359

7460
## Ranking
7561

7662
See [`ml_matrics/ranking.py`](ml_matrics/ranking.py).
7763

78-
| [`err_decay(y_true, y_pred, y_std)`](ml_matrics/ranking.py) | [`err_decay(y_true, y_pred, y_std: dict)`](ml_matrics/ranking.py) |
79-
| :---------------------------------------------------------: | :---------------------------------------------------------------: |
80-
| ![err_decay](assets/err_decay.svg) | ![err_decay_multiple](assets/err_decay_multiple.svg) |
64+
| [`err_decay(y_true, y_pred, y_std)`](ml_matrics/ranking.py) | [`err_decay(y_true, y_pred, y_std: dict)`](ml_matrics/ranking.py) |
65+
| :-----------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------: |
66+
| ![err_decay](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/err_decay.svg) | ![err_decay_multiple](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/err_decay_multiple.svg) |
8167

8268
## Cumulative Error and Residual
8369

8470
See [`ml_matrics/cumulative.py`](ml_matrics/cumulative.py).
8571

86-
| [`cum_err(preds, targets)`](ml_matrics/cumulative.py) | [`cum_res(preds, targets)`](ml_matrics/cumulative.py) |
87-
| :---------------------------------------------------: | :----------------------------------------------------: |
88-
| ![cumulative_error](assets/cumulative_error.svg) | ![cumulative_residual](assets/cumulative_residual.svg) |
72+
| [`cum_err(preds, targets)`](ml_matrics/cumulative.py) | [`cum_res(preds, targets)`](ml_matrics/cumulative.py) |
73+
| :-------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------: |
74+
| ![cumulative_error](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/cumulative_error.svg) | ![cumulative_residual](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/cumulative_residual.svg) |
8975

9076
## Classification Metrics
9177

9278
See [`ml_matrics/relevance.py`](ml_matrics/relevance.py).
9379

94-
| [`roc_curve(targets, proba_pos)`](ml_matrics/relevance.py) | [`precision_recall_curve(targets, proba_pos)`](ml_matrics/relevance.py) |
95-
| :--------------------------------------------------------: | :---------------------------------------------------------------------: |
96-
| ![roc_curve](assets/roc_curve.svg) | ![precision_recall_curve](assets/precision_recall_curve.svg) |
80+
| [`roc_curve(targets, proba_pos)`](ml_matrics/relevance.py) | [`precision_recall_curve(targets, proba_pos)`](ml_matrics/relevance.py) |
81+
| :-----------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: |
82+
| ![roc_curve](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/roc_curve.svg) | ![precision_recall_curve](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/precision_recall_curve.svg) |
9783

9884
## Correlation
9985

10086
See [`ml_matrics/correlation.py`](ml_matrics/correlation.py).
10187

102-
| [`marchenko_pastur(corr_mat, gamma=ncols/nrows)`](ml_matrics/correlation.py) | [`marchenko_pastur(corr_mat_significant_eval, gamma=ncols/nrows)`](ml_matrics/correlation.py) |
103-
| :--------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------: |
104-
| ![marchenko_pastur](assets/marchenko_pastur.svg) | ![marchenko_pastur_significant_eval](assets/marchenko_pastur_significant_eval.svg) |
88+
| [`marchenko_pastur(corr_mat, gamma=ncols/nrows)`](ml_matrics/correlation.py) | [`marchenko_pastur(corr_mat_significant_eval, gamma=ncols/nrows)`](ml_matrics/correlation.py) |
89+
| :-------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------: |
90+
| ![marchenko_pastur](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/marchenko_pastur.svg) | ![marchenko_pastur_significant_eval](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/marchenko_pastur_significant_eval.svg) |
10591

10692
## Histograms
10793

10894
See [`ml_matrics/histograms.py`](ml_matrics/histograms.py).
10995

110-
| [`residual_hist(y_true, y_pred)`](ml_matrics/histograms.py) | [`true_pred_hist(y_true, y_pred, y_std)`](ml_matrics/histograms.py) |
111-
| :-----------------------------------------------------------: | :-----------------------------------------------------------------: |
112-
| ![residual_hist](assets/residual_hist.svg) | ![true_pred_hist](assets/true_pred_hist.svg) |
113-
| [`spacegroup_hist(y_true, y_pred)`](ml_matrics/histograms.py) | |
114-
| ![spacegroup_hist](assets/spacegroup_hist.svg) | |
96+
| [`residual_hist(y_true, y_pred)`](ml_matrics/histograms.py) | [`true_pred_hist(y_true, y_pred, y_std)`](ml_matrics/histograms.py) |
97+
| :-----------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------: |
98+
| ![residual_hist](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/residual_hist.svg) | ![true_pred_hist](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/true_pred_hist.svg) |
99+
| [`spacegroup_hist(y_true, y_pred)`](ml_matrics/histograms.py) | |
100+
| ![spacegroup_hist](https://raw.githubusercontent.com/janosh/ml-matrics/main/assets/spacegroup_hist.svg) | |
115101

116102
## Adding Assets
117103

scripts/fetch_mp_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# %%
22
import pandas as pd
33
from matminer.datasets import load_dataset
4-
from pymatgen import MPRester
4+
from pymatgen.ext.matproj import MPRester
55

66
from ml_matrics import ROOT
77

setup.cfg

+47-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
[metadata]
2+
name = ml-matrics
3+
version = 0.1.0
4+
description = Metrics and visualizations for model performance in data-driven materials discovery
5+
long_description = file: readme.md
6+
long_description_content_type = text/markdown
7+
url = https://github.com/janosh/ml-matrics
8+
author = Janosh Riebesell
9+
author_email = [email protected]
10+
license = MIT
11+
license_file = license
12+
keywords = machine-learning, materials-discovery, metrics, plots, visualizations, model-performance
13+
classifiers =
14+
Programming Language :: Python :: 3
15+
Programming Language :: Python :: 3 :: Only
16+
Programming Language :: Python :: 3.6
17+
Programming Language :: Python :: 3.7
18+
Programming Language :: Python :: 3.8
19+
Programming Language :: Python :: 3.9
20+
License :: OSI Approved :: MIT License
21+
22+
[options]
23+
packages = find:
24+
package_data =
25+
python_requires = >=3.6
26+
install_requires=
27+
numpy >= 1.19
28+
pandas >= 1.0.0
29+
matplotlib >= 3.1
30+
pymatgen >= 2021.2.16
31+
scipy >= 1.5
32+
scikit_learn >= 0.24
33+
34+
[options.package_data]
35+
* = ../data/periodic_table.csv
36+
37+
[options.packages.find]
38+
exclude =
39+
tests*
40+
41+
[bdist_wheel]
42+
universal = True
43+
44+
# Tooling Config
145
[flake8]
246
# tell flake8 to use black's default line length
347
max-line-length = 95
@@ -16,4 +60,6 @@ multi_line_output = 3
1660
include_trailing_comma = True
1761

1862
[tool:pytest]
19-
testpaths = tests
63+
testpaths = tests
64+
# https://stackoverflow.com/a/50821160
65+
addopts = -p no:warnings

setup.py

+2-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
from setuptools import find_namespace_packages, setup
1+
from setuptools import setup
22

3-
setup(
4-
name="ml-matrics",
5-
version="0.0.1",
6-
author="Janosh Riebesell",
7-
author_email="[email protected]",
8-
description="A collection of plots useful in data-driven materials science",
9-
long_description=open("readme.md").read(),
10-
long_description_content_type="text/markdown",
11-
url="https://github.com/janosh/ml-matrics",
12-
packages=find_namespace_packages(include=["ml_matrics*"]),
13-
classifiers=[
14-
"Programming Language :: Python :: 3.8",
15-
"License :: OSI Approved :: MIT License",
16-
"Operating System :: OS Independent",
17-
],
18-
)
3+
setup()

0 commit comments

Comments
 (0)