Convert Figma logo to code with AI

microsoft logodata-formulator

🪄 Create rich visualizations with AI

1,415
84
1,415
8

Top Related Projects

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.

35,868

DeepSpeed is a deep learning optimization library that makes distributed training and inference easy, efficient, and effective.

3,881

A fast library for AutoML and tuning. Join our Discord: https://discord.gg/Cppx2vSPVP.

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator

38,368

TensorFlow code and pre-trained models for BERT

85,015

Tensors and Dynamic neural networks in Python with strong GPU acceleration

Quick Overview

Data Formulator is an open-source project by Microsoft that aims to simplify the process of creating and managing data schemas for various data formats. It provides a unified approach to define, validate, and transform data structures across different platforms and languages.

Pros

  • Streamlines data schema creation and management
  • Supports multiple data formats and languages
  • Improves data consistency and interoperability
  • Reduces development time and potential errors in data handling

Cons

  • Limited documentation and examples available
  • Still in early development stages
  • May require a learning curve for users unfamiliar with schema definition concepts
  • Limited community support compared to more established data schema tools

Code Examples

# Define a simple schema
from data_formulator import Schema

user_schema = Schema({
    "name": str,
    "age": int,
    "email": str
})

# Validate data against the schema
valid_user = {"name": "John Doe", "age": 30, "email": "john@example.com"}
user_schema.validate(valid_user)  # Returns True

invalid_user = {"name": "Jane Doe", "age": "25", "email": "jane@example.com"}
user_schema.validate(invalid_user)  # Raises ValidationError
# Transform data using a schema
from data_formulator import Schema, Transform

transform_schema = Schema({
    "full_name": Transform(lambda x: x.upper()),
    "age": Transform(lambda x: x * 2)
})

data = {"full_name": "John Doe", "age": 30}
transformed_data = transform_schema.apply(data)
# Result: {"full_name": "JOHN DOE", "age": 60}
# Create a nested schema
nested_schema = Schema({
    "user": {
        "name": str,
        "address": {
            "street": str,
            "city": str,
            "country": str
        }
    },
    "orders": [int]
})

# Validate nested data
nested_data = {
    "user": {
        "name": "Alice",
        "address": {
            "street": "123 Main St",
            "city": "Anytown",
            "country": "USA"
        }
    },
    "orders": [1001, 1002, 1003]
}
nested_schema.validate(nested_data)  # Returns True

Getting Started

To get started with Data Formulator, follow these steps:

  1. Install the library:

    pip install data-formulator
    
  2. Import the necessary modules:

    from data_formulator import Schema, Transform
    
  3. Define your schema:

    my_schema = Schema({
        "name": str,
        "age": int,
        "email": str
    })
    
  4. Use the schema to validate or transform data:

    data = {"name": "Alice", "age": 28, "email": "alice@example.com"}
    my_schema.validate(data)
    

For more advanced usage and features, refer to the project's documentation and examples in the GitHub repository.

Competitor Comparisons

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.

Pros of transformers

  • Extensive library of pre-trained models for various NLP tasks
  • Active community and frequent updates
  • Comprehensive documentation and examples

Cons of transformers

  • Larger library size and potential overhead for simpler projects
  • Steeper learning curve for beginners

Code comparison

data-formulator:

from data_formulator import DataFormulator

df = DataFormulator()
result = df.generate_data("Create a list of 5 fruits")
print(result)

transformers:

from transformers import pipeline

generator = pipeline('text-generation', model='gpt2')
result = generator("List 5 fruits:", max_length=50)
print(result[0]['generated_text'])

Summary

transformers is a comprehensive library for NLP tasks with a wide range of pre-trained models, while data-formulator focuses on data generation. transformers offers more flexibility and options for various NLP applications, but may be more complex for simple tasks. data-formulator provides a straightforward approach to data generation, which could be beneficial for specific use cases.

35,868

DeepSpeed is a deep learning optimization library that makes distributed training and inference easy, efficient, and effective.

Pros of DeepSpeed

  • Highly optimized for large-scale distributed training of deep learning models
  • Supports various optimization techniques like ZeRO, pipeline parallelism, and 3D parallelism
  • Extensive documentation and examples for different use cases

Cons of DeepSpeed

  • Steeper learning curve due to its complexity and advanced features
  • Primarily focused on deep learning, may not be suitable for other data processing tasks
  • Requires more setup and configuration compared to simpler libraries

Code Comparison

DeepSpeed:

import deepspeed
model_engine, optimizer, _, _ = deepspeed.initialize(args=args,
                                                     model=model,
                                                     model_parameters=params)

Data Formulator:

