Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about data generation #201

Open
Yanboliu123 opened this issue Feb 23, 2025 · 0 comments
Open

Questions about data generation #201

Yanboliu123 opened this issue Feb 23, 2025 · 0 comments

Comments

@Yanboliu123
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant