causal-learn: Causal Discovery for Python

Overview

causal-learn: Causal Discovery for Python

Causal-learn is a python package for causal discovery that implements both classical and state-of-the-art causal discovery algorithms, which is a Python translation and extension of Tetrad.

The package is actively being developed. Feedbacks (issues, suggestions, etc.) are highly encouraged.

Package Overview

Our causal-learn implements methods for causal discovery:

  • Constrained-based causal discovery methods.
  • Score-based causal discovery methods.
  • Causal discovery methods based on constrained functional causal models.
  • Hidden causal representation learning.
  • Granger causality.
  • Multiple utilities for building your own method, such as independence tests, score functions, graph operations, and evaluations.

Install

Causal-learn needs the following packages to be installed beforehand:

  • python 3
  • numpy
  • networkx
  • pandas
  • scipy
  • scikit-learn
  • statsmodels
  • pydot

(For visualization)

  • matplotlib
  • graphviz

To use causal-learn, we could install it using pip:

pip install causal-learn

Documentation

Please kindly refer to causal-learn Doc for detailed tutorials and usages.

Contribution

Please feel free to open an issue if you find anything unexpected. And please create pull requests, perhaps after passing unittests in 'tests/', if you would like to contribute to causal-learn. We are always targeting to make our community better!

Comments
  • How to use BIC score

    How to use BIC score

    Hi, sorry to bother you@kunwuz ,

    I'm having some problems using the bic score. It always get a big number like -6951.8887543026485
    rewards = local_score_BIC(data,0,[0])

    The data is created by myself. I don't know the eaxt meaning of i and Pai.

    opened by MAX00008888 29
  • KCI-tests: Remove TestKCI and add assertions to TestCIT_KCI

    KCI-tests: Remove TestKCI and add assertions to TestCIT_KCI

    Updates:

    • Fix bugs (or typos) in causallearn/utils/KCI/KCI.py to conform to the original Matlab implementation in http://people.tuebingen.mpg.de/kzhang/KCI-test.zip:

      • KCI_CInd.kernel_matrix: KernelX and KernelY's empirical width depends on data_z's shape. The same applies to KernelY (Line 349, 373).
      • KCI_CInd.kernel_matrix: centering kernel matrix kzx (Line 404, 457, 462) before feeding it into KCI_V_statistic. After double checking, the optimization @MarkDana did previously (https://github.com/cmu-phil/causal-learn/pull/49) still applies.
      • KCI_CInd.kernel_matrix: change the data normalization way by adjusting the degrees of freedom correction in calculating the standard deviation.
    • Add test cases where the datasets are generated by nonGaussian distributions, e.g., exponential distribution, uniform distribution and the mixture of these distributions.

    • Remove print commands and add assertions on the exact p-value. The ground truth p-value is computed from the current version 26d8e36.

    Resolving the concerns:

    When the kernel width is set manually, there are two cases that may return a weird p-value even in the Matlab version. The details are listed in Weird_test_cases.pdf. After checking with the expert, these results are expected. More care should be taken as to what kernel width is set manually.

    Comparison of the current Python version with the Matlab version on KCI-test results:

    Since the Matlab version cannot support too flexible arguments, we only test the basic setting: applying Gaussian kernel to all variables X, Y and Z and setting the kernel width using empirical rules. The results for Python are as follows:

    import numpy as np
    import causallearn.utils.cit as cit
    
    # np.random.seed(50)
    # X = np.random.randn(30, 1)
    # X_prime = np.random.randn(30, 1)
    # Y = X + 0.5 * np.random.randn(30, 1)
    # Z = Y + 0.5 * np.random.randn(30, 1)
    # data = np.hstack((X, X_prime, Y, Z))
    # np.savetxt("GaussianData.csv", data, delimiter=",")
    data = np.loadtxt("GaussianData.csv", delimiter=",")
    
    • If we use gamma approximation (approx=True), the resulting p-value is deterministic.
    approx = True
    for use_gp in [True, False]:
        # The argument 'use_gp' only relates the conditional KCI, so only 'pXZY' will be affected.
        cit_CIT = cit.CIT(data, 'kci', kernelX='Gaussian', kernelY='Gaussian', kernelZ='Gaussian',
                          est_width='empirical', approx=approx, use_gp=use_gp)
        pXX = cit_CIT(0, 1)
        pXZ = cit_CIT(0, 3)
        pXZY = cit_CIT(0, 3, {2})
        print('\napprox =', approx, ', use_gp =', use_gp, ':')
        print('pXX:', round(pXX, 4))
        print('pXZ:', format(pXZ, '.4e'))
        print('pXZY', round(pXZY, 4))
    
    

    Output:

    approx = True , use_gp = True :
    pXX: 0.2662
    pXZ: 5.0105e-06
    pXZY 0.3585
    
    approx = True , use_gp = False :
    pXX: 0.2662
    pXZ: 5.0105e-06
    pXZY 0.3977
    
    • Otherwise (approx=False), the resulting p-value is not deterministic due to the simulation of null distribution in the function null_sample_spectral(xxx) in the class KCI_UInd and KCI_CInd. (I've checked that other deterministic parts can have the same output with the Matlab version on the same input.) Therefore, we run the program 500 times and calculate the mean of p-values.
    approx = False
    for use_gp in [True, False]:
        np.random.seed(50)
        pXX = []
        pXZ = []
        pXZY = []
        for i in range(500):
            cit_CIT = cit.CIT(data, 'kci', kernelX='Gaussian', kernelY='Gaussian', kernelZ='Gaussian',
                      est_width='empirical', approx=approx, use_gp=use_gp)
            p01 = cit_CIT(0, 1)
            pXX.append(p01)
            p03 = cit_CIT(0, 3)
            pXZ.append(p03)
            p032 = cit_CIT(0, 3, {2})
            pXZY.append(p032)
        print('\napprox =', approx, ', use_gp =', use_gp, ':')
        print('pXX: mean = {}, var = {}'.format(round(np.mean(pXX), 4), format(np.var(pXX), '.4e')))
        print('pXZ: mean = {}, var = {}'.format(round(np.mean(pXZ), 4), format(np.var(pXZ), '.4e')))
        print('pXZY: mean = {}, var = {}'.format(round(np.mean(pXZY), 4), format(np.var(pXZY), '.4e')))
    

    Output:

    approx = False , use_gp = True :
    pXX: mean = 0.246, var = 1.8853e-04
    pXZ: mean = 0.0001, var = 6.6156e-08
    pXZY: mean = 0.3371, var = 4.9257e-05
    
    approx = False , use_gp = False :
    pXX: mean = 0.2468, var = 1.8931e-04
    pXZ: mean = 0.0001, var = 7.1376e-08
    pXZY: mean = 0.3736, var = 4.5726e-05
    

    Using the same dataset GaussianData.csv generated by Python, the Matlab version results are provided in Matlab_results.pdf.

    We can see that they give the same p-value in deterministic cases and almost the same p-value in non-deterministic cases. This conclusion also applies to other datasets I tried on.

    Test plan:

    python -m unittest TestCIT_KCI    # should pass
    

    TODO:

    • Design more comprehensive test cases, including designing dataset of corner cases (e.g., data generated by more complicated distribution, discrete data type, larger sample size).
    opened by aoqiz 25
  • How to handle named variables

    How to handle named variables

    Hi,

    I have been working with the causal-learn package for a couple of weeks now and I was wondering if there is a plan to add support for named variables?

    As I understand it, at the moment data is generally assumed to take the form of a 2d np.array where each column contains a value for a particular variable X1, X2, ..., XN. I can quite easily take a csv file and convert it to this format but, in doing so, I lose the names of my columns. This relies on me having to keep track of which variable (X1, X2, ..., XN) corresponds to which named column of my csv data, which makes tasks such as visualising the output quite difficult.

    I have been using the to_pyplot method to draw the discovered DAG and passing it the labels. However, this relies on the order being preserved (simply replacing X1 with the first label, X2 with the second, and so on). This has tripped me a couple of times when comparing two graphs produced from similar data where the variables do not align.

    I am not sure what the solution is here, but it would be really useful if it were possible to attach actual variable names to the graph rather than doing this manually after computation. One possibility would be to support pandas dataframes for reading in data.

    opened by AndrewC19 13
  • memory consumption

    memory consumption

    On my dataset (~3.6w, ~40 feats), I found it may use over 40GB memory, ( and I have not get it end successfully) Maybe it needs to use some db to reduce max memory usage?

    opened by lockmatrix 11
  • add local_score_BIC_from_cov

    add local_score_BIC_from_cov

    Description section

    1. add local_score_BIC_from_cov
    2. set the default bic score function in GES.py with local_score_BIC_from_cov

    Test plan section

    python -m unittest TestGES.py # should pass image

    opened by wean2016 11
  • KCI mild speedup

    KCI mild speedup

    Updated functions:

    • causallearn/utils/KCI/KCI.py:
      • KCI_UInd.get_kappa: reduce O(n^3) to O(n^2) based on the equation np.trace(K.dot(K)) == np.sum(K * K.T).
      • L429 elif self.kernelY == 'Polynomial': fixed a naming bug in original code. Should be kernelZ.
      • KCI_CInd.KCI_V_statistic: L479, reduced one repeated calculation based on the fact that Kzx and Kzy are usually same.
    • causallearn/utils/KCI/Kernel.py:
      • Kernel.center_kernel_matrix: reduce O(n^3) to O(n^2) by plugging H = eye(n) - 1.0 / n into H.dot(K.dot(H)) and preventing the matrix multiplication.
    • causallearn/search/FCMBased/lingam/hsic.py: similar trick as Kernel.center_kernel_matrix.
    • causallearn/utils/cit.py: some trivial issue about specifying KCI kwargs.

    Speedup gain:

    • KCI_UInd (unconditional test): huge speedup (order of magnitude).
    • KCI_CInd (conditional test): reduces around 30% of time.
    • Overall, since conditional tests is always the bottleneck in an algorithm, this speedup is mild.
    • And thus we'll need more efficient way to calculate inverse and eigens of big matrix.

    Test plan:

    • To ensure that this update is logically consistent with the original code (under any possible parameters):
    np.random.seed(42)
    from causallearn_fa79007.utils.cit import CIT as CIT_new
    from causallearn_97e03ff.utils.cit import CIT as CIT_old
    
    data = np.random.uniform(-1, 1, (100, 4))
    for kernelname in ['Gaussian', 'Polynomial', 'Linear']:
        for est_width in ['empirical', 'median', 'manual']:
            for kwidth in [0.05, 0.1, 0.2]:
                for use_gp in [True, False]:
                    for approx in [True, False]:
                        for polyd in [1, 2]:
                            kci_new = CIT_new(data, 'kci', kernelX=kernelname, kernelY=kernelname, kernelZ=kernelname,
                                                  est_width=est_width, use_gp=use_gp, approx=approx, polyd=polyd,
                                                  kwidthx=kwidth, kwidthy=kwidth, kwidthz=kwidth)
                            kci_old = CIT_old(data, 'kci', kernelX=kernelname, kernelY=kernelname, kernelZ=kernelname,
                                                  est_width=est_width, use_gp=use_gp, approx=approx, polyd=polyd,
                                                  kwidthx=kwidth, kwidthy=kwidth, kwidthz=kwidth)
    
                            # since there is randomness in null_sample_spectral, we need to fix the same seed for old and new run
                            np.random.seed(42); new_pval = kci_new(0, 1)
                            np.random.seed(42); old_pval = kci_old(0, 1)
                            assert np.isclose(old_pval, new_pval), "KCI_UIND is inconsistent after update."
    
                            np.random.seed(42); new_pval = kci_new(0, 1, (2, 3))
                            np.random.seed(42); old_pval = kci_old(0, 1, (2, 3))
                            assert np.isclose(old_pval, new_pval), "KCI_CIND is inconsistent after update."
    
    • Test speedup for KCI_UInd:
    for samplesize in range(1000, 20001, 1000):
        data = np.random.uniform(-1, 1, (samplesize, 2))
        kci_new = CIT_new(data, 'kci')
        kci_old = CIT_old(data, 'kci')
        tic = time.time(); kci_new(0, 1); tac = time.time(); time_new = tac - tic
        tic = time.time(); kci_old(0, 1); tac = time.time(); time_old = tac - tic
        print(f'{samplesize}:   {time_new} {time_old}')
    
    Click to expand result

    1000: 0.021124839782714844 0.051096200942993164 2000: 0.09719705581665039 0.2551460266113281 3000: 0.2547168731689453 0.7614071369171143 4000: 0.41847896575927734 1.7734618186950684 5000: 0.6685688495635986 3.47568416595459 6000: 0.9402382373809814 5.513365030288696 7000: 1.2306361198425293 9.101417064666748 8000: 1.7108919620513916 13.641188144683838 9000: 2.544398069381714 19.632148027420044 10000: 2.4818150997161865 25.683223009109497 11000: 2.8643081188201904 34.334508180618286 12000: 3.705733060836792 42.83501696586609 13000: 4.3541929721832275 56.730401039123535 14000: 4.609248161315918 68.94092202186584 15000: 5.336583852767944 83.44993829727173 16000: 6.201767921447754 103.21840572357178 17000: 7.315479040145874 128.12122511863708 18000: 8.262160062789917 153.92690014839172 19000: 8.924943208694458 182.9679470062256 20000: 9.806303977966309 210.9531922340393

    time_uind

    • Test speedup for KCI_CInd:
    for samplesize in range(500, 10000, 250):
        data = np.random.uniform(-1, 1, (samplesize, 4))
        kci_new = CIT_new(data, 'kci')
        kci_old = CIT_old(data, 'kci')
        tic = time.time(); kci_new(0, 1, (2, 3)); tac = time.time(); time_new = tac - tic
        tic = time.time(); kci_old(0, 1, (2, 3)); tac = time.time(); time_old = tac - tic
        print(f'{samplesize}:   {time_new} {time_old}')
    
    Click to expand result

    500: 0.07363319396972656 0.10682296752929688 750: 0.23387503623962402 0.3343160152435303 1000: 0.4689028263092041 0.6680917739868164 1250: 1.0056912899017334 1.4335689544677734 1500: 1.8545763492584229 2.555225133895874 1750: 2.874561071395874 4.148720979690552 2000: 4.18735408782959 5.866267681121826 2250: 6.662433862686157 9.67330002784729 2500: 9.315114974975586 12.643889904022217 2750: 12.94197392463684 17.26453423500061 3000: 15.682774782180786 22.286062002182007 3250: 19.692520141601562 27.745235919952393 3500: 24.944950103759766 35.524142265319824 3750: 31.416036128997803 44.23967480659485 4000: 37.706125020980835 52.7396559715271 4250: 47.966763973236084 65.09382581710815 4500: 54.48931813240051 75.27616381645203 4750: 62.57163095474243 87.28439497947693 5000: 73.18962788581848 103.77545189857483 5250: 83.41915202140808 117.27962899208069 5500: 94.05676174163818 132.2629098892212 5750: 108.3281478881836 151.59633588790894 6000: 126.17060780525208 180.97449898719788 6250: 136.30685591697693 191.5569679737091 6500: 151.8123619556427 212.14035725593567 6750: 170.19479298591614 239.7194480895996 7000: 199.10978388786316 270.4898717403412 7250: 206.63027906417847 290.0352849960327 7500: 226.2251410484314 315.22972893714905 7750: 248.7306571006775 345.4090187549591 8000: 290.0406291484833 413.12121295928955 8250: 313.7044348716736 450.7824430465698 8500: 332.1730182170868 466.674519777298 8750: 352.3237581253052 486.6480839252472 9000: 374.6881170272827 519.5066709518433 9250: 412.67669320106506 571.1528761386871 9500: 436.2383370399475 612.9915819168091 9750: 474.7570939064026 669.191967010498

    time_cind

    opened by MarkDana 10
  • Need reference for PCMAX (default setting for PC in CL apparently)

    Need reference for PCMAX (default setting for PC in CL apparently)

    After some sleuthing in the Python code and some performance testing with the help of Pablo Puig and Bryan Andrews, I've come to the conclusion that the default setting for PC in CL is maxP. That is an algorithm of mine called PCMAX. The only reference for for this algorithm currently in the literature that I know of is an arXiv tech report I put out in 2016, this one:

    Ramsey, J. (2016). Improving accuracy and scalability of the pc algorithm by maximizing p-value. arXiv preprint arXiv:1610.00378.

    Anyway, the performance of PC in CL is the same as the performance of PCMAX in Tetrad (and different from the performance of PC in Tetrad.)

    If this is going to be made the default setting for PC for CL, perhaps this tech report should be referenced for the PC algorithm in the documentation? Otherwise no one will know what the algroithm is. I'll see if I can't sent that to a conference somewhere to get it published. I didn't realize that was being made the default here.

    opened by jdramsey 8
  • Granger causality

    Granger causality

    Update

    • Add auto test to Granger Causality. The ground truth p_value_matrix_truth and adj_matrix_truth are computed from the current version b49980d

    Test plan

    python -m unittest tests/TestGranger.py # should pass

    image

    TODO

    • Add tests for more complicated data, such as non-Gaussian data, mix of continuous and discrete data.
    opened by aoqiz 7
  • Added some unit tests for GIN

    Added some unit tests for GIN

    Description

    The GIN algorithm returns the graph and the causal order. In this algorithm, the causal order and the causal graph correspond to each other, so only the causal order in the result is asserted.

    Updates

    • Fixed the independence test problem in GIN
    • Added assertion to the previous test cases
    • Removed the plot function in previous test cases for GIN
    • Added tests to test GIN algorithm using the hsic independence test.
    • Updated docstring
    • Removed default parameter of indep_test
    • Refactored the test code

    Test Plan

    python -m unittest tests.TestGIN # should pass
    

    image

    opened by zhi-yi-huang 5
  • Throw exception in fisherz test

    Throw exception in fisherz test

    Updated files:

    1. causallearn/utils/cit.py: Added exception in fisherz test
    2. tests/TestCIT.py: Added a unit tests for fisherz test

    Test plan section

    python -m unittest tests.TestCIT # should pass
    

    image

    opened by zhi-yi-huang 5
  • Adding auto test for ANM

    Adding auto test for ANM

    Updates

    • Remove print commands and add assertions.
    • Add more simulated functions and save the data.
    • Fix some typos.

    Test plan python -m unittest TestANM.py # should pass

    image
    opened by ErdunGAO 5
  • Orientation rules for FCI

    Orientation rules for FCI

    Hello,

    Are the edge orientation rules for the FCI implementation taken from Zhang et al (2008)? This paper introduces additional orientation rules and proves their completeness. I am wondering if the entire set of orientation rules required for completeness are implemented in this package.

    1. Zhang, J. On the completeness of orientation rules for causal discovery in the presence of latent confounders and selection bias. Artificial Intelligence 172, 1873–1896 (2008).

    If not, from which citation(s) are the orientation rules taken?

    Thanks!

    opened by jmaasch 1
  • implementation of fGES (fast greedy equivalence search)

    implementation of fGES (fast greedy equivalence search)

    Does this repo have plans to implement the algorithm fGES[1]? fGES seems to work well for large scale problems. I wanna do some work on a large scale problem. If there is a related plan, it will help to use fGES more conveniently on the python platform, instead of calling Tetrad implemented in Java.

    [1] Ramsey J, Glymour M, Sanchez-Romero R, et al. A million variables and more: the fast greedy equivalence search algorithm for learning high-dimensional graphical causal models, with an application to functional magnetic resonance images[J]. International journal of data science and analytics, 2017, 3(2): 121-129.

    opened by huiouyang16 2
  • On the development of PNL

    On the development of PNL

    When will the implementation of the PNL method be completed? I saw that development has stopped since Feb 18, 2022. What are the remaining parts of the algorithm that needs to be implemented precisely? Maybe I can help

    opened by amir-rahnama 1
  • PC learns different graphs dependent on the ordering

    PC learns different graphs dependent on the ordering

    Hi,

    Thank you for your great work on this package! I am testing the behaviour of the PC algorithm on simple simulated data. I found that the number of directed edges detected differs based on the ordering of the variables given to the algorithm.

    I am running the following code:

    import numpy as np
    import matplotlib.pyplot as plt
    from causallearn.search.ConstraintBased.PC import pc
    
    def simulate_data(n_obs):
        '''
        Simulate data from the following graph
    
            A       B
             \     /
              v   v
                C
              /   \
             v     v
            D       E
        '''
        A = np.random.normal(size = n_obs)
        B = np.random.normal(size = n_obs)
        C = A + B + np.random.normal(size = n_obs)*0.25
        D = C + np.random.normal(size = n_obs)*0.25
        E = C + np.random.normal(size = n_obs)*0.25
        return np.stack((A,B,C,D,E), axis =1)
    
    # generate data
    n = 10000
    data = simulate_data(n)
    
    # test different permutations
    permutations = [[0,1,2,3,4], [0,1,3,2,4]]
    
    for permutation in permutations:
        graph = pc(data[:,permutation], 0.05, 'fisherz', node_names = np.array(["A","B", "C", "D", "E"])[permutation],  verbose = False)
        graph.draw_pydot_graph(labels=np.array(["A","B", "C", "D", "E"])[permutation])
        plt.show()
    

    When the ordering of variables C and D is permuted, the PC algorithm returns the Graph with an undirected edge from C to D. However, when the ordering is unpermuted, the PC algorithm correctly directs the edge from C to D. This happens, even though the p-values in the CI tests are unchanged for the two permutations. Is this expected behaviour or can you help me fix this?

    opened by theabrusch 6
  • Does DAG2PAG supports selection variable?

    Does DAG2PAG supports selection variable?

    Hi, I hope to use the dag2pag function in the causal-learn lab, i.e., causallearn.utils.DAG2PAG.

    However, I notice in the documentation, this function only support add latent variables.

    Is there a way to add selection variables (maybe a custom change to the function) ?

    Many thanks!

    opened by lmz123321 1
Releases(0.1.3.0)
  • 0.1.3.0(Oct 25, 2022)

  • 0.1.2.9(Oct 25, 2022)

  • 0.1.2.8(Jul 3, 2022)

    • Optimization of methods including PC, FCI, and GES.
    • Optimization of (conditional) independence tests.
    • Added GRaSP.
    • More unit tests.
    • Others
    Source code(tar.gz)
    Source code(zip)
  • 0.1.2.4(May 15, 2022)

    • Optimizations w.r.t. speed and maintainability.
    • Functions w.r.t. application in various scenarios, such as constraints based on background knowledge.
    • Functions w.r.t. improving user experience, such as customizing nodes in the visualization.
    • Other updates.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.2.1(Dec 28, 2021)

    • Optimize PC and FCI. Now they are even faster than the previous version.
    • Add several functionalities (e.g., background knowledge, progress bar, cache, and others) to some methods.
    • Update comments and documents. For instance, now we have default values as suggestions to general users.
    • More outputs, such as results as matrices.
    • Other updates.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.2.0(Dec 13, 2021)

    • Improve the implementation of FCI to make it drastically faster.
    • Several minor changes to improve user experience, such as visualization outputs.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.1.9(Nov 23, 2021)

  • 0.1.1.7(Nov 12, 2021)

Owner
null
Minimal examples of data structures and algorithms in Python

Pythonic Data Structures and Algorithms Minimal and clean example implementations of data structures and algorithms in Python 3. Contributing Thanks f

Keon 22k Jan 9, 2023
Repository for data structure and algorithms in Python for coding interviews

Python Data Structures and Algorithms This repository contains questions requiring implementation of data structures and algorithms concepts. It is us

Prabhu Pant 1.9k Jan 1, 2023
Python Sorted Container Types: Sorted List, Sorted Dict, and Sorted Set

Python Sorted Containers Sorted Containers is an Apache2 licensed sorted collections library, written in pure-Python, and fast as C-extensions. Python

Grant Jenks 2.8k Jan 4, 2023
All Algorithms implemented in Python

The Algorithms - Python All algorithms implemented in Python (for education) These implementations are for learning purposes only. Therefore they may

The Algorithms 150.6k Jan 3, 2023
A collection of design patterns/idioms in Python

python-patterns A collection of design patterns and idioms in Python. Current Patterns Creational Patterns: Pattern Description abstract_factory use a

Sakis Kasampalis 36.2k Jan 5, 2023
A lightweight, object-oriented finite state machine implementation in Python with many extensions

transitions A lightweight, object-oriented state machine implementation in Python with many extensions. Compatible with Python 2.7+ and 3.0+. Installa

null 4.7k Jan 1, 2023
:computer: Data Structures and Algorithms in Python

Algorithms in Python Implementations of a few algorithms and datastructures for fun and profit! Completed Karatsuba Multiplication Basic Sorting Rabin

Prakhar Srivastav 2.9k Jan 1, 2023
Algorithms implemented in Python

Python Algorithms Library Laurent Luce Description The purpose of this library is to help you with common algorithms like: A* path finding. String Mat

Laurent Luce 264 Dec 6, 2022
A fast python implementation of the SimHash algorithm.

This Python package provides hashing algorithms for computing cohort ids of users based on their browsing history. As such, it may be used to compute cohort ids of users following Google's Federated Learning of Cohorts (FLoC) proposal.

Hybrid Theory 19 Dec 15, 2022
A command line tool for memorizing algorithms in Python by typing them.

Algo Drills A command line tool for memorizing algorithms in Python by typing them. In alpha and things will change. How it works Type out an algorith

Travis Jungroth 43 Dec 2, 2022
A genetic algorithm written in Python for educational purposes.

Genea: A Genetic Algorithm in Python Genea is a Genetic Algorithm written in Python, for educational purposes. I started writing it for fun, while lea

Dom De Felice 20 Jul 6, 2022
Python sample codes for robotics algorithms.

PythonRobotics Python codes for robotics algorithm. Table of Contents What is this? Requirements Documentation How to use Localization Extended Kalman

Atsushi Sakai 17.2k Jan 1, 2023
An implementation of ordered dithering algorithm in python as multimedia course project

One way of minimizing the size of an image is to simply reduce the number of bits you use to represent each pixel.

null 7 Dec 2, 2022
zoofs is a Python library for performing feature selection using an variety of nature inspired wrapper algorithms. The algorithms range from swarm-intelligence to physics based to Evolutionary. It's easy to use ,flexible and powerful tool to reduce your feature size.

zoofs is a Python library for performing feature selection using a variety of nature-inspired wrapper algorithms. The algorithms range from swarm-intelligence to physics-based to Evolutionary. It's easy to use , flexible and powerful tool to reduce your feature size.

Jaswinder Singh 168 Dec 30, 2022
A Python Package for Portfolio Optimization using the Critical Line Algorithm

A Python Package for Portfolio Optimization using the Critical Line Algorithm

null 19 Oct 11, 2022
The DarkRift2 networking framework written in Python 3

DarkRiftPy is Darkrift2 written in Python 3. The implementation is fully compatible with the original version. So you can write a client side on Python that connects to a Darkrift2 server written in C# using the original Darkrift2 library, and vice versa.

Anton Dobryakov 6 May 23, 2022
🧬 Performant Evolutionary Algorithms For Python with Ray support

?? Performant Evolutionary Algorithms For Python with Ray support

Nathan 49 Oct 20, 2022
Genius Square puzzle solver in Python

Genius Square puzzle solver in Python

James 3 Dec 15, 2022
Python based framework providing a simple and intuitive framework for algorithmic trading

Harvest is a Python based framework providing a simple and intuitive framework for algorithmic trading. Visit Harvest's website for details, tutorials

null 100 Jan 3, 2023