Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding KNNClassificationDecider #463

Open
wants to merge 143 commits into
base: KNNDecider
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
aa3ecf1
Merge pull request #2 from neurodata/master
david-z-shi Sep 18, 2020
f48f6c2
Merge remote-tracking branch 'upstream/master'
david-z-shi Sep 22, 2020
7b7c0b8
Revert "Merge remote-tracking branch 'upstream/master'"
david-z-shi Sep 22, 2020
f6d4784
Revert "Revert "Merge remote-tracking branch 'upstream/master'""
david-z-shi Sep 22, 2020
6db1ecc
Merge pull request #3 from neurodata/main
david-z-shi Sep 27, 2020
c15299c
Merge pull request #4 from neurodata/main
david-z-shi Oct 27, 2020
660eab2
staging branch finally
parthgvora Nov 13, 2020
273f960
all tests pass
parthgvora Nov 18, 2020
fb8cb0f
finished documentation
Nov 20, 2020
c4cef8b
fixed some bugs and finished predict tests
Nov 20, 2020
2481e91
Fixed header, unnecessary imports
parthgvora Nov 20, 2020
cf1b017
Including oblique_tree in proglearn
parthgvora Nov 20, 2020
83c9f13
fixing importing issues
parthgvora Nov 20, 2020
a7c31f0
black formatting
parthgvora Nov 21, 2020
0e50784
Fix docstring indents
PSSF23 Nov 21, 2020
1328b75
black formatting
parthgvora Dec 11, 2020
7f876fe
Merge branch 'staging' of https://github.com/parthgvora/ProgLearn int…
parthgvora Dec 11, 2020
ecb7b07
oblique trees added
parthgvora Dec 11, 2020
39cf94a
consistency of default params
parthgvora Dec 11, 2020
df391b6
made some documentation changes and created decision boundaries notebook
Dec 12, 2020
8224304
Update tutorials.rst
PSSF23 Dec 12, 2020
395dc9e
Merge branch 'staging' into staging
PSSF23 Dec 12, 2020
3d7c50a
ConvRF Experiments
ypeng22 Dec 14, 2020
2d774b7
Remove duplicate and unused function
PSSF23 Dec 14, 2020
cf93af4
renamed notebooks
Dec 15, 2020
706ef42
Update and rename oblique_decision_boundaries_functions.py to sporf_d…
PSSF23 Dec 15, 2020
6e1205e
Rename function for consistency
PSSF23 Dec 15, 2020
df734df
Merge pull request #374 from parthgvora/staging
levinwil Dec 15, 2020
faadd4c
fte/bte mnist added
emilyachang Dec 16, 2020
bedafd2
Make the array-ness of self.classes explicit
hhelm10 Dec 16, 2020
1dc8eee
Merge pull request #12 from neurodata/staging
EYezerets Dec 16, 2020
ce6ef4a
add truth line - attempt to run in parallel, broke when parallel = False
EYezerets Dec 16, 2020
dba192a
input n, mean, var to plot_posterior function, define truth function
EYezerets Dec 16, 2020
a9efa33
set parallel=True to run on AWS
EYezerets Dec 16, 2020
358bc1e
parallel on, feed n, mean, var to plot_fig1
EYezerets Dec 16, 2020
89013bb
make mean and cov same length: n/2 for truth
EYezerets Dec 16, 2020
fe7f626
feed ax to plot_truth
EYezerets Dec 16, 2020
24870dc
fixed ConvRF
ypeng22 Dec 16, 2020
d9d178e
Reformat with black
PSSF23 Dec 16, 2020
8331f47
fig 1 tutorial ground truth updates
EYezerets Dec 17, 2020
fcd2e72
make x, y dimensions for ground truth match at least
EYezerets Dec 17, 2020
12396b3
visualize fig 1 even if incorrect
EYezerets Dec 17, 2020
32dd118
no recalculation of X from y
EYezerets Dec 17, 2020
8a9805e
plotted
EYezerets Dec 17, 2020
42d9a75
use scipy.stats.norm.pdf, plug in X_eval and the two different means …
EYezerets Dec 17, 2020
2a7e1a3
plotted with norm.pdf for ground truth
EYezerets Dec 17, 2020
bd24720
add legend
EYezerets Dec 17, 2020
3ebef7a
run with legend
EYezerets Dec 17, 2020
19ea336
Merge pull request #397 from emilyachang/ftebte-mnist
PSSF23 Dec 18, 2020
d4c589d
cleaned up output of intermediate and final 3 cells
ypeng22 Dec 18, 2020
351db79
Reformat certain cells and clean up imports
PSSF23 Dec 18, 2020
84689c5
Clean up imports
PSSF23 Dec 18, 2020
c68f095
no legend, cleaned up comments, prepared to run uncertaintyforest_pos…
EYezerets Dec 18, 2020
39213d9
tutorial run
EYezerets Dec 18, 2020
76cea0b
Merge pull request #395 from ypeng22/staging
PSSF23 Dec 18, 2020
dabc55e
ConvRF 3-Class Classification Experiment
Dec 22, 2020
c62a7ed
ConvRF 3-Class Classification Experiment
Dec 22, 2020
fb1df34
Update ConvRF_Kappas_3_Class.ipynb
Dec 22, 2020
2fc2770
Type Error with existing UF notebooks - tracking down bug, perhaps in…
EYezerets Dec 23, 2020
666c769
main branch proglearn package version not up to date with tree_constr…
EYezerets Dec 23, 2020
d0e3edb
error with lf_ due to staging version of proglearn package
EYezerets Dec 23, 2020
19653c2
Fix kwargs
PSSF23 Dec 23, 2020
df6bcc9
Correct forest name
PSSF23 Dec 23, 2020
34001ff
Merge pull request #405 from PSSF23/amazing_trees
EYezerets Dec 24, 2020
dd902b7
fig 2 and 3 notebooks run with fix from Hao in stagingg, but still ge…
EYezerets Dec 24, 2020
07ca78b
Update documentation
PSSF23 Dec 24, 2020
d460f6b
Optimize subtitle formats
PSSF23 Dec 24, 2020
effa495
Merge pull request #404 from mkusman1/staging
PSSF23 Dec 24, 2020
3d413bd
Merge from neurodata/staging - Hao updates especially
EYezerets Jan 4, 2021
e320f01
Optimize lf initialization
PSSF23 Jan 6, 2021
69cc3bc
Optimize documentation and rerun for checks
PSSF23 Jan 6, 2021
db49380
Fix format
PSSF23 Jan 6, 2021
33f66aa
Remove numpy version
PSSF23 Jan 6, 2021
3b9249f
Merge pull request #409 from PSSF23/shots_fired - addresses issue wit…
EYezerets Jan 8, 2021
c063c7e
merged from staging
EYezerets Jan 8, 2021
7f2398a
finish accepting changes from merge from staging
EYezerets Jan 8, 2021
4dc7511
update uf tutorials and benchmarks - tutorials plotted with parallel=…
EYezerets Jan 8, 2021
a18e4d1
Merge pull request #410 from PSSF23/skin
levinwil Jan 8, 2021
38c1ed5
Simplified np.asarray calls
levinwil Jan 8, 2021
0fcce18
Apply np.asarray format to KNNClassificationVoter
PSSF23 Jan 9, 2021
1330ff8
Merge pull request #407 from neurodata/hhelm10-patch-1
PSSF23 Jan 9, 2021
2249ff0
attempted posteriorestimates benchmarks, but threw ABCMeta error, tut…
EYezerets Jan 9, 2021
4ddeb98
parallel = True on all 3 uf tutorials to test parallel condition on AWS
EYezerets Jan 9, 2021
10ddf97
tutorials run with parallel=True on AWS
EYezerets Jan 9, 2021
266fb28
benchmarks posteriorestimates run with ground truth, parallel = True
EYezerets Jan 10, 2021
27af873
benchmarks conditionalentropy full rerun, parallel = True
EYezerets Jan 10, 2021
94753b1
benchmarks mutualinformationestimates with parallel = True
EYezerets Jan 11, 2021
66e20c4
changed tutorials uf notebooks back to parallel = False, reran locally
EYezerets Jan 11, 2021
fe2885e
conditionalentropyestimates - suppress warnings
EYezerets Jan 11, 2021
61fb08a
Merge pull request #411 from EYezerets/fig1uftruth
PSSF23 Jan 11, 2021
93be74c
Fix typo in docstring
Jan 13, 2021
71028f6
Fix incorrect array dimensions in docstring
Jan 13, 2021
874230e
Add wrapper for calculating Gini impurity
Jan 13, 2021
9566367
Parallelize Gini impurity calculation
Jan 13, 2021
dc722d0
Add workers argument to tests
Jan 13, 2021
2b6836f
Fix docstring for workers argument
Jan 13, 2021
830dbf3
Merge pull request #412 from v715/patch-1
PSSF23 Jan 13, 2021
b3bd24b
Merge pull request #414 from v715/patch-2
PSSF23 Jan 13, 2021
b41e31e
Use specified worker numbers for parallelization
PSSF23 Jan 13, 2021
1ffe82c
Merge pull request #416 from v715/parallelize-ObliqueSplitter
PSSF23 Jan 13, 2021
97f2949
Remove SPORF
PSSF23 Feb 2, 2021
3ce97df
Merge pull request #429 from PSSF23/ash_like_snow
jdey4 Feb 2, 2021
1abd236
move to circle.ci
jdey4 Feb 3, 2021
539b28b
add circle.ci badge
jdey4 Feb 3, 2021
350edf7
remove python version requirement
jdey4 Feb 3, 2021
939dbf9
fix black folder
jdey4 Feb 3, 2021
a773b57
fix black folder
jdey4 Feb 3, 2021
9161a89
fix proglearn folder
jdey4 Feb 3, 2021
098ccc8
Update CircleCI badge url
PSSF23 Feb 3, 2021
eee1c48
Update CircleCI badge
PSSF23 Feb 3, 2021
a212a0c
Update install.rst
PSSF23 Feb 3, 2021
1441906
do nothing
jdey4 Feb 3, 2021
03e06b6
Update setup.py
PSSF23 Feb 3, 2021
ea29b70
Merge pull request #430 from neurodata/CI_fix
jdey4 Feb 3, 2021
880f461
circle ci badge fix
jdey4 Feb 4, 2021
8835ee4
Update README.md
PSSF23 Feb 4, 2021
df6d40d
Increment version number
PSSF23 Feb 4, 2021
2148ff3
Merge pull request #433 from neurodata/CI_fix
PSSF23 Feb 4, 2021
9f799b4
Merge pull request #431 from neurodata/staging
jdey4 Feb 4, 2021
5c711e2
Update forest.rst
PSSF23 Feb 8, 2021
7730ee5
Update config.yml
PSSF23 Feb 8, 2021
7cfbffd
Merge pull request #1 from neurodata/staging
bstraus1 Feb 8, 2021
8a6cddb
Added overview section to the Proglearn documentation
bstraus1 Feb 9, 2021
ff11449
Merge branch 'staging' of https://github.com/bstraus1/ProgLearn into …
bstraus1 Feb 9, 2021
bc07482
Update DOI badge to cite all versions
PSSF23 Feb 9, 2021
4048ff0
Update DOI badge to cite all versions
PSSF23 Feb 9, 2021
308ddef
Change terms for adding the overview section
PSSF23 Feb 9, 2021
0f41b40
Optimize style and remove unnecessary section
PSSF23 Feb 9, 2021
0fb86e8
Merge pull request #441 from bstraus1/staging
PSSF23 Feb 9, 2021
d4e8bc2
Merge pull request #440 from PSSF23/smooth_criminal
jdey4 Feb 10, 2021
6081fad
Merge branch 'master' into KNNDecider
david-z-shi Feb 12, 2021
9904ff8
Merge branch 'xor_rxor_KNN' into KNNDecider
david-z-shi Feb 12, 2021
59042b7
first experiments with KNN
david-z-shi Feb 18, 2021
22670df
update with not working experiment
david-z-shi Mar 4, 2021
3906f75
testing experiments
david-z-shi Mar 11, 2021
5e01841
updated with simpler KNN implementation
david-z-shi Mar 18, 2021
75fc321
update experiments with KNNClassification settings and KNNRegression …
david-z-shi Mar 24, 2021
150bfbc
update with some trial experiments
david-z-shi Apr 1, 2021
85f3396
update with experiments
david-z-shi May 3, 2021
f30c42e
update with some changes
david-z-shi May 3, 2021
d184835
black formatting fixes
david-z-shi May 3, 2021
de24861
black formatting changes
david-z-shi May 3, 2021
6b940ba
deleted some files
david-z-shi May 4, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
version: 2.1

