Code Monkey home page Code Monkey logo

Comments (8)

jmoralez avatar jmoralez commented on June 6, 2024

Hey. I'm not sure if there's a guarantee that the local and distributed models will be the same. Once you have both you can compare them with the trees_to_dataframe method, e.g.

dstr_df = fcst_dstr.models_['SparkXGBForecast'].get_booster().trees_to_dataframe()
local_df = fcst.models_['XGBregressor'].get_booster().trees_to_dataframe()

About the predict method, how are you running it?

from mlforecast.

iamyihwa avatar iamyihwa commented on June 6, 2024

Sure! Thanks I will try checking the trees!

Another thing I noticed was that for SparkXGBForecast, it was giving different result with the same dataset, whereas non distributed version it was consistent results.
I didn't set any random seed to neither of the models ..

from xgboost.spark import SparkXGBRegressor
spark_xgb = SparkXGBRegressor(num_workers=8, label_col='target', features_col='features')
xgb_regressor_model = spark_xgb.fit(train_sf_tf)
transformed_test_spark_dataframe = spark_xgb.predict(test_spark_dataframe)

With the last line, I am getting this error.
AttributeError: 'SparkXGBRegressor' object has no attribute 'predict'

from mlforecast.

jmoralez avatar jmoralez commented on June 6, 2024

I think you should use the trained model, i.e. xgb_regressor_model.predict instead of spark_xgb.predict

from mlforecast.

iamyihwa avatar iamyihwa commented on June 6, 2024

Still getting the same error when I do ..
transformed_test_spark_dataframe = xgb_regressor_model.predict(test_spark_dataframe)
AttributeError: 'SparkXGBRegressorModel' object has no attribute 'predict'

from mlforecast.

jmoralez avatar jmoralez commented on June 6, 2024

Hmm, if it's an MLlib estimator it may be called transform instead of predict. Can you try that? If it works I think you should open an issue in XGBoost so that they update the documentation.

from mlforecast.

trivialfis avatar trivialfis commented on June 6, 2024

Hmm, if it's an MLlib estimator it may be called transform instead of predict. Can you try that? If it works I think you should open an issue in XGBoost so that they update the documentation.

Yes, the spark interface uses the name transform instead of predict to align with sparkml. Did you find the document being inconsistent in XGBoost?

Hey. I'm not sure if there's a guarantee that the local and distributed models will be the same

No, the training results are expected to differ. However, given a trained model, predictions are expected to be the same.

from mlforecast.

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.