SoftObservation: Recording the prediction weights to analyze observation-level...

Description Usage Arguments Details Value Examples

Description

SoftObservation runs the depth given of a single SDT of a single response focusing on a single (or a few) observations in order to make inference from the Prediction Weights found.

Usage

1
2
SoftObservation(response, responselabel = "No Variable Label", train,
  depth, keep = TRUE, observation, export = FALSE, path = NA)

Arguments

response

A vector of responses 0 and 1 for a single classification for the training set with length equal to the number of observations in the training set and width 1.

responselabel

A character string of the title of the response variable used.

train

A matrix or data frame consisting of the entire dataset to train.

depth

A numeric of the number of the depth each SDT should be. Here this ends with 2^{depth - 1} terminal nodes.

keep

A logical passed to the internal functions to keep the prediction and weights (TRUE) or discard the weights and keep only prediction (FALSE).

observation

A numeric or vector containing observations of interest to keep the fitted prediction probability and weights.

export

A logical indicating if results should be printed directly (FALSE) or exported to csv (TRUE).

path

A directory location to save the exported csv file. Must be provided if export = TRUE.

Details

SoftObservation runs the internal SoftForestPredDepth functions so that a single SDT's weights can be recorded. This can then be exported to any tree visual representation to see how the observation(s) of interest pass through the SDT This follows from the other user interface function SoftClassForest where the test set is the observation of interest instead of being used for testing misclassification. Exporting these weights for visual representation is possible and recommended.

Value

A list of possible elements

Prediction

A vector of fitted probabilities for the given classification and observation(s).

AllFeatures

A numeric list of Features chosen at each node where the number represents the column number in the data.

AllWeights

A matrix of weights where the rows represent the observations and columns represent the weights used at different stages.

SoftObservationDataOutput.csv

If export = TRUE, this csv file can be used with an Excel supplement to create visual displays of a single observation for a single response.

Examples

1
2
3
Responses = SoftClassMatrix(as.vector(iris$Species))
SoftObservation(response = Responses[,1], responselabel = "setosa", train = iris[,1:4], 
depth = 2, keep = TRUE, observation = 34, export = TRUE, path = tempdir())

SoftRandomForest documentation built on May 15, 2019, 5:05 p.m.