# No direct code comparison available as Data Formulator
# is not a deep learning library

Summary

DeepSpeed is a powerful library for optimizing large-scale deep learning training, offering advanced features and optimizations. However, it comes with a steeper learning curve and is primarily focused on deep learning tasks. Data Formulator, on the other hand, appears to be a different type of project, likely focused on data processing or manipulation, making a direct comparison challenging without more information about its specific features and use cases.

3,881

A fast library for AutoML and tuning. Join our Discord: https://discord.gg/Cppx2vSPVP.

Pros of FLAML

  • More comprehensive AutoML toolkit with support for various tasks (classification, regression, time series forecasting, etc.)
  • Efficient hyperparameter tuning with cost-aware search algorithms
  • Active development and regular updates

Cons of FLAML

  • Steeper learning curve due to more advanced features
  • May be overkill for simpler data processing tasks
  • Requires more computational resources for complex optimizations

Code Comparison

FLAML example:

from flaml import AutoML
automl = AutoML()
automl.fit(X_train, y_train, task="classification")
predictions = automl.predict(X_test)

Data-Formulator example:

from data_formulator import DataFormulator
df = DataFormulator(data)
df.process()
result = df.get_result()

Summary

FLAML is a more comprehensive AutoML toolkit suitable for various machine learning tasks, while Data-Formulator focuses on data processing and transformation. FLAML offers advanced features like efficient hyperparameter tuning but may have a steeper learning curve. Data-Formulator is simpler to use for basic data manipulation tasks but lacks the advanced ML capabilities of FLAML. Choose based on your specific needs and project complexity.

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator

Pros of ONNX Runtime

  • Widely adopted and supported across multiple platforms and frameworks
  • Optimized for high-performance inference on various hardware
  • Extensive documentation and community support

Cons of ONNX Runtime

  • Larger codebase and more complex setup compared to Data Formulator
  • Primarily focused on inference, not data preprocessing or transformation

Code Comparison

Data Formulator:

from data_formulator import DataFormulator

df = DataFormulator()
df.add_column("new_column", lambda row: row["existing_column"] * 2)
transformed_data = df.transform(input_data)

ONNX Runtime:

import onnxruntime as ort

session = ort.InferenceSession("model.onnx")
input_name = session.get_inputs()[0].name
output_name = session.get_outputs()[0].name
result = session.run([output_name], {input_name: input_data})[0]

Summary

ONNX Runtime is a powerful inference engine for machine learning models, while Data Formulator focuses on data preprocessing and transformation. ONNX Runtime offers broader platform support and optimization capabilities, but may be overkill for simpler data manipulation tasks. Data Formulator provides a more straightforward approach to data transformation but lacks the extensive inference capabilities of ONNX Runtime.

38,368

TensorFlow code and pre-trained models for BERT

Pros of BERT

  • Widely adopted and extensively researched in the NLP community
  • Pre-trained models available for various languages and tasks
  • Extensive documentation and community support

Cons of BERT

  • Requires significant computational resources for training and fine-tuning
  • May be overkill for simpler NLP tasks
  • Limited flexibility for customizing the model architecture

Code Comparison

BERT example:

import tensorflow as tf
from transformers import BertTokenizer, TFBertModel

tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
model = TFBertModel.from_pretrained('bert-base-uncased')

Data Formulator example:

from data_formulator import DataFormulator

formulator = DataFormulator()
formulated_data = formulator.formulate(input_data)

While BERT focuses on natural language processing tasks, Data Formulator appears to be a tool for data manipulation and transformation. BERT provides pre-trained models for various NLP tasks, whereas Data Formulator seems to offer a more flexible approach to data formatting and preparation. The choice between the two would depend on the specific requirements of your project and the nature of the data you're working with.

85,015

Tensors and Dynamic neural networks in Python with strong GPU acceleration

Pros of PyTorch

  • Widely adopted and supported by a large community
  • Extensive ecosystem of tools and libraries
  • Flexible and intuitive for dynamic neural networks

Cons of PyTorch

  • Steeper learning curve for beginners
  • Larger memory footprint compared to some alternatives
  • Can be slower for certain operations on CPU

Code Comparison

Data-Formulator:

from data_formulator import DataFormulator

df = DataFormulator()
df.load_data("dataset.csv")
df.preprocess()

PyTorch:

import torch
from torch.utils.data import Dataset, DataLoader

class CustomDataset(Dataset):
    def __init__(self, data):
        self.data = data

    def __len__(self):
        return len(self.data)

    def __getitem__(self, idx):
        return self.data[idx]

