Skip to content

ccnets-team/causal-learning

Repository files navigation

Causal Learning Framework by CCNets

Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge

Monitor Real-Time CCNets W&B Workspace

Explore our real-time modeling and causal learning metrics: Workspace Link

Table of Contents

๐ŸŽˆ Overview

Introduction

CCNet is a new ML framework designed to uncover and model causal relationships between input observations ๐‘‹ and labels ๐‘ฆ in datasets. This framework employs three neural networks to form a cooperative structure that enables bidirectional inference between input ๐‘‹ and target ๐‘ฆ.

This framework learns an explanation vector ๐‘’ that transforms the associations observed between inputs ๐‘‹ and outputs y into a causal relationship. Here, ๐‘’ and ๐‘ฆ are considered comprehensive factors instrumental in generating ๐‘‹.

Key Capabilities

CCNet consists of three neural networks having role of โ€”Explainer, Reasoner, and Producerโ€”to execute six fundamental operations in machine learning:

  • Explain: Extracts key features from input observations (X) to form an Explanation Vector(e), which captures the essential aspects of the data.

  • Reason: Utilizes the Explanation Vector alongside Input Observations (X) to infer the associated label (y) of the observation.

  • Produce: Generates new data based on specified conditions and the derived Explanation(e), enabling the creation of data instances that resemble authentic observations.

  • Infer: Determines outputs (y') from input data (X) by integrating the insights from both the Explainer and Reasoner networks, providing a prediction or outcome based on learned patterns.

  • Generate: Constructs new data using the Explanation Vector with randomly sampled conditions (y), allowing for the exploration of possible data scenarios that could occur under different circumstances.

  • Reconstruct: Rebuilds input data (X) by sequentially explaining, reasoning, and then producing the output, effectively creating a reconstructed version of the input based on the network's understanding and reasoning.


โ—๏ธ Dependencies

conda create -name ccnets python=3.9.18
conda activate ccnets
pip install jupyter
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
pip install pandas==2.2.2
pip install scikit-learn==1.1.0
pip install transformers==4.40.2
pip install tensorboard==2.16.2
pip install ipywidgets==8.1.2

๐Ÿ“ฅ Installation

  • Steps to install the framework.
  • Note: Ensure you have the required dependencies installed as listed in the "Dependencies" section above.

Installation Steps:

  1. Clone the repository:

    git clone https://github.com/ccnets-team/causal-learning.git
  2. Navigate to the directory and install the required packages:

    cd ccnets
    
    pip install -r requirements.txt
    
    conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

๐Ÿ“– Features

Dual Cooperative Network Architecture in CCNets API:

CCNets harnesses a dual cooperative network structure, each designed to optimize the processing and analysis of complex datasets

two_nets

  • Core Cooperative Network (GPT-based)

    At the core of CCNetsโ€™ architecture is a Cooperative Network configured with GPT models. These models are optimized for sequence learning and label comprehension within extensive datasets. They serve as the central processing unit, adept at handling and interpreting sequence data and extracting meaningful insights from complex patterns.

  • Encoder Cooperative Network

    The Encoder Cooperative Network is engineered to preprocess and transform raw input data into a format that significantly enhances the analytical capabilities of the Core Cooperative Network. This network specializes in adapting raw data into a structured, analyzable form. For example, in handling image data, this network translates visual information into a trajectory format.



Example Categories :

Labelโฌ‡๏ธ\Dataโžก๏ธ Type Tabular Time-Series Image Text
Binary Classification - Creditcard Fraud Dataset
- Airline Customer Satisfaction
Multi Class Classification - EEG performance
- Mice DNA Prediction
- Korean Stock Prediction
- Crop & Weed Classification
- CelebA CCNet
- Generate Handwritten Digits
- Old Painting to Photo
- Gender Expression Reshape
- Animal Match
- Recycling Classification
Multi Label Classification
Single Regression - Climate Prediction
- Energy Prediction
Compositional Regression - Drug Composition Prediction
Ordinal Regression - Amazon Reviews NLP
Generation - Synthesize Fraud Data - Make Pokemon
- Celeba encoding CCNet


๐Ÿ”Ž API Documentation

  • We're currently in the process of building our official documentation webpage to better assist you. In the meantime, if you have any specific questions or need clarifications, feel free to reach out through our other support channels. We appreciate your patience and understanding!


๐Ÿž Issue Reporting Policy

More Information Thank you for taking the time to report issues and provide feedback. This helps improve our project for everyone! To ensure that your issue is handled efficiently, please follow the guidelines below:

1. Choose the Right Template:

We provide three issue templates to streamline the reporting process:

  1. Bug Report: Use this template if you've found a bug or something isn't working as expected. Please provide as much detail as possible to help us reproduce and fix the bug.
  2. Feature Request: If you have an idea for a new feature or think something could be improved, this is the template to use. Describe the feature, its benefits, and how you envision it.
  3. Custom Issue Template: For all other issues or general feedback, use this template. Make sure to provide sufficient context and detail.

2. Search First:

Before submitting a new issue, please search the existing issues to avoid duplicates. If you find a similar issue, you can add your information or ๐Ÿ‘ the issue to show your support.

3. Be Clear and Concise:

  • Title: Use a descriptive title that summarizes the issue.
  • Description: Provide as much detail as necessary, but try to be concise. If reporting a bug, include steps to reproduce, expected behavior, and actual behavior.
  • Screenshots: If applicable, add screenshots to help explain the issue.

4. Use Labels:

If possible, categorize your issue using the appropriate GitHub labels. This helps us prioritize and address issues faster.

5. Stay Engaged:

After submitting an issue, please check back periodically. Maintainers or other contributors may ask for further information or provide updates.

Thank you for helping improve our project! Your feedback and contributions are invaluable.



โœ‰๏ธ LICENSE

Causal Learning is dual-licensed under the GNU General Public License version 3(GPLv3) and a separate Commercial License.

Please consult the LICENSE files in the repository for more detailed information on the licensing of Causal Learning.