Skip to main content

univariate model's Interpretation Techniques - also for classificating features and predictions

Project description

Prediction Interpreter

This package contains a wrapper to interpret any predictor. Use this package:

  • to interpret a machine learning model that runs over a service
  • to interpret a trained ML- model in python, that has insufficient features for interpretation
  • to interpret a trained ML- model in python, using the methods already set up for you
  • to get ideas about how to use the interpretation methods

By using established interpretation- techniques, the package only needs a function that takes a dataset and returns a prediction, as well as some information about the data and columns. The package then automatically sets up a wrapper containing the important information and configurations to run interpretations.

To set up the predictor, state the necessary information as in file StartPredictionInterpreter given: Here, we use a DummyML-Model that predicts the amount of visitors on a day, depending on whether it is holiday, how much the ticket price is, and what'S the weather like. (For your additional information: There are many visitors if its holiday, or when the price is low. The weather has a random effect on the amount of visitors. But all of this you will see when running the dummy data.)

Additionally to the DummyMLModel, it is necessary to give

  • the testdata as a panda-Dataframe

  • as well as the result column's name

  • all data columns' names

  • the numerical column names (if there are any...)

  • the categories in result column (classes_)

  • rather the result is a continuous value

    #get data and object that has singlepredict in correct format dm = DummyMLModel() data = dm.testdata

    #define necessary variables for techniques standardColumns = data.columns.to_list() resultcolumn = "visitorsOnThisDay" listOfNumericalColumns = ["ticketPrice"] classes = data[resultcolumn].unique().tolist() resultIsContinuous = False

After that, create the the interpreter with the before defined parameters, and run the interpretation techniques that are of interest for you.

#create interpreter 
predictionInterpreter = PredictionInterpreterClass(dm.predict, listOfNumericalColumns, standardColumns, resultcolumn, _classes_, data, resultIsContinuous)

#call interpretation technique  s you want to use:
predictionInterpreter.plotpdpOfDistanceToTrueResultSklearn() # only works if called without any prior methods
predictionInterpreter.plotpdpOfDistanceToTrueResultSklearn2D()
predictionInterpreter.writeDistribution("visitorsOnThisDay")
predictionInterpreter.plotConfusionTable()
predictionInterpreter.printImportanceEli5(exceptedColumns = resultcolumn)
predictionInterpreter.printImportanceEli5(distanceAnalysis=True)
predictionInterpreter.featureAnnulation(annulationValue = "0")
predictionInterpreter.plotIce()
predictionInterpreter.plotpdpOfDistanceToTrueResultPdpbox(featureToExamine="ticketPrice")
predictionInterpreter.plotpdpOfDistanceToTrueResultPdpbox(featuresToExamine=["holidayYN", "ticketPrice"])
predictionInterpreter.plotpdpOfDistanceToTrueResultPdpbox(featureToExamine="ticketPrice", featuresToExamine=["holidayYN", "ticketPrice"])
predictionInterpreter.globalSurrogateModel()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PredictionInterpreter-0.0.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PredictionInterpreter-0.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file PredictionInterpreter-0.0.1.tar.gz.

File metadata

  • Download URL: PredictionInterpreter-0.0.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for PredictionInterpreter-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ac2d70357e767e0136a1a1e97b7f5a17e7dab8ca77b80102cf555fe06760e105
MD5 4433fb78c0d7807f254bceef15b85bae
BLAKE2b-256 f2bc469e26cf3df6a6bd8091173755c24958723bb85fc803fd0e5173033c7a5c

See more details on using hashes here.

File details

Details for the file PredictionInterpreter-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: PredictionInterpreter-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for PredictionInterpreter-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9dfcb2df853b39b837fefedb25b0b2a1dd8c88849010af7ac44696213f0a5da
MD5 638379f18c14bed014c8e7a10dc85a5b
BLAKE2b-256 e393fba6be9476a6f54ee4141750248c39438a1eb320888d5c4eb593c2e597d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page