Giter Club home page Giter Club logo

Comments (6)

Antitesla avatar Antitesla commented on September 23, 2024

To be clear I compute real-time stream of data and need to do that so fast as possible. So, may be I can comment some checks at the code of library? Because It's seems library do some checks which slow down transformation.

from autofeat.

cod3licious avatar cod3licious commented on September 23, 2024

The time that the .transform() function needs scales with the number of features that are computed, not so much with the number of data points it is applied to (since this is internally parallelised by numpy/pandas). So maybe your best option might be to manually check which features are computed when calling transform and then hard code your own routines for computing these features in your pipeline. Indeed there is otherwise a lot of computation done to make sure the transformation works for different types of features, NaNs, etc, which you probably don't need.

from autofeat.

Antitesla avatar Antitesla commented on September 23, 2024
def fast(self, df):
    feat_array = np.zeros((len(df), len(self.new_feat_cols_)))
    for i, expr in enumerate(self.new_feat_cols_):
        cols = [c for i, c in enumerate(self.feateng_cols_) if colnames2symbols(c, i) in expr]
        f = lambdify([self.feature_formulas_[c] for c in cols], self.feature_formulas_[expr])
        not_na_idx = df[cols].all(axis=1)
        feat_array[not_na_idx, i] = f(*(df[c].to_numpy(dtype=float)[not_na_idx] for c in cols))
    df = df.join(pd.DataFrame(feat_array, columns=self.new_feat_cols_, index=df.index))
    return df

from autofeat.

Antitesla avatar Antitesla commented on September 23, 2024

I cutten everything I thought unneeded from code. Now performance is better, but not yet enough. May be you have any idea how to make it a bit faster, to not implement formula applying on my side? )

from autofeat.

cod3licious avatar cod3licious commented on September 23, 2024

you could probably parallelize the for loop, i.e., apply the transformations for each feature in parallel and then concatenate all the results and add them to the dataframe, but the slowest part is the sympy stuff that is happening in lambdify, where the symbolic function is translated into actual numpy computation, but this you only get rid of by implementing the transformations you need directly in numpy

from autofeat.

Antitesla avatar Antitesla commented on September 23, 2024

Nice idea to fork for each feature. Thank you!

from autofeat.

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.