Git Product home page Git Product logo

Comments (2)

leewyang avatar leewyang commented on June 4, 2024

There are a couple ways to achieve this:

  • add a tf.identity(x) to your model to echo whatever inputs you desire.
  • use a Spark UDF to invoke the model using df.withColumn(udf(x)).

Unfortunately, I don't have any ready examples of these...

Alternatively, if you want to create a PR with your modifications to pipeline.py, I can take a look at incorporating it (assuming that we have a way to preserve backwards-compatibility for folks who expect the prior behavior).

from tensorflowonspark.

dilta avatar dilta commented on June 4, 2024

Thank you, @leewyang for your advice! I will try your advice next time in similar cases.

Regarding the PR, I don't want to contaminate your beautiful codebase.

What I did in pipeline.py was that:

  1. _transform()
    Use a list to keep track of original columns other than the input_cols.
    dataset.select(all of the columns instead of just input features).
    append original columns' names in spark.createDataFrame() in addition to output_cols.
  2. yield_batch()
    Add a list to contain additional original columns like tensors[].
    In the for item in iterable:, append the original columns into that list; yield tensors, original_columns_list.
    So, I also need to change _run_model_tf1 and _run_model_tf2.
  3. _run_model_tf1 and _run_model_tf2
    Get the original columns list from yield_batch() along with tensors, put it in the result.extend(zip(*(here + python_outputs)))

Personally, I was looking for better ways of handing this. Thank you very much!

from tensorflowonspark.

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.