GithubHelp home page GithubHelp logo

Comments (12)

TZTsai avatar TZTsai commented on May 24, 2024

@dionman
Which version are you using? Could you try the latest version in my fork? RuntimeError: Conditional mismatch. Got inference conditional, without any training conditional is probably due to a previous bug that the Plugin requires an explicit cond argument during fit if you want to generate with a cond as well, but DDPM automatically sets the labels as the cond if is_classification=True. This has already been fixed.

For the second problem, yes the cond should have a float or int data type for the moment, because otherwise it needs one-hot encoding, while in the diffusion model it is assumed to be 1-dimensional. Perhaps you can also use LabelEncoder to encode the cond if it has an object dtype and provide it to the fit method as follows.
图片

from synthcity.

dionman avatar dionman commented on May 24, 2024

I'm using release v0.2.5. Is it fixed at this version of the code?

from synthcity.

TZTsai avatar TZTsai commented on May 24, 2024

I'm using release v0.2.5. Is it fixed at this version of the code?

I checked that commit. Sorry it is not fixed there.

from synthcity.

dionman avatar dionman commented on May 24, 2024

okay, what workaround should I use at the moment? Import the library from your fork?

from synthcity.

TZTsai avatar TZTsai commented on May 24, 2024

You can replace Line 214-224 in src/synthcity/plugins/generic/plugin_ddpm.py with the following code:

        df = self.encoder.fit_transform(df)

        if cond is not None:
            if type(cond) is str:
                cond = df[cond]
            cond = pd.Series(cond, index=df.index)
            self.expecting_conditional = True

        # NOTE: cond may also be included in the dataframe
        self.model.fit(df, cond, **kwargs)
        self.loss_history = self.model.loss_history

        return self

from synthcity.

dionman avatar dionman commented on May 24, 2024

do you mean lines 218-224?

from synthcity.

TZTsai avatar TZTsai commented on May 24, 2024

do you mean lines 218-224?

No, should be from line 214, starting with else:.

from synthcity.

dionman avatar dionman commented on May 24, 2024

https://github.com/TZTsai/synthcity/blob/e336d3cd42516cef27ac4ad60ac0df61bd92f1a6/src/synthcity/plugins/generic/plugin_ddpm.py#L157
self.encoder also needs to be added earlier in this script
...which implies changing a few more things

from synthcity.

TZTsai avatar TZTsai commented on May 24, 2024

TZTsai/synthcity@e336d3c/src/synthcity/plugins/generic/plugin_ddpm.py#L157 self.encoder also needs to be added earlier in this script ...which implies changing a few more things

Sorry I forgot about that. You can comment that line for the moment. Can it run after that?

from synthcity.

dionman avatar dionman commented on May 24, 2024

Thanks. Is there any cleaner way to enable this after the most recent commits in the main? Can I use any branch in your fork?

from synthcity.

TZTsai avatar TZTsai commented on May 24, 2024

Sorry I just found my last reply wasn't sent out, probably due to internet reasons. In the latest version of the main branch, this should work fine. Have you checked it?

from synthcity.

dionman avatar dionman commented on May 24, 2024

thanks, yes, this works

from synthcity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.