While Data-Formulator focuses on simplifying data preprocessing and formatting, PyTorch provides a comprehensive framework for building and training neural networks. Data-Formulator offers a more streamlined approach for data preparation, while PyTorch requires more setup but offers greater flexibility and power for complex machine learning tasks.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Data Formulator icon Data Formulator: Create Rich Visualizations with AI

arxivLicense: MITYouTubebuild

Transform data and create rich visualizations iteratively with AI 🪄. Try Data Formulator now in GitHub Codespaces!

Open in GitHub Codespaces

News 🔥🔥🔥

  • [11-07-2024] Minor fun update: data visualization challenges!

    • We added a few visualization challenges with the sample datasets. Can you complete them all? [try them out!]
    • Comment in the issue when you did, or share your results/questions with others! [comment here]
  • [10-11-2024] Data Formulator python package released!

    • You can now install Data Formulator using Python and run it locally, easily. [check it out].
    • Our Codespaces configuration is also updated for fast start up ⚡️. [try it now!]
    • New experimental feature: load an image or a messy text, and ask AI to parse and clean it for you(!). [demo]
  • [10-01-2024] Initial release of Data Formulator, check out our [blog] and [video]!

Overview

Data Formulator is an application from Microsoft Research that uses large language models to transform data, expediting the practice of data visualization.

Data Formulator is an AI-powered tool for analysts to iteratively create rich visualizations. Unlike most chat-based AI tools where users need to describe everything in natural language, Data Formulator combines user interface interactions (UI) and natural language (NL) inputs for easier interaction. This blended approach makes it easier for users to describe their chart designs while delegating data transformation to AI.

Get Started

Play with Data Formulator with one of the following options:

  • Option 1: Install via Python PIP

    Use Python PIP for an easy setup experience, running locally (recommend: install it in a virtual environment).

    # install data_formulator
    pip install data_formulator
    
    # start data_formulator
    data_formulator 
    
    # alternatively, you can run data formualtor with this command
    python -m data_formulator
    

    Data Formulator will be automatically opened in the browser at http://localhost:5000.

    Update: you can specify the port number (e.g., 8080) by python -m data_formulator --port 8080 if the default port is occupied.

  • Option 2: Codespaces (5 minutes)

    You can also run Data Formulator in Codespaces; we have everything pre-configured. For more details, see CODESPACES.md.

    Open in GitHub Codespaces

  • Option 3: Working in the developer mode

    You can build Data Formulator locally if you prefer full control over your development environment and the ability to customize the setup to your specific needs. For detailed instructions, refer to DEVELOPMENT.md.

Using Data Formulator

Once you’ve completed the setup using either option, follow these steps to start using Data Formulator:

The basics of data visualization

  • Provide OpenAI keys and select a model (GPT-4o suggested) and choose a dataset.
  • Choose a chart type, and then drag-and-drop data fields to chart properties (x, y, color, ...) to specify visual encodings.

https://github.com/user-attachments/assets/0fbea012-1d2d-46c3-a923-b1fc5eb5e5b8

Create visualization beyond the initial dataset (powered by 🤖)

  • You can type names of fields that do not exist in current data in the encoding shelf:
    • this tells Data Formulator that you want to create visualizations that require computation or transformation from existing data,
    • you can optionally provide a natural language prompt to explain and clarify your intent (not necessary when field names are self-explanatory).
  • Click the Formulate button.
    • Data Formulator will transform data and instantiate the visualization based on the encoding and prompt.
  • Inspect the data, chart and code.
  • To create a new chart based on existing ones, follow up in natural language:
    • provide a follow up prompt (e.g., ``show only top 5!''),
    • you may also update visual encodings for the new chart.

https://github.com/user-attachments/assets/160c69d2-f42d-435c-9ff3-b1229b5bddba

https://github.com/user-attachments/assets/c93b3e84-8ca8-49ae-80ea-f91ceef34acb

Repeat this process as needed to explore and understand your data. Your explorations are trackable in the Data Threads panel.

Developers' Guide

Follow the developers' instructions to build your new data analysis tools on top of Data Formulator.

Research Papers

@article{wang2024dataformulator2iteratively,
      title={Data Formulator 2: Iteratively Creating Rich Visualizations with AI}, 
      author={Chenglong Wang and Bongshin Lee and Steven Drucker and Dan Marshall and Jianfeng Gao},
      year={2024},
      booktitle={ArXiv preprint arXiv:2408.16119},
}
@article{wang2023data,
  title={Data Formulator: AI-powered Concept-driven Visualization Authoring},
  author={Wang, Chenglong and Thompson, John and Lee, Bongshin},
  journal={IEEE Transactions on Visualization and Computer Graphics},
  year={2023},
  publisher={IEEE}
}

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.