Skip to content

Commit

Permalink
add Sphyinx
Browse files Browse the repository at this point in the history
  • Loading branch information
urigott committed Oct 5, 2023
1 parent 171a98a commit 3c1e32e
Show file tree
Hide file tree
Showing 38 changed files with 2,708 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
26 changes: 26 additions & 0 deletions source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "Rtichoke_python"
copyright = "2023, Uri Gottlieb"
author = "Uriah Finkel | Uri Gottlieb"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ["_templates"]
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "alabaster"
html_static_path = ["_static"]
20 changes: 20 additions & 0 deletions source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. Rtichoke_python documentation master file, created by
sphinx-quickstart on Thu Oct 5 10:42:07 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Rtichoke_python's documentation!
===========================================

.. toctree::
:maxdepth: 2
:caption: Contents:



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
32 changes: 32 additions & 0 deletions src/end_to_end_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""end-to-end testing + example"""


import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.datasets import fetch_california_housing

from rtichoke import Rtichoke

# create fake data

data = fetch_california_housing()
X = pd.DataFrame(data["data"], columns=data["feature_names"])
y = (data["target"] > 3).astype(int)

X_train, X_test, y_train, y_test = train_test_split(X, y)

lr = LogisticRegression().fit(X_train, y_train)

probs = {
"population1": lr.predict_proba(
X_test * np.random.normal(loc=1, size=X_test.shape)
)[:, 1],
"population2": lr.predict_proba(X_train)[:, 1],
}
reals = {"population1": y_test, "population2": y_train}

r = Rtichoke(probs, reals, by=0.01)

r.plot("calibration", filename="temp.html")
27 changes: 27 additions & 0 deletions src/rtichoke/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""rtichoke is a package for interactive vizualization of performance metrics
"""

from importlib.metadata import version

__version__ = version("rtichoke")

from rtichoke.discrimination.roc import create_roc_curve
from rtichoke.discrimination.roc import plot_roc_curve

from rtichoke.discrimination.lift import create_lift_curve
from rtichoke.discrimination.lift import plot_lift_curve

from rtichoke.discrimination.precision_recall import create_precision_recall_curve
from rtichoke.discrimination.precision_recall import plot_precision_recall_curve

from rtichoke.discrimination.gains import create_gains_curve
from rtichoke.discrimination.gains import plot_gains_curve

from rtichoke.calibration.calibration import create_calibration_curve

from rtichoke.utility.decision import create_decision_curve
from rtichoke.utility.decision import plot_decision_curve

from rtichoke.performance_data.performance_data import prepare_performance_data

from rtichoke.summary_report.summary_report import create_summary_report
3 changes: 3 additions & 0 deletions src/rtichoke/calibration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Subpackage for Calibration
"""
Loading

0 comments on commit 3c1e32e

Please sign in to comment.