orbs:
codecov: codecov/codecov@1.0.2

jobs:
build:
parameters:
version:
type: string
docker:
- image: cimg/python:<< parameters.version >>
steps:
- checkout
- restore_cache:
key: v1-<< parameters.version >>-min-dependency-cache-{{ checksum "dev-requirements.txt" }}
- run:
name: install python dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install -r dev-requirements.txt
- save_cache:
key: v1-<< parameters.version >>-min-dependency-cache-{{ checksum "dev-requirements.txt" }}
paths:
- "venv"
- run:
name: test if package installs
command: |
. venv/bin/activate
python3 setup.py install
test-module:
parameters:
module:
type: string
docker:
- image: cimg/python:3.8
steps:
- checkout
- restore_cache:
key: v1-3.8-dependency-cache-{{ checksum "dev-requirements.txt" }}
- run:
name: install python dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r dev-requirements.txt
pip install -e .
- save_cache:
key: v1-3.8-dependency-cache-{{ checksum "dev-requirements.txt" }}
paths:
- "venv"
- run:
name: run code linting
command: |
. venv/bin/activate
black --check --diff ./<< parameters.module >>
- run:
name: run tests and coverage
command: |
. venv/bin/activate
pytest --junitxml=test-reports/junit.xml --cov-report=xml --cov=./<< parameters.module >> ./<< parameters.module >>
- store_test_results:
path: test-reports
- store_artifacts:
path: test-reports
- codecov/upload:
file: "coverage.xml"
deploy:
docker:
- image: cimg/python:3.8
steps:
- checkout
- restore_cache:
key: v1-3.8-dependency-cache-{{ checksum "dev-requirements.txt" }}
- run:
name: install python dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r dev-requirements.txt
pip install -e .
- save_cache:
key: v1-3.8-dependency-cache-{{ checksum "dev-requirements.txt" }}
paths:
- "venv"
- run:
name: verify git tag vs. version
command: |
python3 -m venv venv
. venv/bin/activate
python setup.py verify
- run:
name: init .pypirc
command: |
echo -e "[pypi]" >> ~/.pypirc
echo -e "username = $PYPI_USERNAME" >> ~/.pypirc
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
- run:
name: create packages
command: |
python setup.py sdist
- run:
name: upload to pypi
command: |
. venv/bin/activate
twine upload dist/*
workflows:
build-test-deploy:
jobs:
- build:
name: "v3.6"
version: "3.6"
- build:
name: "v3.7"
version: "3.7"
- build:
name: "v3.8"
version: "3.8"
- test-module:
name: "proglearn"
module: "proglearn"
requires:
- "v3.8"
- deploy:
requires:
- "proglearn"
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ProgLearn

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4276573.svg)](https://doi.org/10.5281/zenodo.4276573)
[![Build Status](https://travis-ci.org/neurodata/ProgLearn.svg?branch=main)](https://travis-ci.org/neurodata/ProgLearn)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4060264.svg)](https://doi.org/10.5281/zenodo.4060264)
[![Build Status](https://circleci.com/gh/neurodata/ProgLearn/tree/main.svg?style=shield&circle-token=:circle-token)](https://app.circleci.com/pipelines/github/neurodata/ProgLearn)
[![Codecov](https://codecov.io/gh/neurodata/ProgLearn/branches/main/graph/badge.svg)](https://codecov.io/gh/neurodata/ProgLearn)
[![PyPI version](https://img.shields.io/pypi/v/proglearn.svg)](https://pypi.org/project/proglearn/)
[![arXiv](https://img.shields.io/badge/arXiv-2004.12908-red.svg?style=flat)](https://arxiv.org/abs/2004.12908)
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-r requirements.txt
pytest
coverage
pytest-cov
codecov
black
11 changes: 6 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

.. _contents:

Overview of ProgLearn_
ProgLearn_
======================

.. _proglearn: https://proglearn.neurodata.io/

.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.4276573.svg
:target: https://doi.org/10.5281/zenodo.4276573
.. image:: https://travis-ci.org/neurodata/ProgLearn.svg?branch=main
:target: https://travis-ci.org/neurodata/ProgLearn
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.4060264.svg
:target: https://doi.org/10.5281/zenodo.4060264
.. image:: https://circleci.com/gh/neurodata/ProgLearn/tree/main.svg?style=shield&circle-token=:circle-token
:target: https://app.circleci.com/pipelines/github/neurodata/ProgLearn
.. image:: https://codecov.io/gh/neurodata/ProgLearn/branches/main/graph/badge.svg
:target: https://codecov.io/gh/neurodata/ProgLearn
.. image:: https://img.shields.io/pypi/v/proglearn.svg
Expand Down Expand Up @@ -62,6 +62,7 @@ Documentation
:maxdepth: 1
:caption: Using ProgLearn

overview
install
tutorials/
reference/index
Expand Down
4 changes: 2 additions & 2 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Python package dependencies
- tensorflow>=1.19.0
- scikit-learn>=0.22.0
- scipy==1.4.1
- numpy<1.19
- joblib>=0.14.1
- numpy==1.19.2

Hardware requirements
---------------------
Expand All @@ -65,7 +65,7 @@ tensorflow's backend.
OS Requirements
---------------
This package is supported for all major operating systems. The following
versions of operating systems was tested on Travis CI:
versions of operating systems was tested on CircleCI:

- **Linux**: Ubuntu 16.04
- **macOS**: Mojave (10.14.1)
Expand Down
53 changes: 53 additions & 0 deletions docs/overview.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.. -*- coding: utf-8 -*-

.. _contents:

Overview
========

``ProgLearn`` provides classes and functions for biological machine learning. Notably, it improves in performance on all tasks (including past and future) with any new data. This sets it apart from classical machine learning algorithms and many other recent approaches to biological learning.

The Library
-----------

All classes and functions are available through the ``ProgLearn`` package and can also be imported separately.

.. code:: python

import proglearn as PL
from proglearn.forest import UncertaintyForest

The Learners
------------

There are three main parts to the ``ProgLearn`` package: Lifelong Classification Network, Lifelong Classification Forest, and the Uncertainty Forest. All three have very similar syntax and usage. A general overview is provided below with more specific and complete examples in the tutorial section. This overview example will use ``proglearn.forest.UncertaintyForest`` but is generalizable to the Lifelong Classification Network and Lifelong Classification Forest.

First, we'll create our forest:

.. code:: python

UF = UncertaintyForest(n_estimators = n_estimators)

Then, we fit to data:

.. code:: python

UF.fit(X_train, y_train)

Finally we can predict the classes of the data:

.. code:: python

predictions = UF.predict(X_test)

Another advantage of the ``ProgLearn`` package is the ``predict_proba(X)`` function. It can be used to estimate the class posteriors for each example in the input data, X.

.. code:: python

predicted_posteriors = UF.predict_proba(X_test)


Wrap Up
-------

This overview covers the basics of using ``ProgLearn``. Most use cases will utilize the functions presented above. Further examples are available in the tutorials section (see menu).
3 changes: 3 additions & 0 deletions docs/reference/forest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ Lifelong Classification Forest

.. autoclass:: LifelongClassificationForest

Uncertainty Forest
------------------------------

.. autoclass:: UncertaintyForest
3 changes: 2 additions & 1 deletion docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The following tutorials highlight what one can do with the ``ProgLearn`` package

tutorials/installation_guide
tutorials/fte_bte_food101
tutorials/fte_bte_mnist
tutorials/label_shuffle_exp
tutorials/random_class_exp
tutorials/rotation_cifar
Expand All @@ -20,4 +21,4 @@ The following tutorials highlight what one can do with the ``ProgLearn`` package
tutorials/xor_nxor_exp
tutorials/xor_rxor_exp
tutorials/xor_rxor_with_cpd
tutorials/xor_rxor_with_icp
tutorials/xor_rxor_with_icp
Loading