8000 GitHub - alvinhenrick/spark_model_explainer · GitHub
[go: up one dir, main page]

Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

40 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spark Model Explainer

This is the library we use and have developed to interperate the Generalized Linear Models and Random Forest. Currently, the support is for Spark ML GLM and Random Forest.

Prerequisite

JAVA Version 8
SBT Version 1.2.8
SCALA Version 2.11.12
SPARK Version 2.4.4
XGBOOST Version 1.0.0

Below are the steps to use this library.

  1. Download the project and build the jar.
   sbt clean assembly
  1. How to invoke GLM Explainer
    import com.clarifyhealth.prediction.explainer.GLMExplainTransformer
    val explainTransformer = new GLMExplainTransformer()
    explainTransformer.setCoefficientView("my_coefficients")
    explainTransformer.setPredictionView("my_predictions")
    explainTransformer.setFamily("tweedie")
    explainTransformer.setLinkPower(0.5)
    explainTransformer.setVariancePower(1.0)
    explainTransformer.setNested(true)
    explainTransformer.setCalculateSum(true)
    explainTransformer.setLabel("test")

    val df = spark.emptyDataFrame
    val resultDF = explainTransformer.transform(df)
  1. How to invoke RF Explainer
    import com.clarifyhealth.prediction.explainer.EnsembleTreeExplainTransformer
    val explainTransformer = new EnsembleTreeExplainTransformer()
    explainTransformer.setFeatureImportanceView("my_feature_importance")
    explainTransformer.setPredictionView("my_predictions")
    explainTransformer.setLabel("label")
    explainTransformer.setModelPath(rf_model_path)
    explainTransformer.setDropPathColumn(false)
    val df = spark.emptyDataFrame
    val resultDF = explainTransformer.transform(df)

The Python spark wrapper and scikit-learn library is here: https://github.com/imanbio/transparency

Pyspark Example Notebooks

Authors

License

Apache License Version 2.0

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0