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

Feature/add dynotears #50

Merged

Conversation

GabrielAzevedoFerreiraQB
Copy link
Contributor

@GabrielAzevedoFerreiraQB GabrielAzevedoFerreiraQB commented Jun 2, 2020

Notice

  • I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":

  • I submit this contribution under the Apache 2.0 license and represent that I am entitled to do so on behalf of myself, my employer, or relevant third parties, as applicable.

  • I certify that (a) this contribution is my original creation and / or (b) to the extent it is not my original creation, I am authorised to submit this contribution on behalf of the original creator(s) or their licensees.

  • I certify that the use of this contribution as authorised by the Apache 2.0 license does not violate the intellectual property rights of anyone else.

Motivation and Context

This PR implements Dynotears.

contributions:

  • main code : causalnex/structure/dynotears.py::_learn_dynamic_structure
  • from numpy : causalnex/structure/dynotears.py::_from_numpy_dynamic
  • from pandas : causalnex/structure/dynotears.py::_from_pandas_dynamic
  • data generators (one extra generator to generate a dynamic structure): causalnex/structure/data_generators.py::generate_structure_dynamic

Note:

I still have to replace datasets in tests/conftest.py by the data generators.

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added a description of this change and added my name to the list of supporting contributions in the RELEASE.md file
  • Added tests to cover my changes
  • Assigned myself to the PR

…parents. missing test cases for tabu_; Two problems: number of arguments > 8 and too many local variables

adding test cases for tabu edges, tabu children,tabu parents
adding pylint disable R0913 (too-many-arguments)

updating init
…orithm

main dyno algorithm (algorithm originally in causal-os)
…parents. missing test cases for tabu_; Two problems: number of arguments > 8 and too many local variables

adding test cases for tabu edges, tabu children,tabu parents
@roxana-pamfil-qb
Copy link

@GabrielAzevedoFerreiraQB @qbphilip I'm happy with the changes since my last review, nothing new for me to add.

Copy link
Contributor

@SteveLerQB SteveLerQB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work!!!! 💯 💯 Left some comments but happy for this to be merged as it is :)

causalnex/structure/data_generators/wrappers.py Outdated Show resolved Hide resolved
causalnex/structure/dynotears.py Show resolved Hide resolved
causalnex/structure/dynotears.py Show resolved Hide resolved
causalnex/structure/dynotears.py Show resolved Hide resolved
tests/structure/test_dynotears.py Show resolved Hide resolved
Copy link
Contributor

@mzjp2 mzjp2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments, but otherwise good to go! 🚀

RELEASE.md Outdated Show resolved Hide resolved
causalnex/structure/data_generators/core.py Outdated Show resolved Hide resolved
causalnex/structure/data_generators/wrappers.py Outdated Show resolved Hide resolved
causalnex/structure/data_generators/wrappers.py Outdated Show resolved Hide resolved
@angeldrothqb angeldrothqb self-requested a review September 9, 2020 11:29
Copy link
Contributor

@angeldrothqb angeldrothqb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one minor structure comment, otherwise LGTM

@qbphilip qbphilip merged commit 4134ab8 into mckinsey:develop Sep 10, 2020
tsanikgr added a commit that referenced this pull request Sep 10, 2020
* Merge back to develop

