Skip to content

Commit

Permalink
Merge pull request #43 from flatironinstitute/dev
Browse files Browse the repository at this point in the history
New testing & CI
  • Loading branch information
asistradition authored Jun 30, 2021
2 parents 7b95947 + 762df16 commit 1111e3d
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 55 deletions.
4 changes: 3 additions & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
codecov:
branch: release
branch: release
ignore:
- "*/tests/*”
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
author = 'Chris Jackson'

# The full version, including alpha/beta/rc tags
release = 'v0.5.5'
release = 'v0.5.6'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions inferelator/postprocessing/f1_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from inferelator.postprocessing import (TARGET_COLUMN, REGULATOR_COLUMN, CONFIDENCE_COLUMN,
F1_COLUMN, PRECISION_COLUMN, RECALL_COLUMN)

import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt


Expand Down
2 changes: 0 additions & 2 deletions inferelator/postprocessing/matthews_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from inferelator.postprocessing import (TARGET_COLUMN, REGULATOR_COLUMN, CONFIDENCE_COLUMN, GOLD_STANDARD_COLUMN,
MCC_COLUMN, TP, FP, TN, FN)

import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt


Expand Down
35 changes: 18 additions & 17 deletions inferelator/postprocessing/model_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from inferelator.utils import is_string
import os

import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt


Expand Down Expand Up @@ -84,36 +82,39 @@ def auc(self):
def curve_dataframe(self):
return self.filtered_data.loc[:, [CONFIDENCE_COLUMN, PRECISION_COLUMN, RECALL_COLUMN, MCC_COLUMN, F1_COLUMN]]

def output_curve_pdf(self, output_dir, file_name=None, dpi=300, figsize=(8, 10)):
def output_curve_pdf(self, output_dir, file_name=None, dpi=300, figsize=(8, 10), style_label='default'):

file_name = self.curve_file_name if file_name is None else file_name

# Create a figure
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=figsize, constrained_layout=True)
with plt.style.context(style_label):
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=figsize, constrained_layout=True)

# Draw the PR curve
RankSummaryPR.output_curve(self, ax=axes[0, 0])
# Draw the PR curve
RankSummaryPR.output_curve(self, ax=axes[0, 0])

# Add the cutoff at optimal MCC to the curve
_ocr = self.filtered_data.loc[self.filtered_data[CONFIDENCE_COLUMN] >= self.optconfmcc, RECALL_COLUMN].max()
_ocp = self.filtered_data.loc[self.filtered_data[CONFIDENCE_COLUMN] >= self.optconfmcc, PRECISION_COLUMN].min()
axes[0, 0].vlines(_ocr, 0, _ocp, colors='r', linestyles='dashed')
# Add the cutoff at optimal MCC to the curve
_ocr = self.filtered_data.loc[self.filtered_data[CONFIDENCE_COLUMN] >= self.optconfmcc, RECALL_COLUMN].max()
_ocp = self.filtered_data.loc[self.filtered_data[CONFIDENCE_COLUMN] >= self.optconfmcc, PRECISION_COLUMN].min()
axes[0, 0].vlines(_ocr, 0, _ocp, colors='r', linestyles='dashed')

# Draw the MCC curve
RankSummaryMCC.output_curve(self, ax=axes[0, 1])
# Draw the MCC curve
RankSummaryMCC.output_curve(self, ax=axes[0, 1])

# Draw the F1 curve
RankSummaryF1.output_curve(self, ax=axes[1, 0])
# Draw the F1 curve
RankSummaryF1.output_curve(self, ax=axes[1, 0])

# Draw the histogram
self.output_histogram_edges_conf(self.filtered_data[CONFIDENCE_COLUMN].values, ax=axes[1, 1])
# Draw the histogram
self.output_histogram_edges_conf(self.filtered_data[CONFIDENCE_COLUMN].values, ax=axes[1, 1])

# If there's a file name set, make the output file
if file_name is not None and output_dir is not None:
# Save the plot and close
self.save_figure(os.path.join(output_dir, file_name), fig, dpi=dpi)
plt.close(fig)
return None, None

plt.close(fig)
return fig, axes

@staticmethod
def output_histogram_edges_conf(conf, ax):
Expand Down
4 changes: 1 addition & 3 deletions inferelator/postprocessing/precision_recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from inferelator.postprocessing import (TARGET_COLUMN, REGULATOR_COLUMN, PRECISION_COLUMN, RECALL_COLUMN,
CONFIDENCE_COLUMN, GOLD_STANDARD_COLUMN)

import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt


Expand Down Expand Up @@ -168,4 +166,4 @@ def calculate_aupr(data):
# using midpoint integration to calculate the area under the curve
d_recall = np.diff(recall)
m_precision = precision[:-1] + np.diff(precision) / 2
return sum(d_recall * m_precision)
return sum(d_recall * m_precision)
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coverage
nose
pytest
bio-test-artifacts
tables
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup, find_packages

# Current Inferelator Version Number
version = "0.5.5"
version = "0.5.6"


# Description from README.md
Expand Down Expand Up @@ -37,8 +37,7 @@
zip_safe=False,
install_requires=requires,
python_requires=">=3.5",
tests_require=["coverage", "nose", "bio-test-artifacts", "tables"],
test_suite="nose.collector",
tests_require=["coverage", "pytest", "bio-test-artifacts", "tables"],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
Expand Down

0 comments on commit 1111e3d

Please sign in to comment.