Package gov.nih.mipav.model.algorithms
Class StochasticForests.Forest
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.StochasticForests.Forest
-
- Direct Known Subclasses:
StochasticForests.ForestClassification
,StochasticForests.ForestProbability
,StochasticForests.ForestRegression
,StochasticForests.ForestSurvival
- Enclosing class:
- StochasticForests
private abstract class StochasticForests.Forest extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
StochasticForests.Forest.computeTreePermutationImportanceInThread
class
StochasticForests.Forest.growTreesInThread
class
StochasticForests.Forest.predictInternalInThread
class
StochasticForests.Forest.predictTreesInThread
class
StochasticForests.Forest.showProgress
-
Field Summary
Fields Modifier and Type Field Description protected double
alpha
protected java.util.Vector<java.lang.Double>
case_weights
private java.util.concurrent.locks.Condition
condition_variable
protected StochasticForests.Data
data
protected int
dependent_varID
protected java.util.Vector<java.lang.Integer>
deterministic_varIDs
protected boolean
holdout
protected StochasticForests.ImportanceMode
importance_mode
protected boolean
keep_inbag
protected StochasticForests.MemoryMode
memory_mode
protected boolean
memory_saving_splitting
protected int
min_node_size
protected double
minprop
protected int
mtry
protected java.util.concurrent.locks.Lock
mutex
protected int
num_independent_variables
protected int
num_random_splits
protected int
num_samples
protected int
num_threads
protected int
num_trees
protected int
num_variables
protected java.lang.String
output_prefix
protected double
overall_prediction_error
protected boolean
predict_all
protected boolean
prediction_mode
protected StochasticForests.PredictionType
prediction_type
protected java.util.Vector<java.util.Vector<java.util.Vector<java.lang.Double>>>
predictions
protected int
progress
protected java.util.Random
random
protected java.util.Vector<java.lang.Double>
sample_fraction
protected boolean
sample_with_replacement
protected long
seed
protected java.util.Vector<java.lang.Integer>
split_select_varIDs
protected java.util.Vector<java.util.Vector<java.lang.Double>>
split_select_weights
protected StochasticForests.SplitRule
splitrule
protected java.util.Vector<java.lang.Integer>
thread_ranges
protected java.util.Vector<StochasticForests.Tree>
trees
protected java.util.Vector<java.lang.Double>
variable_importance
protected boolean
verbose_out
-
Constructor Summary
Constructors Constructor Description Forest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
allocatePredictMemory()
void
computePermutationImportance()
void
computePredictionError()
protected abstract void
computePredictionErrorInternal()
void
dispose()
java.util.Vector<java.util.Vector<java.util.Vector<java.lang.Integer>>>
getChildNodeIDs()
int
getDependentVarId()
java.util.Vector<java.util.Vector<java.lang.Integer>>
getInbagCounts()
java.util.Vector<java.lang.Boolean>
getIsOrderedVariable()
int
getMinNodeSize()
int
getMtry()
int
getNumIndependentVariables()
int
getNumTrees()
double
getOverallPredictionError()
java.util.Vector<java.util.Vector<java.util.Vector<java.lang.Double>>>
getPredictions()
java.util.Vector<java.util.Vector<java.lang.Double>>
getSplitValues()
java.util.Vector<java.util.Vector<java.lang.Integer>>
getSplitVarIDs()
java.util.Vector<java.lang.Double>
getVariableImportance()
void
grow()
protected abstract void
growInternal()
void
init(java.lang.String dependent_variable_name, StochasticForests.MemoryMode memory_mode, StochasticForests.Data input_data, int mtry, java.lang.String output_prefix, int num_trees, long seed, int num_threads, StochasticForests.ImportanceMode importance_mode, int min_node_size, java.lang.String status_variable_name, boolean prediction_mode, boolean sample_with_replacement, java.util.Vector<java.lang.String> unordered_variable_names, boolean memory_saving_splitting, StochasticForests.SplitRule splitrule, boolean predict_all, java.util.Vector<java.lang.Double> sample_fraction, double alpha, double minprop, boolean holdout, StochasticForests.PredictionType prediction_type, int num_random_splits)
void
initCpp(java.lang.String dependent_variable_name, StochasticForests.MemoryMode memory_mode, java.lang.String input_file, int mtry, java.lang.String output_prefix, int num_trees, boolean verbose_out, long seed, int num_threads, java.lang.String load_forest_filename, StochasticForests.ImportanceMode importance_mode, int min_node_size, java.lang.String split_select_weights_file, java.util.Vector<java.lang.String> always_split_variable_names, java.lang.String status_variable_name, boolean sample_with_replacement, java.util.Vector<java.lang.String> unordered_variable_names, boolean memory_saving_splitting, StochasticForests.SplitRule splitrule, java.lang.String case_weights_file, boolean predict_all, double sample_fraction, double alpha, double minprop, boolean holdout, StochasticForests.PredictionType prediction_type, int num_random_splits)
abstract void
initInternal(java.lang.String status_variable_name)
void
initR(java.lang.String dependent_variable_name, StochasticForests.Data input_data, int mtry, int num_trees, boolean verbose_out, long seed, int num_threads, StochasticForests.ImportanceMode importance_mode, int min_node_size, java.util.Vector<java.util.Vector<java.lang.Double>> split_select_weights, java.util.Vector<java.lang.String> always_split_variable_names, java.lang.String status_variable_name, boolean prediction_mode, boolean sample_with_replacement, java.util.Vector<java.lang.String> unordered_variable_names, boolean memory_saving_splitting, StochasticForests.SplitRule splitrule, java.util.Vector<java.lang.Double> case_weights, boolean predict_all, boolean keep_inbag, java.util.Vector<java.lang.Double> sample_fraction, double alpha, double minprop, boolean holdout, StochasticForests.PredictionType prediction_type, int num_random_splits)
void
loadFromFile(java.lang.String filename)
protected abstract void
loadFromFileInternal(java.io.BufferedReader br)
void
predict()
protected abstract void
predictInternal(int sample_idx)
void
run(boolean verbose)
void
saveToFile()
abstract void
saveToFileInternal(java.io.BufferedWriter bw)
void
setAlwaysSplitVariables(java.util.Vector<java.lang.String> always_split_variable_names)
void
setSplitWeightVector(java.util.Vector<java.util.Vector<java.lang.Double>> split_select_weights)
abstract void
writeConfusionFile()
void
writeImportanceFile()
void
writeOutput()
abstract void
writeOutputInternal()
abstract void
writePredictionFile()
-
-
-
Field Detail
-
random
protected java.util.Random random
-
verbose_out
protected boolean verbose_out
-
num_trees
protected int num_trees
-
mtry
protected int mtry
-
min_node_size
protected int min_node_size
-
num_variables
protected int num_variables
-
num_independent_variables
protected int num_independent_variables
-
seed
protected long seed
-
dependent_varID
protected int dependent_varID
-
num_samples
protected int num_samples
-
prediction_mode
protected boolean prediction_mode
-
memory_mode
protected StochasticForests.MemoryMode memory_mode
-
sample_with_replacement
protected boolean sample_with_replacement
-
memory_saving_splitting
protected boolean memory_saving_splitting
-
splitrule
protected StochasticForests.SplitRule splitrule
-
predict_all
protected boolean predict_all
-
keep_inbag
protected boolean keep_inbag
-
sample_fraction
protected java.util.Vector<java.lang.Double> sample_fraction
-
holdout
protected boolean holdout
-
prediction_type
protected StochasticForests.PredictionType prediction_type
-
num_random_splits
protected int num_random_splits
-
alpha
protected double alpha
-
minprop
protected double minprop
-
num_threads
protected int num_threads
-
thread_ranges
protected java.util.Vector<java.lang.Integer> thread_ranges
-
trees
protected java.util.Vector<StochasticForests.Tree> trees
-
data
protected StochasticForests.Data data
-
predictions
protected java.util.Vector<java.util.Vector<java.util.Vector<java.lang.Double>>> predictions
-
overall_prediction_error
protected double overall_prediction_error
-
deterministic_varIDs
protected java.util.Vector<java.lang.Integer> deterministic_varIDs
-
split_select_varIDs
protected java.util.Vector<java.lang.Integer> split_select_varIDs
-
split_select_weights
protected java.util.Vector<java.util.Vector<java.lang.Double>> split_select_weights
-
case_weights
protected java.util.Vector<java.lang.Double> case_weights
-
output_prefix
protected java.lang.String output_prefix
-
importance_mode
protected StochasticForests.ImportanceMode importance_mode
-
variable_importance
protected java.util.Vector<java.lang.Double> variable_importance
-
progress
protected int progress
-
mutex
protected final java.util.concurrent.locks.Lock mutex
-
condition_variable
private final java.util.concurrent.locks.Condition condition_variable
-
-
Method Detail
-
growInternal
protected abstract void growInternal()
-
allocatePredictMemory
protected abstract void allocatePredictMemory()
-
predictInternal
protected abstract void predictInternal(int sample_idx)
-
computePredictionErrorInternal
protected abstract void computePredictionErrorInternal()
-
loadFromFileInternal
protected abstract void loadFromFileInternal(java.io.BufferedReader br)
-
initInternal
public abstract void initInternal(java.lang.String status_variable_name)
-
writeOutputInternal
public abstract void writeOutputInternal()
-
writeConfusionFile
public abstract void writeConfusionFile()
-
writePredictionFile
public abstract void writePredictionFile()
-
saveToFileInternal
public abstract void saveToFileInternal(java.io.BufferedWriter bw)
-
getChildNodeIDs
public java.util.Vector<java.util.Vector<java.util.Vector<java.lang.Integer>>> getChildNodeIDs()
-
getSplitVarIDs
public java.util.Vector<java.util.Vector<java.lang.Integer>> getSplitVarIDs()
-
getSplitValues
public java.util.Vector<java.util.Vector<java.lang.Double>> getSplitValues()
-
getVariableImportance
public java.util.Vector<java.lang.Double> getVariableImportance()
-
getOverallPredictionError
public double getOverallPredictionError()
-
getPredictions
public java.util.Vector<java.util.Vector<java.util.Vector<java.lang.Double>>> getPredictions()
-
getDependentVarId
public int getDependentVarId()
-
getNumTrees
public int getNumTrees()
-
getMtry
public int getMtry()
-
getMinNodeSize
public int getMinNodeSize()
-
getNumIndependentVariables
public int getNumIndependentVariables()
-
getIsOrderedVariable
public java.util.Vector<java.lang.Boolean> getIsOrderedVariable()
-
getInbagCounts
public java.util.Vector<java.util.Vector<java.lang.Integer>> getInbagCounts()
-
dispose
public void dispose()
-
initCpp
public void initCpp(java.lang.String dependent_variable_name, StochasticForests.MemoryMode memory_mode, java.lang.String input_file, int mtry, java.lang.String output_prefix, int num_trees, boolean verbose_out, long seed, int num_threads, java.lang.String load_forest_filename, StochasticForests.ImportanceMode importance_mode, int min_node_size, java.lang.String split_select_weights_file, java.util.Vector<java.lang.String> always_split_variable_names, java.lang.String status_variable_name, boolean sample_with_replacement, java.util.Vector<java.lang.String> unordered_variable_names, boolean memory_saving_splitting, StochasticForests.SplitRule splitrule, java.lang.String case_weights_file, boolean predict_all, double sample_fraction, double alpha, double minprop, boolean holdout, StochasticForests.PredictionType prediction_type, int num_random_splits)
-
initR
public void initR(java.lang.String dependent_variable_name, StochasticForests.Data input_data, int mtry, int num_trees, boolean verbose_out, long seed, int num_threads, StochasticForests.ImportanceMode importance_mode, int min_node_size, java.util.Vector<java.util.Vector<java.lang.Double>> split_select_weights, java.util.Vector<java.lang.String> always_split_variable_names, java.lang.String status_variable_name, boolean prediction_mode, boolean sample_with_replacement, java.util.Vector<java.lang.String> unordered_variable_names, boolean memory_saving_splitting, StochasticForests.SplitRule splitrule, java.util.Vector<java.lang.Double> case_weights, boolean predict_all, boolean keep_inbag, java.util.Vector<java.lang.Double> sample_fraction, double alpha, double minprop, boolean holdout, StochasticForests.PredictionType prediction_type, int num_random_splits)
-
init
public void init(java.lang.String dependent_variable_name, StochasticForests.MemoryMode memory_mode, StochasticForests.Data input_data, int mtry, java.lang.String output_prefix, int num_trees, long seed, int num_threads, StochasticForests.ImportanceMode importance_mode, int min_node_size, java.lang.String status_variable_name, boolean prediction_mode, boolean sample_with_replacement, java.util.Vector<java.lang.String> unordered_variable_names, boolean memory_saving_splitting, StochasticForests.SplitRule splitrule, boolean predict_all, java.util.Vector<java.lang.Double> sample_fraction, double alpha, double minprop, boolean holdout, StochasticForests.PredictionType prediction_type, int num_random_splits)
-
run
public void run(boolean verbose)
-
writeOutput
public void writeOutput()
-
writeImportanceFile
public void writeImportanceFile()
-
saveToFile
public void saveToFile()
-
grow
public void grow()
-
predict
public void predict()
-
computePredictionError
public void computePredictionError()
-
computePermutationImportance
public void computePermutationImportance()
-
loadFromFile
public void loadFromFile(java.lang.String filename)
-
setSplitWeightVector
public void setSplitWeightVector(java.util.Vector<java.util.Vector<java.lang.Double>> split_select_weights)
-
setAlwaysSplitVariables
public void setAlwaysSplitVariables(java.util.Vector<java.lang.String> always_split_variable_names)
-
-