* Simplifying viz.draw syntax in tutorial notebook (#46)

* Add non negativity constraint in numpy lasso (#41)

* Add plotting tutorial to the documentation (#47)

* Unpin some requirements

* Mixed type data generation (#55)

Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.

* Merge back to develop (#59)

* Pytorch NOTEARS (#63)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Update release.md

* Address coments

* Corrected release.md

* fc1 to adjacency

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Pinned sphinx-auto-doc-typehints (#66)

* Corrected a spelling/grammar mistake (#55)

* Fix/lint (#73)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* black

* pin pytorch version

* pin pytorch version

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Structure learning regressor (#68)

* initial commit (local copy-paste)

* fixed minor comments

* minor bugfix

* impute from children inital commit

* bugfixes and method option

* auto thresholding

* autothreshold and bugfix

* make threshold removal explicit

* add l1 argument

* remove child imputation

* feat importance fix and tabu logic

* moved threshold till dag

* restructure with base class

* coef mask

* recipe

* enable bias fitting

* persist bias as node attribute

* allow fit_intercept

* minor PR comment fixes

* minor comment adjustment

* test coverage and l1 clarification

* recipe

* minor test fixes

* more tests

* full test coverage

* revove python 3.5/3.6 unsupported import

* add normalization option

* idiomatic typing

* correct pylint errors

* update some tests

* more typeing updates

* more pylint requirements

* more pylint disable

* python 3.5 support

* try to get to work with 3.5

* full coverage and 3.5 support

* remove base class to pass test

* remove unneeded supression

* black formatting changes

* remove unused import

* pytlint supression

* minor reformat change

* isort fix

* better defensive programming

* fix unittests

* docstring update

* do Raises docstring properly

* action SWE suggestions

* hotfixes

* minor update

* minor black formatting change

* final merge checkbox

* fix end of file

* Data Gen root node initialisation fix (#72)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* fix for consinuous normal data

* generalise across all dtypes

* support fit_intercept

* fixed many test errors

* test logic fixes

* lint test fixes

* python 3.5 failure change

* minor test bugfix

* black

* pin pytorch version

* pin pytorch version

* additional test parameter

* black formatting

* requested changes

* test updates and docstring

* black format change

* disable too many lines

* change

* move recipe to tutorial folder

* releaseMD changes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>

* [1/2] Poisson data for data gen (#61)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* variable name change bugfix

* fix tests

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>

* [2/2] Nonlinear Data gen (#60)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* add nonlinear

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* add nonlinear to init

* change order in all

* change release.md

* root node fix on core + count

* nonlinear support to wrappers

* docstring update

* bugfix and reproducability fix

* many tests and test updates

* poiss bugfix and test fix

* moar test coverage

* categorical dataframe test coverage

* full test coverage and linting

* fix linting and fstring

* black reformat

* fix unused pylint argument

* pytest fix

* FINAL linting fix

* Fix stuff (#75)

CircleCI fixes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* update black version (#76)

* fix black

* Fix/check for NA or Infinity when notears is used  (#54)

* update scipy version (#77)

* add DYNOTEARS implementation (#50)

Adds DYNOTEARS and corresponding data generator (for testing)

* Pytorch NOTEARS extension - Non-Linear/Hidden Layer (#65)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Add hidden layer

* small refactor

* directional adj

* minor edits

* fix bias issues

* breaking changes update to the interface

* typo

* new regressor regularisation interface

* update forward method

* forward(X) predictions work

* working!

* bugfix data normalisation

* some fixes

* average regularisation and adj calc at end

* give credit!

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* loc lin docstring update

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* docstring + fc1/fc2 name updates

* moar docstring updates

* more minor updates

* remove normalize option

* plotting util

* rename to DAGRegressor

* rename and checks

* more util functions

* fix bias

* fix bias with no intercept

* fix linear adj

* add tests

* minor fix

* minor fixes

* extend interface to bias

* differentialte coef_ and feature_imporances

* seperate bias element

* tests

* more test coverage

* nonlinear test coverage

* test hotfix

* more test coverage

* test requirements update

* more test coverage

* formatting changes

* final pylint change

* more linting

* more bestpractice structuring

* more minor fixes

* FINAL linting updates

* actual last change

* update to reg defaults, additions to the tutorial

* nonlinear regularisation updates

* regressor tutorial

* almost finishing touches

* gradient based h function!

* soft clamp and coef feature importance seperation

* small api update, closer to batchnorm

* docstring updates

* stronger soft clamping

* gradient L1 rather than L2

* fcpos neg removal, gradient optim

* revert back to create_graph=True for 2nd derivative

* remove print and test fix

* black reformatting

* new black version

* full test coverage

* isort fix

* pylint fix

* first layer h(W) for speed optimization

* fix batch norm system

* add nonlinear test

* test hotfix

* black reformat

* isort fix

* remove X requirement from h_func

* regressor tutorial final commit and black update

* LayerNorm replacement

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* major changes

* add standardization

* minort changes

* fix tests

* rename reg parameters

* linting

* test coverage, docstting

* check array for infs

* fix isinstance to base type

* fix isort, add test coverage

* new tutorial

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* test string match

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* assert improvement

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* SWE suggestions

* minor bugfix

* more test fixing

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: angeldrothqb <67913551+angeldrothqb@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* release.md, version bump, docs

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: GabrielAzevedoFerreiraQB <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: stevelersl <55385183+SteveLerQB@users.noreply.github.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: KING-SID <sidhantbendre22@gmail.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Jebq <jb.oger2312@gmail.com>
tsanikgr added a commit that referenced this pull request Sep 18, 2020
* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* Release/0.8.0 (#80)

* Merge back to develop

* Simplifying viz.draw syntax in tutorial notebook (#46)

* Add non negativity constraint in numpy lasso (#41)

* Add plotting tutorial to the documentation (#47)

* Unpin some requirements

* Mixed type data generation (#55)

Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.

* Merge back to develop (#59)

* Pytorch NOTEARS (#63)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Update release.md

* Address coments

* Corrected release.md

* fc1 to adjacency

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Pinned sphinx-auto-doc-typehints (#66)

* Corrected a spelling/grammar mistake (#55)

* Fix/lint (#73)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* black

* pin pytorch version

* pin pytorch version

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Structure learning regressor (#68)

* initial commit (local copy-paste)

* fixed minor comments

* minor bugfix

* impute from children inital commit

* bugfixes and method option

* auto thresholding

* autothreshold and bugfix

* make threshold removal explicit

* add l1 argument

* remove child imputation

* feat importance fix and tabu logic

* moved threshold till dag

* restructure with base class

* coef mask

* recipe

* enable bias fitting

* persist bias as node attribute

* allow fit_intercept

* minor PR comment fixes

* minor comment adjustment

* test coverage and l1 clarification

* recipe

* minor test fixes

* more tests

* full test coverage

* revove python 3.5/3.6 unsupported import

* add normalization option

* idiomatic typing

* correct pylint errors

* update some tests

* more typeing updates

* more pylint requirements

* more pylint disable

* python 3.5 support

* try to get to work with 3.5

* full coverage and 3.5 support

* remove base class to pass test

* remove unneeded supression

* black formatting changes

* remove unused import

* pytlint supression

* minor reformat change

* isort fix

* better defensive programming

* fix unittests

* docstring update

* do Raises docstring properly

* action SWE suggestions

* hotfixes

* minor update

* minor black formatting change

* final merge checkbox

* fix end of file

* Data Gen root node initialisation fix (#72)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* fix for consinuous normal data

* generalise across all dtypes

* support fit_intercept

* fixed many test errors

* test logic fixes

* lint test fixes

* python 3.5 failure change

* minor test bugfix

* black

* pin pytorch version

* pin pytorch version

* additional test parameter

* black formatting

* requested changes

* test updates and docstring

* black format change

* disable too many lines

* change

* move recipe to tutorial folder

* releaseMD changes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>

* [1/2] Poisson data for data gen (#61)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* variable name change bugfix

* fix tests

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>

* [2/2] Nonlinear Data gen (#60)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* add nonlinear

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* add nonlinear to init

* change order in all

* change release.md

* root node fix on core + count

* nonlinear support to wrappers

* docstring update

* bugfix and reproducability fix

* many tests and test updates

* poiss bugfix and test fix

* moar test coverage

* categorical dataframe test coverage

* full test coverage and linting

* fix linting and fstring

* black reformat

* fix unused pylint argument

* pytest fix

* FINAL linting fix

* Fix stuff (#75)

CircleCI fixes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* update black version (#76)

* fix black

* Fix/check for NA or Infinity when notears is used  (#54)

* update scipy version (#77)

* add DYNOTEARS implementation (#50)

Adds DYNOTEARS and corresponding data generator (for testing)

* Pytorch NOTEARS extension - Non-Linear/Hidden Layer (#65)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Add hidden layer

* small refactor

* directional adj

* minor edits

* fix bias issues

* breaking changes update to the interface

* typo

* new regressor regularisation interface

* update forward method

* forward(X) predictions work

* working!

* bugfix data normalisation

* some fixes

* average regularisation and adj calc at end

* give credit!

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* loc lin docstring update

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* docstring + fc1/fc2 name updates

* moar docstring updates

* more minor updates

* remove normalize option

* plotting util

* rename to DAGRegressor

* rename and checks

* more util functions

* fix bias

* fix bias with no intercept

* fix linear adj

* add tests

* minor fix

* minor fixes

* extend interface to bias

* differentialte coef_ and feature_imporances

* seperate bias element

* tests

* more test coverage

* nonlinear test coverage

* test hotfix

* more test coverage

* test requirements update

* more test coverage

* formatting changes

* final pylint change

* more linting

* more bestpractice structuring

* more minor fixes

* FINAL linting updates

* actual last change

* update to reg defaults, additions to the tutorial

* nonlinear regularisation updates

* regressor tutorial

* almost finishing touches

* gradient based h function!

* soft clamp and coef feature importance seperation

* small api update, closer to batchnorm

* docstring updates

* stronger soft clamping

* gradient L1 rather than L2

* fcpos neg removal, gradient optim

* revert back to create_graph=True for 2nd derivative

* remove print and test fix

* black reformatting

* new black version

* full test coverage

* isort fix

* pylint fix

* first layer h(W) for speed optimization

* fix batch norm system

* add nonlinear test

* test hotfix

* black reformat

* isort fix

* remove X requirement from h_func

* regressor tutorial final commit and black update

* LayerNorm replacement

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* major changes

* add standardization

* minort changes

* fix tests

* rename reg parameters

* linting

* test coverage, docstting

* check array for infs

* fix isinstance to base type

* fix isort, add test coverage

* new tutorial

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* test string match

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* assert improvement

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* SWE suggestions

* minor bugfix

* more test fixing

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: angeldrothqb <67913551+angeldrothqb@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* release.md, version bump, docs

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: GabrielAzevedoFerreiraQB <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: stevelersl <55385183+SteveLerQB@users.noreply.github.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: KING-SID <sidhantbendre22@gmail.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Jebq <jb.oger2312@gmail.com>

* release.MD

* version bump

* Update causalnex/structure/pytorch/dist_type/_base.py

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Update causalnex/structure/pytorch/dist_type/__init__.py

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: GabrielAzevedoFerreiraQB <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com>
Co-authored-by: stevelersl <55385183+SteveLerQB@users.noreply.github.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: KING-SID <sidhantbendre22@gmail.com>
Co-authored-by: Jebq <jb.oger2312@gmail.com>
tsanikgr added a commit that referenced this pull request Sep 18, 2020
* Merge back to develop

* Simplifying viz.draw syntax in tutorial notebook (#46)

* Add non negativity constraint in numpy lasso (#41)

* Add plotting tutorial to the documentation (#47)

* Unpin some requirements

* Mixed type data generation (#55)

Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.

* Merge back to develop (#59)

* Pytorch NOTEARS (#63)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Update release.md

* Address coments

* Corrected release.md

* fc1 to adjacency

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Pinned sphinx-auto-doc-typehints (#66)

* Corrected a spelling/grammar mistake (#55)

* Fix/lint (#73)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* black

* pin pytorch version

* pin pytorch version

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Structure learning regressor (#68)

* initial commit (local copy-paste)

* fixed minor comments

* minor bugfix

* impute from children inital commit

* bugfixes and method option

* auto thresholding

* autothreshold and bugfix

* make threshold removal explicit

* add l1 argument

* remove child imputation

* feat importance fix and tabu logic

* moved threshold till dag

* restructure with base class

* coef mask

* recipe

* enable bias fitting

* persist bias as node attribute

* allow fit_intercept

* minor PR comment fixes

* minor comment adjustment

* test coverage and l1 clarification

* recipe

* minor test fixes

* more tests

* full test coverage

* revove python 3.5/3.6 unsupported import

* add normalization option

* idiomatic typing

* correct pylint errors

* update some tests

* more typeing updates

* more pylint requirements

* more pylint disable

* python 3.5 support

* try to get to work with 3.5

* full coverage and 3.5 support

* remove base class to pass test

* remove unneeded supression

* black formatting changes

* remove unused import

* pytlint supression

* minor reformat change

* isort fix

* better defensive programming

* fix unittests

* docstring update

* do Raises docstring properly

* action SWE suggestions

* hotfixes

* minor update

* minor black formatting change

* final merge checkbox

* fix end of file

* Data Gen root node initialisation fix (#72)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* fix for consinuous normal data

* generalise across all dtypes

* support fit_intercept

* fixed many test errors

* test logic fixes

* lint test fixes

* python 3.5 failure change

* minor test bugfix

* black

* pin pytorch version

* pin pytorch version

* additional test parameter

* black formatting

* requested changes

* test updates and docstring

* black format change

* disable too many lines

* change

* move recipe to tutorial folder

* releaseMD changes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>

* [1/2] Poisson data for data gen (#61)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* variable name change bugfix

* fix tests

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>

* [2/2] Nonlinear Data gen (#60)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* add nonlinear

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* add nonlinear to init

* change order in all

* change release.md

* root node fix on core + count

* nonlinear support to wrappers

* docstring update

* bugfix and reproducability fix

* many tests and test updates

* poiss bugfix and test fix

* moar test coverage

* categorical dataframe test coverage

* full test coverage and linting

* fix linting and fstring

* black reformat

* fix unused pylint argument

* pytest fix

* FINAL linting fix

* Fix stuff (#75)

CircleCI fixes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* update black version (#76)

* fix black

* Fix/check for NA or Infinity when notears is used  (#54)

* update scipy version (#77)

* add DYNOTEARS implementation (#50)

Adds DYNOTEARS and corresponding data generator (for testing)

* Pytorch NOTEARS extension - Non-Linear/Hidden Layer (#65)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Add hidden layer

* small refactor

* directional adj

* minor edits

* fix bias issues

* breaking changes update to the interface

* typo

* new regressor regularisation interface

* update forward method

* forward(X) predictions work

* working!

* bugfix data normalisation

* some fixes

* average regularisation and adj calc at end

* give credit!

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* loc lin docstring update

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* docstring + fc1/fc2 name updates

* moar docstring updates

* more minor updates

* remove normalize option

* plotting util

* rename to DAGRegressor

* rename and checks

* more util functions

* fix bias

* fix bias with no intercept

* fix linear adj

* add tests

* minor fix

* minor fixes

* extend interface to bias

* differentialte coef_ and feature_imporances

* seperate bias element

* tests

* more test coverage

* nonlinear test coverage

* test hotfix

* more test coverage

* test requirements update

* more test coverage

* formatting changes

* final pylint change

* more linting

* more bestpractice structuring

* more minor fixes

* FINAL linting updates

* actual last change

* update to reg defaults, additions to the tutorial

* nonlinear regularisation updates

* regressor tutorial

* almost finishing touches

* gradient based h function!

* soft clamp and coef feature importance seperation

* small api update, closer to batchnorm

* docstring updates

* stronger soft clamping

* gradient L1 rather than L2

* fcpos neg removal, gradient optim

* revert back to create_graph=True for 2nd derivative

* remove print and test fix

* black reformatting

* new black version

* full test coverage

* isort fix

* pylint fix

* first layer h(W) for speed optimization

* fix batch norm system

* add nonlinear test

* test hotfix

* black reformat

* isort fix

* remove X requirement from h_func

* regressor tutorial final commit and black update

* LayerNorm replacement

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* major changes

* add standardization

* minort changes

* fix tests

* rename reg parameters

* linting

* test coverage, docstting

* check array for infs

* fix isinstance to base type

* fix isort, add test coverage

* new tutorial

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* test string match

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* assert improvement

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* SWE suggestions

* minor bugfix

* more test fixing

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: angeldrothqb <67913551+angeldrothqb@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* Merge release/0.8.0 back into develop for release 0.8.0 (#82)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* release.md, version bump, docs

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* fix tests (#87)

* Fix pygments fail (#84)

Thanks Zain!

* update notebook beginning (#89)

* Add Binary distribution type support (#85)

* binary dtype folder and __init__

* dtype base class

* continuous dtype

* binary dtype

* update core

* make plural

* update interface for idx

* minor variable name change

* notears update

* python 3.5 support

* fix fstring

* remove categorical methods, doctrings

* formatting and docstrings

* remove redundant cat code

* isort

* indexerror check

* defensive check tests

* datatype loss tests

* more test coverage

* more tests and formatting

* fix test import

* remove double test

* linting

* docstring and pylint

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* fix long string

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* remove relative imports

* docstring fix

* dict comprehension

* list comprehension and neatness

* remove unuesd import to __init__

* fix test

* remove unused return interface

* add binary f1score tests

* one datatype instane per feature

* rename dtype -> disttype, attach dists to nodes

* fix tests

* fix linting

* fix preserve node dtyper

* fix tests

* fix tests

* fix tests

* final docstring and test fixes

* lint fix

* test_fix, warning

* linting

* fix test

* fix tests

* reduce threshold of test

* raise better error

* black linting

* remove warning

* remove useless supression and import

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Add sklearn binary classifier (#90)

* binary dtype folder and __init__

* dtype base class

* continuous dtype

* binary dtype

* update core

* make plural

* update interface for idx

* minor variable name change

* notears update

* python 3.5 support

* fix fstring

* remove categorical methods, doctrings

* formatting and docstrings

* remove redundant cat code

* isort

* indexerror check

* defensive check tests

* datatype loss tests

* more test coverage

* more tests and formatting

* fix test import

* remove double test

* linting

* docstring and pylint

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* fix long string

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* remove relative imports

* docstring fix

* dict comprehension

* list comprehension and neatness

* remove unuesd import to __init__

* fix test

* remove unused return interface

* new sklearn folder structure

* sklearn class outline

* new dtype interface

* docstring clarification

* inverse link function

* add binary f1score tests

* one datatype instane per feature

* rename dtype -> disttype, attach dists to nodes

* fix tests

* fix linting

* fix preserve node dtyper

* fix tests

* fix tests

* fix tests

* final docstring and test fixes

* lint fix

* test_fix, warning

* linting

* fix test

* fix tests

* reduce threshold of test

* docstring clarification

* _target_dist_type injection

* docstring updates + clf fit outline

* old doctring deprecation

* clf predict_proba and predict

* return bugfix

* docstring update

* import fix, linting, clf fit finished

* args docstring and None schema

* raise better error

* black linting

* linting

* revert to public interface

* remove warning

* remove useless supression and import

* add useless change to resolve merge conflict

* update inits

* standardization and data reconstruction

* remove unused imports

* fix clf .precit()

* regressor fit_predict

* remove useless regressor predict

* test import fix

* fix warnings

* pass series name thru

* fix schema pass thru

* better dict comprehension

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* import and comment fixes

* update to .format()

* fig sklearn is fitted test

* more dtype schema insertion

* DAGRegressor test fix

* dag regressor test

* more linting

* big test restructure

* combined test suite

* error string update

* more test coverage

* linting and isort

* move test to combined test

* return float64 preds

* moar clf tests

* remove untestable (multiclass) code

* class number error test

* balck reformat

* docstrings, pylint

* fix test bug

* standard scaler for _base

* pull classes direct from LabelEncoder

* update tutorial

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Fix/uniform discretisation (#65)

* Fix uniform discretiser

* Fix uniform discretiser

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* release.MD

* version bump

* Update causalnex/structure/pytorch/dist_type/_base.py

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Update causalnex/structure/pytorch/dist_type/__init__.py

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: GabrielAzevedoFerreiraQB <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: stevelersl <55385183+SteveLerQB@users.noreply.github.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: KING-SID <sidhantbendre22@gmail.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Jebq <jb.oger2312@gmail.com>
Co-authored-by: Shuhei Ishida <shuhei.ishida66@gmail.com>
tsanikgr added a commit that referenced this pull request Oct 5, 2020
* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* Release/0.8.0 (#80)

* Merge back to develop

* Simplifying viz.draw syntax in tutorial notebook (#46)

* Add non negativity constraint in numpy lasso (#41)

* Add plotting tutorial to the documentation (#47)

* Unpin some requirements

* Mixed type data generation (#55)

Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.

* Merge back to develop (#59)

* Pytorch NOTEARS (#63)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Update release.md

* Address coments

* Corrected release.md

* fc1 to adjacency

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Pinned sphinx-auto-doc-typehints (#66)

* Corrected a spelling/grammar mistake (#55)

* Fix/lint (#73)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* black

* pin pytorch version

* pin pytorch version

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Structure learning regressor (#68)

* initial commit (local copy-paste)

* fixed minor comments

* minor bugfix

* impute from children inital commit

* bugfixes and method option

* auto thresholding

* autothreshold and bugfix

* make threshold removal explicit

* add l1 argument

* remove child imputation

* feat importance fix and tabu logic

* moved threshold till dag

* restructure with base class

* coef mask

* recipe

* enable bias fitting

* persist bias as node attribute

* allow fit_intercept

* minor PR comment fixes

* minor comment adjustment

* test coverage and l1 clarification

* recipe

* minor test fixes

* more tests

* full test coverage

* revove python 3.5/3.6 unsupported import

* add normalization option

* idiomatic typing

* correct pylint errors

* update some tests

* more typeing updates

* more pylint requirements

* more pylint disable

* python 3.5 support

* try to get to work with 3.5

* full coverage and 3.5 support

* remove base class to pass test

* remove unneeded supression

* black formatting changes

* remove unused import

* pytlint supression

* minor reformat change

* isort fix

* better defensive programming

* fix unittests

* docstring update

* do Raises docstring properly

* action SWE suggestions

* hotfixes

* minor update

* minor black formatting change

* final merge checkbox

* fix end of file

* Data Gen root node initialisation fix (#72)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* fix for consinuous normal data

* generalise across all dtypes

* support fit_intercept

* fixed many test errors

* test logic fixes

* lint test fixes

* python 3.5 failure change

* minor test bugfix

* black

* pin pytorch version

* pin pytorch version

* additional test parameter

* black formatting

* requested changes

* test updates and docstring

* black format change

* disable too many lines

* change

* move recipe to tutorial folder

* releaseMD changes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>

* [1/2] Poisson data for data gen (#61)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* variable name change bugfix

* fix tests

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>

* [2/2] Nonlinear Data gen (#60)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* add nonlinear

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* add nonlinear to init

* change order in all

* change release.md

* root node fix on core + count

* nonlinear support to wrappers

* docstring update

* bugfix and reproducability fix

* many tests and test updates

* poiss bugfix and test fix

* moar test coverage

* categorical dataframe test coverage

* full test coverage and linting

* fix linting and fstring

* black reformat

* fix unused pylint argument

* pytest fix

* FINAL linting fix

* Fix stuff (#75)

CircleCI fixes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* update black version (#76)

* fix black

* Fix/check for NA or Infinity when notears is used  (#54)

* update scipy version (#77)

* add DYNOTEARS implementation (#50)

Adds DYNOTEARS and corresponding data generator (for testing)

* Pytorch NOTEARS extension - Non-Linear/Hidden Layer (#65)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Add hidden layer

* small refactor

* directional adj

* minor edits

* fix bias issues

* breaking changes update to the interface

* typo

* new regressor regularisation interface

* update forward method

* forward(X) predictions work

* working!

* bugfix data normalisation

* some fixes

* average regularisation and adj calc at end

* give credit!

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* loc lin docstring update

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* docstring + fc1/fc2 name updates

* moar docstring updates

* more minor updates

* remove normalize option

* plotting util

* rename to DAGRegressor

* rename and checks

* more util functions

* fix bias

* fix bias with no intercept

* fix linear adj

* add tests

* minor fix

* minor fixes

* extend interface to bias

* differentialte coef_ and feature_imporances

* seperate bias element

* tests

* more test coverage

* nonlinear test coverage

* test hotfix

* more test coverage

* test requirements update

* more test coverage

* formatting changes

* final pylint change

* more linting

* more bestpractice structuring

* more minor fixes

* FINAL linting updates

* actual last change

* update to reg defaults, additions to the tutorial

* nonlinear regularisation updates

* regressor tutorial

* almost finishing touches

* gradient based h function!

* soft clamp and coef feature importance seperation

* small api update, closer to batchnorm

* docstring updates

* stronger soft clamping

* gradient L1 rather than L2

* fcpos neg removal, gradient optim

* revert back to create_graph=True for 2nd derivative

* remove print and test fix

* black reformatting

* new black version

* full test coverage

* isort fix

* pylint fix

* first layer h(W) for speed optimization

* fix batch norm system

* add nonlinear test

* test hotfix

* black reformat

* isort fix

* remove X requirement from h_func

* regressor tutorial final commit and black update

* LayerNorm replacement

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* major changes

* add standardization

* minort changes

* fix tests

* rename reg parameters

* linting

* test coverage, docstting

* check array for infs

* fix isinstance to base type

* fix isort, add test coverage

* new tutorial

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* test string match

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* assert improvement

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* SWE suggestions

* minor bugfix

* more test fixing

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: angeldrothqb <67913551+angeldrothqb@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* release.md, version bump, docs

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: GabrielAzevedoFerreiraQB <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: stevelersl <55385183+SteveLerQB@users.noreply.github.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: KING-SID <sidhantbendre22@gmail.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Jebq <jb.oger2312@gmail.com>

* Release/0.8.1 (#94)

* Merge back to develop

* Simplifying viz.draw syntax in tutorial notebook (#46)

* Add non negativity constraint in numpy lasso (#41)

* Add plotting tutorial to the documentation (#47)

* Unpin some requirements

* Mixed type data generation (#55)

Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.

* Merge back to develop (#59)

* Pytorch NOTEARS (#63)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Update release.md

* Address coments

* Corrected release.md

* fc1 to adjacency

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Pinned sphinx-auto-doc-typehints (#66)

* Corrected a spelling/grammar mistake (#55)

* Fix/lint (#73)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* black

* pin pytorch version

* pin pytorch version

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Structure learning regressor (#68)

* initial commit (local copy-paste)

* fixed minor comments

* minor bugfix

* impute from children inital commit

* bugfixes and method option

* auto thresholding

* autothreshold and bugfix

* make threshold removal explicit

* add l1 argument

* remove child imputation

* feat importance fix and tabu logic

* moved threshold till dag

* restructure with base class

* coef mask

* recipe

* enable bias fitting

* persist bias as node attribute

* allow fit_intercept

* minor PR comment fixes

* minor comment adjustment

* test coverage and l1 clarification

* recipe

* minor test fixes

* more tests

* full test coverage

* revove python 3.5/3.6 unsupported import

* add normalization option

* idiomatic typing

* correct pylint errors

* update some tests

* more typeing updates

* more pylint requirements

* more pylint disable

* python 3.5 support

* try to get to work with 3.5

* full coverage and 3.5 support

* remove base class to pass test

* remove unneeded supression

* black formatting changes

* remove unused import

* pytlint supression

* minor reformat change

* isort fix

* better defensive programming

* fix unittests

* docstring update

* do Raises docstring properly

* action SWE suggestions

* hotfixes

* minor update

* minor black formatting change

* final merge checkbox

* fix end of file

* Data Gen root node initialisation fix (#72)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* fix for consinuous normal data

* generalise across all dtypes

* support fit_intercept

* fixed many test errors

* test logic fixes

* lint test fixes

* python 3.5 failure change

* minor test bugfix

* black

* pin pytorch version

* pin pytorch version

* additional test parameter

* black formatting

* requested changes

* test updates and docstring

* black format change

* disable too many lines

* change

* move recipe to tutorial folder

* releaseMD changes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>

* [1/2] Poisson data for data gen (#61)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* variable name change bugfix

* fix tests

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>

* [2/2] Nonlinear Data gen (#60)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* add nonlinear

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* add nonlinear to init

* change order in all

* change release.md

* root node fix on core + count

* nonlinear support to wrappers

* docstring update

* bugfix and reproducability fix

* many tests and test updates

* poiss bugfix and test fix

* moar test coverage

* categorical dataframe test coverage

* full test coverage and linting

* fix linting and fstring

* black reformat

* fix unused pylint argument

* pytest fix

* FINAL linting fix

* Fix stuff (#75)

CircleCI fixes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* update black version (#76)

* fix black

* Fix/check for NA or Infinity when notears is used  (#54)

* update scipy version (#77)

* add DYNOTEARS implementation (#50)

Adds DYNOTEARS and corresponding data generator (for testing)

* Pytorch NOTEARS extension - Non-Linear/Hidden Layer (#65)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Add hidden layer

* small refactor

* directional adj

* minor edits

* fix bias issues

* breaking changes update to the interface

* typo

* new regressor regularisation interface

* update forward method

* forward(X) predictions work

* working!

* bugfix data normalisation

* some fixes

* average regularisation and adj calc at end

* give credit!

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* loc lin docstring update

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* docstring + fc1/fc2 name updates

* moar docstring updates

* more minor updates

* remove normalize option

* plotting util

* rename to DAGRegressor

* rename and checks

* more util functions

* fix bias

* fix bias with no intercept

* fix linear adj

* add tests

* minor fix

* minor fixes

* extend interface to bias

* differentialte coef_ and feature_imporances

* seperate bias element

* tests

* more test coverage

* nonlinear test coverage

* test hotfix

* more test coverage

* test requirements update

* more test coverage

* formatting changes

* final pylint change

* more linting

* more bestpractice structuring

* more minor fixes

* FINAL linting updates

* actual last change

* update to reg defaults, additions to the tutorial

* nonlinear regularisation updates

* regressor tutorial

* almost finishing touches

* gradient based h function!

* soft clamp and coef feature importance seperation

* small api update, closer to batchnorm

* docstring updates

* stronger soft clamping

* gradient L1 rather than L2

* fcpos neg removal, gradient optim

* revert back to create_graph=True for 2nd derivative

* remove print and test fix

* black reformatting

* new black version

* full test coverage

* isort fix

* pylint fix

* first layer h(W) for speed optimization

* fix batch norm system

* add nonlinear test

* test hotfix

* black reformat

* isort fix

* remove X requirement from h_func

* regressor tutorial final commit and black update

* LayerNorm replacement

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* major changes

* add standardization

* minort changes

* fix tests

* rename reg parameters

* linting

* test coverage, docstting

* check array for infs

* fix isinstance to base type

* fix isort, add test coverage

* new tutorial

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* test string match

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* assert improvement

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* SWE suggestions

* minor bugfix

* more test fixing

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: angeldrothqb <67913551+angeldrothqb@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* Merge release/0.8.0 back into develop for release 0.8.0 (#82)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* release.md, version bump, docs

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* fix tests (#87)

* Fix pygments fail (#84)

Thanks Zain!

* update notebook beginning (#89)

* Add Binary distribution type support (#85)

* binary dtype folder and __init__

* dtype base class

* continuous dtype

* binary dtype

* update core

* make plural

* update interface for idx

* minor variable name change

* notears update

* python 3.5 support

* fix fstring

* remove categorical methods, doctrings

* formatting and docstrings

* remove redundant cat code

* isort

* indexerror check

* defensive check tests

* datatype loss tests

* more test coverage

* more tests and formatting

* fix test import

* remove double test

* linting

* docstring and pylint

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* fix long string

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* remove relative imports

* docstring fix

* dict comprehension

* list comprehension and neatness

* remove unuesd import to __init__

* fix test

* remove unused return interface

* add binary f1score tests

* one datatype instane per feature

* rename dtype -> disttype, attach dists to nodes

* fix tests

* fix linting

* fix preserve node dtyper

* fix tests

* fix tests

* fix tests

* final docstring and test fixes

* lint fix

* test_fix, warning

* linting

* fix test

* fix tests

* reduce threshold of test

* raise better error

* black linting

* remove warning

* remove useless supression and import

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Add sklearn binary classifier (#90)

* binary dtype folder and __init__

* dtype base class

* continuous dtype

* binary dtype

* update core

* make plural

* update interface for idx

* minor variable name change

* notears update

* python 3.5 support

* fix fstring

* remove categorical methods, doctrings

* formatting and docstrings

* remove redundant cat code

* isort

* indexerror check

* defensive check tests

* datatype loss tests

* more test coverage

* more tests and formatting

* fix test import

* remove double test

* linting

* docstring and pylint

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* fix long string

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* remove relative imports

* docstring fix

* dict comprehension

* list comprehension and neatness

* remove unuesd import to __init__

* fix test

* remove unused return interface

* new sklearn folder structure

* sklearn class outline

* new dtype interface

* docstring clarification

* inverse link function

* add binary f1score tests

* one datatype instane per feature

* rename dtype -> disttype, attach dists to nodes

* fix tests

* fix linting

* fix preserve node dtyper

* fix tests

* fix tests

* fix tests

* final docstring and test fixes

* lint fix

* test_fix, warning

* linting

* fix test

* fix tests

* reduce threshold of test

* docstring clarification

* _target_dist_type injection

* docstring updates + clf fit outline

* old doctring deprecation

* clf predict_proba and predict

* return bugfix

* docstring update

* import fix, linting, clf fit finished

* args docstring and None schema

* raise better error

* black linting

* linting

* revert to public interface

* remove warning

* remove useless supression and import

* add useless change to resolve merge conflict

* update inits

* standardization and data reconstruction

* remove unused imports

* fix clf .precit()

* regressor fit_predict

* remove useless regressor predict

* test import fix

* fix warnings

* pass series name thru

* fix schema pass thru

* better dict comprehension

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* import and comment fixes

* update to .format()

* fig sklearn is fitted test

* more dtype schema insertion

* DAGRegressor test fix

* dag regressor test

* more linting

* big test restructure

* combined test suite

* error string update

* more test coverage

* linting and isort

* move test to combined test

* return float64 preds

* moar clf tests

* remove untestable (multiclass) code

* class number error test

* balck reformat

* docstrings, pylint

* fix test bug

* standard scaler for _base

* pull classes direct from LabelEncoder

* update tutorial

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Fix/uniform discretisation (#65)

* Fix uniform discretiser

* Fix uniform discretiser

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* release.MD

* version bump

* Update causalnex/structure/pytorch/dist_type/_base.py

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Update causalnex/structure/pytorch/dist_type/__init__.py

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: GabrielAzevedoFerreiraQB <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: stevelersl <55385183+SteveLerQB@users.noreply.github.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: KING-SID <sidhantbendre22@gmail.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Jebq <jb.oger2312@gmail.com>
Co-authored-by: Shuhei Ishida <shuhei.ishida66@gmail.com>

* deprecate python3.5

* modify setup.py

* fix

* better black linting

* fix tests

* fix break coverage

* Update RELEASE.md

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: Angel Droth <67913551+angeldrothqb@users.noreply.github.com>
Co-authored-by: GabrielAzevedoFerreiraQB <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com>
Co-authored-by: stevelersl <55385183+SteveLerQB@users.noreply.github.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: KING-SID <sidhantbendre22@gmail.com>
Co-authored-by: Jebq <jb.oger2312@gmail.com>
Co-authored-by: Shuhei Ishida <shuhei.ishida66@gmail.com>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
tsanikgr added a commit that referenced this pull request Dec 7, 2020
* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* Release/0.8.0 (#80)

* Merge back to develop

* Simplifying viz.draw syntax in tutorial notebook (#46)

* Add non negativity constraint in numpy lasso (#41)

* Add plotting tutorial to the documentation (#47)

* Unpin some requirements

* Mixed type data generation (#55)

Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.

* Merge back to develop (#59)

* Pytorch NOTEARS (#63)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Update release.md

* Address coments

* Corrected release.md

* fc1 to adjacency

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Pinned sphinx-auto-doc-typehints (#66)

* Corrected a spelling/grammar mistake (#55)

* Fix/lint (#73)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* black

* pin pytorch version

* pin pytorch version

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Structure learning regressor (#68)

* initial commit (local copy-paste)

* fixed minor comments

* minor bugfix

* impute from children inital commit

* bugfixes and method option

* auto thresholding

* autothreshold and bugfix

* make threshold removal explicit

* add l1 argument

* remove child imputation

* feat importance fix and tabu logic

* moved threshold till dag

* restructure with base class

* coef mask

* recipe

* enable bias fitting

* persist bias as node attribute

* allow fit_intercept

* minor PR comment fixes

* minor comment adjustment

* test coverage and l1 clarification

* recipe

* minor test fixes

* more tests

* full test coverage

* revove python 3.5/3.6 unsupported import

* add normalization option

* idiomatic typing

* correct pylint errors

* update some tests

* more typeing updates

* more pylint requirements

* more pylint disable

* python 3.5 support

* try to get to work with 3.5

* full coverage and 3.5 support

* remove base class to pass test

* remove unneeded supression

* black formatting changes

* remove unused import

* pytlint supression

* minor reformat change

* isort fix

* better defensive programming

* fix unittests

* docstring update

* do Raises docstring properly

* action SWE suggestions

* hotfixes

* minor update

* minor black formatting change

* final merge checkbox

* fix end of file

* Data Gen root node initialisation fix (#72)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* fix for consinuous normal data

* generalise across all dtypes

* support fit_intercept

* fixed many test errors

* test logic fixes

* lint test fixes

* python 3.5 failure change

* minor test bugfix

* black

* pin pytorch version

* pin pytorch version

* additional test parameter

* black formatting

* requested changes

* test updates and docstring

* black format change

* disable too many lines

* change

* move recipe to tutorial folder

* releaseMD changes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>

* [1/2] Poisson data for data gen (#61)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* variable name change bugfix

* fix tests

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>

* [2/2] Nonlinear Data gen (#60)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* add nonlinear

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* add nonlinear to init

* change order in all

* change release.md

* root node fix on core + count

* nonlinear support to wrappers

* docstring update

* bugfix and reproducability fix

* many tests and test updates

* poiss bugfix and test fix

* moar test coverage

* categorical dataframe test coverage

* full test coverage and linting

* fix linting and fstring

* black reformat

* fix unused pylint argument

* pytest fix

* FINAL linting fix

* Fix stuff (#75)

CircleCI fixes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* update black version (#76)

* fix black

* Fix/check for NA or Infinity when notears is used  (#54)

* update scipy version (#77)

* add DYNOTEARS implementation (#50)

Adds DYNOTEARS and corresponding data generator (for testing)

* Pytorch NOTEARS extension - Non-Linear/Hidden Layer (#65)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Add hidden layer

* small refactor

* directional adj

* minor edits

* fix bias issues

* breaking changes update to the interface

* typo

* new regressor regularisation interface

* update forward method

* forward(X) predictions work

* working!

* bugfix data normalisation

* some fixes

* average regularisation and adj calc at end

* give credit!

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* loc lin docstring update

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* docstring + fc1/fc2 name updates

* moar docstring updates

* more minor updates

* remove normalize option

* plotting util

* rename to DAGRegressor

* rename and checks

* more util functions

* fix bias

* fix bias with no intercept

* fix linear adj

* add tests

* minor fix

* minor fixes

* extend interface to bias

* differentialte coef_ and feature_imporances

* seperate bias element

* tests

* more test coverage

* nonlinear test coverage

* test hotfix

* more test coverage

* test requirements update

* more test coverage

* formatting changes

* final pylint change

* more linting

* more bestpractice structuring

* more minor fixes

* FINAL linting updates

* actual last change

* update to reg defaults, additions to the tutorial

* nonlinear regularisation updates

* regressor tutorial

* almost finishing touches

* gradient based h function!

* soft clamp and coef feature importance seperation

* small api update, closer to batchnorm

* docstring updates

* stronger soft clamping

* gradient L1 rather than L2

* fcpos neg removal, gradient optim

* revert back to create_graph=True for 2nd derivative

* remove print and test fix

* black reformatting

* new black version

* full test coverage

* isort fix

* pylint fix

* first layer h(W) for speed optimization

* fix batch norm system

* add nonlinear test

* test hotfix

* black reformat

* isort fix

* remove X requirement from h_func

* regressor tutorial final commit and black update

* LayerNorm replacement

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* major changes

* add standardization

* minort changes

* fix tests

* rename reg parameters

* linting

* test coverage, docstting

* check array for infs

* fix isinstance to base type

* fix isort, add test coverage

* new tutorial

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* test string match

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* assert improvement

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* SWE suggestions

* minor bugfix

* more test fixing

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: angeldrothqb <67913551+angeldrothqb@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* release.md, version bump, docs

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: GabrielAzevedoFerreiraQB <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: stevelersl <55385183+SteveLerQB@users.noreply.github.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: KING-SID <sidhantbendre22@gmail.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Jebq <jb.oger2312@gmail.com>

* Release/0.8.1 (#94)

* Merge back to develop

* Simplifying viz.draw syntax in tutorial notebook (#46)

* Add non negativity constraint in numpy lasso (#41)

* Add plotting tutorial to the documentation (#47)

* Unpin some requirements

* Mixed type data generation (#55)

Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.

* Merge back to develop (#59)

* Pytorch NOTEARS (#63)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Update release.md

* Address coments

* Corrected release.md

* fc1 to adjacency

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Pinned sphinx-auto-doc-typehints (#66)

* Corrected a spelling/grammar mistake (#55)

* Fix/lint (#73)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* black

* pin pytorch version

* pin pytorch version

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Structure learning regressor (#68)

* initial commit (local copy-paste)

* fixed minor comments

* minor bugfix

* impute from children inital commit

* bugfixes and method option

* auto thresholding

* autothreshold and bugfix

* make threshold removal explicit

* add l1 argument

* remove child imputation

* feat importance fix and tabu logic

* moved threshold till dag

* restructure with base class

* coef mask

* recipe

* enable bias fitting

* persist bias as node attribute

* allow fit_intercept

* minor PR comment fixes

* minor comment adjustment

* test coverage and l1 clarification

* recipe

* minor test fixes

* more tests

* full test coverage

* revove python 3.5/3.6 unsupported import

* add normalization option

* idiomatic typing

* correct pylint errors

* update some tests

* more typeing updates

* more pylint requirements

* more pylint disable

* python 3.5 support

* try to get to work with 3.5

* full coverage and 3.5 support

* remove base class to pass test

* remove unneeded supression

* black formatting changes

* remove unused import

* pytlint supression

* minor reformat change

* isort fix

* better defensive programming

* fix unittests

* docstring update

* do Raises docstring properly

* action SWE suggestions

* hotfixes

* minor update

* minor black formatting change

* final merge checkbox

* fix end of file

* Data Gen root node initialisation fix (#72)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* fix for consinuous normal data

* generalise across all dtypes

* support fit_intercept

* fixed many test errors

* test logic fixes

* lint test fixes

* python 3.5 failure change

* minor test bugfix

* black

* pin pytorch version

* pin pytorch version

* additional test parameter

* black formatting

* requested changes

* test updates and docstring

* black format change

* disable too many lines

* change

* move recipe to tutorial folder

* releaseMD changes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>

* [1/2] Poisson data for data gen (#61)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* variable name change bugfix

* fix tests

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>

* [2/2] Nonlinear Data gen (#60)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* refactor & docstring

* remove unused helper object

* add data gen to init

* make test more robust

* add count data and test, use logs for poisson samples for stability

* add nonlinear

* fix tests

* duplicate fixtures

* remove unused fixtures

* refactor data_generators into package with core and wrappers

* move wrapper to test_wrapper

* add nonlinear to init

* change order in all

* change release.md

* root node fix on core + count

* nonlinear support to wrappers

* docstring update

* bugfix and reproducability fix

* many tests and test updates

* poiss bugfix and test fix

* moar test coverage

* categorical dataframe test coverage

* full test coverage and linting

* fix linting and fstring

* black reformat

* fix unused pylint argument

* pytest fix

* FINAL linting fix

* Fix stuff (#75)

CircleCI fixes

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* update black version (#76)

* fix black

* Fix/check for NA or Infinity when notears is used  (#54)

* update scipy version (#77)

* add DYNOTEARS implementation (#50)

Adds DYNOTEARS and corresponding data generator (for testing)

* Pytorch NOTEARS extension - Non-Linear/Hidden Layer (#65)

* NoTears as ScoreSolver

* refactor continuous solver

* adding attribute to access weight matrix

* refactoring continuous solver

* Adding fit_lasso method

* add data_gen_continuous.py and tests (#38)

* add data_gen.py

* rename

* wrap SM

* move data_gen_continous, create test

* more coverage

* test fixes

* move discrete sem to another file

* node list dupe check test

* ValueError tests

* replace dag and sem functions with Ben's verions

* add Ben's tests

* fix fstring

* to_numpy_array coverage

* Ben's comments

* remove unreachable ValueError for coverage

* remove unused fixture

* remove redundant test

* remove extensions

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docstring

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* docs

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* doc

Co-Authored-By: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* rename file, g_dag rename to sm

* add new tests for equal weights

* docstring

* steve docstring, leq fix

* steve comments + docstrings

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>

* Adding check input and removing some inner functions

* Removing attribute original_ndarray

* Aligning from pandas with new implementation

* Adding tests for fit_lasso

* More tests for lasso

* wrapping tabu params in a dict

* Aligning tests with new tabu params

* Aligning from_pandas with new tabu_params

* Adding fit_intercept option to _fit method

* Adding scaling option

* fixing lasso tests

* Adding a test for fit_intercept

* scaling option only with mean

* Correction in lasso bounds

* Fix typos

* Remove duplicated bounds function

* adding comments

* add torch files from xunzheng

* add from_numpy_torch function that works like from_numpy_lasso

* lint

* add requirements

* add debug functionality

* add visual debug test

* add license

* allow running as main for viz, comments

* move to contrib

* make multi layer work a bit better

* add comment for multi layer

* use polynomial dag constraint for better speed comparison

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* revert unnecessary changes to keep PR lean

* fixes

* refactor

* Integrated tests

* Checkpoint

* Refactoring

* Finished initial refactoring

* All tests passed

* Cleaning

* Git add testing

* Get adjacency matrix

* Done cleaning

* Revert change to original notears

* Revert change to original structuremodel

* Revert change to pylintrc

* Undo deletion

* Apply suggestions from Zain

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Addressed Zain comments

* Migrated from_numpy

* Delete contrib test

* Migrated w_threshold

* Some linting

* Change to None

* Undo deletion

* List comprehension

* Refactoring scipy and remove scipy optimiser

* Refactoring

* Refactoring

* Refactoring complete

* change from np to torch tensor

* More refactoring

* Remove hnew equal to None

* Refactor again and remove commented line

* Minor change

* change to params

* Addressing Philip's comment

* Add property

* Add fc2 property weights

* Change to weights

* Docstring

* Linting

* Linting completed

* Add gpu code

* Add gpu to from_numpy and from_pandas

* cuda 0 run out of memory

* Debugging

* put 5

* debugging gpu

* shift to inner loop

* debugging not in place

* Use cada instead of to

* Support both interfaces

* Benchmarking gpu

* Minor fix

* correct import path for test

* change gpu from 5 to 1

* Debugging

* Debugging

* Experimenting

* Linting

* Remove hidden layer and gpu

* Linting

* Testing and linting

* Correct pytorch to torch

* Add init zeros

* Change weight threshold to 0.25

* Revert requirements.txt

* Add hidden layer

* small refactor

* directional adj

* minor edits

* fix bias issues

* breaking changes update to the interface

* typo

* new regressor regularisation interface

* update forward method

* forward(X) predictions work

* working!

* bugfix data normalisation

* some fixes

* average regularisation and adj calc at end

* give credit!

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* loc lin docstring update

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* docstring + fc1/fc2 name updates

* moar docstring updates

* more minor updates

* remove normalize option

* plotting util

* rename to DAGRegressor

* rename and checks

* more util functions

* fix bias

* fix bias with no intercept

* fix linear adj

* add tests

* minor fix

* minor fixes

* extend interface to bias

* differentialte coef_ and feature_imporances

* seperate bias element

* tests

* more test coverage

* nonlinear test coverage

* test hotfix

* more test coverage

* test requirements update

* more test coverage

* formatting changes

* final pylint change

* more linting

* more bestpractice structuring

* more minor fixes

* FINAL linting updates

* actual last change

* update to reg defaults, additions to the tutorial

* nonlinear regularisation updates

* regressor tutorial

* almost finishing touches

* gradient based h function!

* soft clamp and coef feature importance seperation

* small api update, closer to batchnorm

* docstring updates

* stronger soft clamping

* gradient L1 rather than L2

* fcpos neg removal, gradient optim

* revert back to create_graph=True for 2nd derivative

* remove print and test fix

* black reformatting

* new black version

* full test coverage

* isort fix

* pylint fix

* first layer h(W) for speed optimization

* fix batch norm system

* add nonlinear test

* test hotfix

* black reformat

* isort fix

* remove X requirement from h_func

* regressor tutorial final commit and black update

* LayerNorm replacement

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* major changes

* add standardization

* minort changes

* fix tests

* rename reg parameters

* linting

* test coverage, docstting

* check array for infs

* fix isinstance to base type

* fix isort, add test coverage

* new tutorial

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* test string match

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* assert improvement

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* SWE suggestions

* minor bugfix

* more test fixing

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: angeldrothqb <angel.droth@quantumblack.com>
Co-authored-by: angeldrothqb <67913551+angeldrothqb@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* Merge release/0.8.0 back into develop for release 0.8.0 (#82)

* Hotfix/0.4.3 (#7) - Address broken links and grammar

* Fix documentation links in README (#2)

* Fix links in README

* library -> libraries

* Fix github link in docs

* Clean up grammar and consistency in documentation (#4)

* Clean up grammar and consistency in `README` files

* Add esses, mostly

* Reword feature description to not appear automatic

* Update docs/source/05_resources/05_faq.md

Co-Authored-By: Ben Horsburgh <benhorsburgh@outlook.com>

Co-authored-by: Ben Horsburgh <benhorsburgh@outlook.com>

* hotfix/0.4.3: fix broken links

Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>

* Release/0.5.0

* Plotting now backed by pygraphviz. This allows:
   * More powerful layout manager
   * Cleaner fully customisable theme
   * Out-the-box styling for different node and edge types
* Can now get subgraphs from StructureModel containing a specific node
* Bugfix to resolve issue when fitting CPDs with some missing states in data
* Minor documentation fixes and improvements

* Release/0.6.0

* Release/0.7.0 (#57)

* Added plottting tutorial to the documentation
* Updated `viz.draw` syntax in tutorial notebooks
* Bugfix on notears lasso (`from_numpy_lasso` and `from_pandas_lasso`) where the non-negativity constraint was not being set
* Added DAG-based synthetic data generator for mixed types (binary, categorical, continuous) using a linear SEM approach.
* Unpinned some requirements

* release.md, version bump, docs

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* fix tests (#87)

* Fix pygments fail (#84)

Thanks Zain!

* update notebook beginning (#89)

* Add Binary distribution type support (#85)

* binary dtype folder and __init__

* dtype base class

* continuous dtype

* binary dtype

* update core

* make plural

* update interface for idx

* minor variable name change

* notears update

* python 3.5 support

* fix fstring

* remove categorical methods, doctrings

* formatting and docstrings

* remove redundant cat code

* isort

* indexerror check

* defensive check tests

* datatype loss tests

* more test coverage

* more tests and formatting

* fix test import

* remove double test

* linting

* docstring and pylint

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* fix long string

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* remove relative imports

* docstring fix

* dict comprehension

* list comprehension and neatness

* remove unuesd import to __init__

* fix test

* remove unused return interface

* add binary f1score tests

* one datatype instane per feature

* rename dtype -> disttype, attach dists to nodes

* fix tests

* fix linting

* fix preserve node dtyper

* fix tests

* fix tests

* fix tests

* final docstring and test fixes

* lint fix

* test_fix, warning

* linting

* fix test

* fix tests

* reduce threshold of test

* raise better error

* black linting

* remove warning

* remove useless supression and import

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Add sklearn binary classifier (#90)

* binary dtype folder and __init__

* dtype base class

* continuous dtype

* binary dtype

* update core

* make plural

* update interface for idx

* minor variable name change

* notears update

* python 3.5 support

* fix fstring

* remove categorical methods, doctrings

* formatting and docstrings

* remove redundant cat code

* isort

* indexerror check

* defensive check tests

* datatype loss tests

* more test coverage

* more tests and formatting

* fix test import

* remove double test

* linting

* docstring and pylint

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* fix long string

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* docstring fix

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* remove relative imports

* docstring fix

* dict comprehension

* list comprehension and neatness

* remove unuesd import to __init__

* fix test

* remove unused return interface

* new sklearn folder structure

* sklearn class outline

* new dtype interface

* docstring clarification

* inverse link function

* add binary f1score tests

* one datatype instane per feature

* rename dtype -> disttype, attach dists to nodes

* fix tests

* fix linting

* fix preserve node dtyper

* fix tests

* fix tests

* fix tests

* final docstring and test fixes

* lint fix

* test_fix, warning

* linting

* fix test

* fix tests

* reduce threshold of test

* docstring clarification

* _target_dist_type injection

* docstring updates + clf fit outline

* old doctring deprecation

* clf predict_proba and predict

* return bugfix

* docstring update

* import fix, linting, clf fit finished

* args docstring and None schema

* raise better error

* black linting

* linting

* revert to public interface

* remove warning

* remove useless supression and import

* add useless change to resolve merge conflict

* update inits

* standardization and data reconstruction

* remove unused imports

* fix clf .precit()

* regressor fit_predict

* remove useless regressor predict

* test import fix

* fix warnings

* pass series name thru

* fix schema pass thru

* better dict comprehension

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* import and comment fixes

* update to .format()

* fig sklearn is fitted test

* more dtype schema insertion

* DAGRegressor test fix

* dag regressor test

* more linting

* big test restructure

* combined test suite

* error string update

* more test coverage

* linting and isort

* move test to combined test

* return float64 preds

* moar clf tests

* remove untestable (multiclass) code

* class number error test

* balck reformat

* docstrings, pylint

* fix test bug

* standard scaler for _base

* pull classes direct from LabelEncoder

* update tutorial

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Fix/uniform discretisation (#65)

* Fix uniform discretiser

* Fix uniform discretiser

Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>

* release.MD

* version bump

* Update causalnex/structure/pytorch/dist_type/_base.py

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

* Update causalnex/structure/pytorch/dist_type/__init__.py

Co-authored-by: Zain Patel <zain.patel@quantumblack.com>

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: GabrielAzevedoFerreiraQB <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com>
Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com>
Co-authored-by: stevelersl <55385183+SteveLerQB@users.noreply.github.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: qbphilip <philip.pilgerstorfer@quantumblack.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: KING-SID <sidhantbendre22@gmail.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Jebq <jb.oger2312@gmail.com>
Co-authored-by: Shuhei Ishida <shuhei.ishida66@gmail.com>

Co-authored-by: Ben Horsburgh <Ben.Horsburgh@quantumblack.com>
Co-authored-by: Zain Patel <30357972+mzjp2@users.noreply.github.com>
Co-authored-by: Nikos Tsaousis <tsanikgr@users.noreply.github.com>
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
Co-authored-by: Angel Droth <67913551+angeldrothqb@users.noreply.github.com>
Co-authored-by: GabrielAzevedoFerreiraQB <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com>
Co-authored-by: stevelersl <55385183+SteveLerQB@users.noreply.github.com>
Co-authored-by: LiseDiagneQB <60981366+LiseDiagneQB@users.noreply.github.com>
Co-authored-by: Casey Juanxi Li <50737712+caseyliqb@users.noreply.github.com>
Co-authored-by: Zain Patel <zain.patel@quantumblack.com>
Co-authored-by: KING-SID <sidhantbendre22@gmail.com>
Co-authored-by: Jebq <jb.oger2312@gmail.com>
Co-authored-by: Shuhei Ishida <shuhei.ishida66@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants