Skip to content

Questions about data generation #201

@Yanboliu123

Description

@Yanboliu123

I used the code given on the official website for testing, as follows:

import numpy as np
import torch
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from tabpfn_extensions import TabPFNClassifier, TabPFNRegressor
from tabpfn_extensions import unsupervised

df = load_breast_cancer(return_X_y=False)
X, y = df["data"], df["target"]
attribute_names = df["feature_names"]

X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.5, random_state=42
)

clf = TabPFNClassifier(n_estimators=3, device='cuda')
reg = TabPFNRegressor(n_estimators=3, device='cuda')
model_unsupervised = unsupervised.TabPFNUnsupervisedModel(
tabpfn_clf=clf, tabpfn_reg=reg
)

feature_indices = [0, 1]

exp_synthetic = unsupervised.experiments.GenerateSyntheticDataExperiment(
task_type="unsupervised"
)

X_tensor = torch.tensor(X_train, dtype=torch.float32).reshape(-1, X_train.shape[1])
y_tensor = torch.tensor(y_train, dtype=torch.float32)

results = exp_synthetic.run(
tabpfn=model_unsupervised,
X=X_tensor,
y=y_tensor,
attribute_names=attribute_names,
temp=0.8,
n_samples=X_train.shape[0] * 3,
indices=feature_indices,
)

if results is None:
raise ValueError("Build failed, please check the library version or parameters!")

After I finished running it, I found that there was an error after running it, that is, there was no new data generated in the "results". I would like to ask you, if I want to save new data as a csv file, how do I do it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions