Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Hardware
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

SAP
/
FlexTab

Tabular Classification
FlexTab
tabular
foundation-model
deep-learning
in-context
tabular-regression
tabular-matching
tabular-anomaly-detection
tabular-multi-table
tabular-clustering
Model card Files Files and versions
xet
Community

Instructions to use SAP/FlexTab with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • FlexTab

    How to use SAP/FlexTab with FlexTab:

    pip install git+https://github.com/SAP-samples/flextab
    # Run a classification task
    from sklearn.datasets import load_breast_cancer
    from sklearn.metrics import accuracy_score
    from sklearn.model_selection import train_test_split
    
    from flextab import FlexTabClassifier
    
    # Load sample data
    X, y = load_breast_cancer(return_X_y=True)
    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42)
    
    # Initialize a classifier, 8k context and 8-fold bagging gives best performance, reduce if running out of memory
    clf = FlexTabClassifier(max_context_size=8192, bagging=8)
    
    clf.fit(X_train, y_train)
    
    # Predict probabilities
    prediction_probabilities = clf.predict_proba(X_test)
    # Predict labels
    predictions = clf.predict(X_test)
    print("Accuracy", accuracy_score(y_test, predictions))
    # Run a regression task
    from sklearn.datasets import fetch_openml
    from sklearn.metrics import r2_score
    from sklearn.model_selection import train_test_split
    
    from flextab import FlexTabRegressor
    
    # Load sample data
    df = fetch_openml(data_id=531, as_frame=True)
    X = df.data
    y = df.target.astype(float)
    
    # Train-test split
    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42)
    
    # Initialize the regressor, 8k context and 8-fold bagging gives best performance, reduce if running out of memory
    regressor = FlexTabRegressor(max_context_size=8192, bagging=8)
    
    regressor.fit(X_train, y_train)
    
    # Predict on the test set
    predictions = regressor.predict(X_test)
    
    r2 = r2_score(y_test, predictions)
    print("R² Score:", r2)
    # Run a matching task
    from sklearn.metrics import accuracy_score, roc_auc_score
    
    from flextab import FlexTabMatcher
    from flextab.utils.test_utils import load_febrl4
    
    left_train, left_test, right_train, right_test, y_train, y_test = load_febrl4()
    
    matcher = FlexTabMatcher(max_context_size=8192, bagging=1)
    matcher.fit(left_train, right_train, y_train)
    predictions = matcher.predict(left_test, right_test)
    print(f'Accuracy {accuracy_score(y_test, predictions):.2%}')
    # Probabilities (e.g. for thresholding or AUROC):
    # probas = matcher.predict_proba_matching(left_test, right_test)
    # print(f'AUROC {roc_auc_score(y_test, probas[:, 1]):.2%}')
  • Notebooks
  • Google Colab
  • Kaggle
FlexTab
3.5 GB
Ctrl+K
Ctrl+K
  • 3 contributors
History: 20 commits
marekpolewczyk's picture
marekpolewczyk
update
8d1b85c 2 days ago
  • .gitattributes
    1.57 kB
    Upload architecture.png with huggingface_hub 3 months ago
  • LICENSE
    19.3 kB
    license file and readme update 2 days ago
  • README.md
    8.05 kB
    update 2 days ago
  • architecture.png
    339 kB
    xet
    new checkpoints for remaining tasks and updated README for the full paper 8 days ago
  • flextab_ad_v1_0_0.pt
    699 MB
    xet
    new checkpoints for remaining tasks and updated README for the full paper 8 days ago
  • flextab_clustering_v1_0_0.pt
    704 MB
    xet
    new checkpoints for remaining tasks and updated README for the full paper 8 days ago
  • flextab_matching_v1_0_0.pt

    Detected Pickle imports (3)

    • "torch._utils._rebuild_tensor_v2",
    • "collections.OrderedDict",
    • "torch.BFloat16Storage"

    What is a pickle import?

    700 MB
    xet
    Rename ckpt_matching.pt to flextab_matching_v1_0_0.pt 3 months ago
  • flextab_multi_v1_0_0.pt
    700 MB
    xet
    new checkpoints for remaining tasks and updated README for the full paper 8 days ago
  • flextab_v1_0_0.pt

    Detected Pickle imports (3)

    • "torch.BFloat16Storage",
    • "torch._utils._rebuild_tensor_v2",
    • "collections.OrderedDict"

    What is a pickle import?

    700 MB
    xet
    Rename ckpt.pt to flextab_v1_0_0.pt 3 months ago
  • notebook.ipynb
    5.01 kB
    Upload notebook.ipynb 3 months ago