java.lang.Object
es.upm.fi.cig.multictbnc.sampling.DataSampler
Implements methods for the generation and writing of datasets sampled from Multi-CTBNCs.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
generateDataset
(MultiCTBNC<CPTNode, CIMNode> multiCTBNC, int numSequences, double durationSequences, boolean isNoiseAdded, String destinationPath) Sample a dataset from the provided model.static void
generateDataset
(MultiCTBNC<CPTNode, CIMNode> multiCTBNC, int numSequences, double durationSequences, double percentageNoisyStates, double stdDeviationGaussianNoiseWaitingTime, String destinationPath) Sample a dataset from the provided model.protected static MultiCTBNC<CPTNode,
CIMNode> generateModel
(int numFeatureVariables, int numClassVariables, int cardinalityFeatureVariables, int cardinalityClassVariables, double probabilityEdgeClassSubgraph, double probabilityEdgeBridgeSubgraph, double probabilityEdgeFeatureSubgraph, int minIntensity, int maxIntensity, int maxNumParentsFeature, boolean differentStructurePerDataset, boolean forceExtremeProb, boolean[][] adjMatrix) Generates a Multi-CTBNC that can be used to sample data.static void
generateRandomCIM
(CIMNode node, double minIntensity, double maxIntensity) Generate a uniformly distributed random conditional intensity matrix for a node of a continuous-time Bayesian network.static void
generateRandomCIMs
(CTBN<CIMNode> ctbn, double minIntensity, double maxIntensity) Generate uniformly distributed random conditional intensity matrices for a continuous-time Bayesian network.static void
generateRandomCPT
(CPTNode node, boolean forceExtremeProb) Generate an uniformly distributed random conditional probability table for a Bayesian network node.static void
generateRandomCPTs
(BN<CPTNode> bn, boolean forceExtremeProb) Generate uniformly distributed random conditional probability tables for a Bayesian network.
-
Constructor Details
-
DataSampler
public DataSampler()
-
-
Method Details
-
generateDataset
public static void generateDataset(MultiCTBNC<CPTNode, CIMNode> multiCTBNC, int numSequences, double durationSequences, boolean isNoiseAdded, String destinationPath) Sample a dataset from the provided model.- Parameters:
multiCTBNC
- model from which datasets are samplednumSequences
- number of sequences of the datasetdurationSequences
- duration of the sequencesisNoiseAdded
-True
if noise is added to the datasets,False
otherwisedestinationPath
- path where the dataset is saved
-
generateDataset
public static void generateDataset(MultiCTBNC<CPTNode, CIMNode> multiCTBNC, int numSequences, double durationSequences, double percentageNoisyStates, double stdDeviationGaussianNoiseWaitingTime, String destinationPath) Sample a dataset from the provided model.- Parameters:
multiCTBNC
- model from which datasets are samplednumSequences
- number of sequences of the datasetdurationSequences
- duration of the sequencespercentageNoisyStates
- percentage of class variables' states and state transitions of feature variables which are randomly sampled.stdDeviationGaussianNoiseWaitingTime
- standard deviation of the Gaussian distribution used to sample noise to be added to the waiting times of feature variables in a certain statedestinationPath
- path where the dataset is saved
-
generateRandomCIM
Generate a uniformly distributed random conditional intensity matrix for a node of a continuous-time Bayesian network.- Parameters:
node
- node of a continuous-time Bayesian networkminIntensity
- minimum value of the intensitiesmaxIntensity
- maximum value of the intensities
-
generateModel
protected static MultiCTBNC<CPTNode,CIMNode> generateModel(int numFeatureVariables, int numClassVariables, int cardinalityFeatureVariables, int cardinalityClassVariables, double probabilityEdgeClassSubgraph, double probabilityEdgeBridgeSubgraph, double probabilityEdgeFeatureSubgraph, int minIntensity, int maxIntensity, int maxNumParentsFeature, boolean differentStructurePerDataset, boolean forceExtremeProb, boolean[][] adjMatrix) Generates a Multi-CTBNC that can be used to sample data.- Parameters:
numFeatureVariables
- number of feature variablesnumClassVariables
- number of class variablescardinalityFeatureVariables
- cardinalities of the feature variablescardinalityClassVariables
- cardinalities of the class variablesprobabilityEdgeClassSubgraph
- probability of adding an edge in the class subgraphprobabilityEdgeBridgeSubgraph
- probability of adding an edge in the bridge subgraphprobabilityEdgeFeatureSubgraph
- probability of adding an edge in the feature subgraphminIntensity
- minimum intensitymaxIntensity
- maximum intensitymaxNumParentsFeature
- maximum number of feature variables that can be parents of another feature variabledifferentStructurePerDataset
-true
to used the structure defined for a previous model,false
otherwise.forceExtremeProb
-true
to force the probabilities of the CPTs to be extreme (0 to 0.3 or 0.7 to 1),false
otherwiseadjMatrix
- adjacency matrix used to define the structure of the model (null to define the structure randomly)- Returns:
- Multi-CTBNC generated
-
generateRandomCPTs
Generate uniformly distributed random conditional probability tables for a Bayesian network.- Parameters:
bn
- a Bayesian networkforceExtremeProb
- true to force the probabilities to be extreme (0 to 0.3 or 0.7 to 1) if the size of the sample space of the class variables is 2, false otherwise
-
generateRandomCIMs
Generate uniformly distributed random conditional intensity matrices for a continuous-time Bayesian network.- Parameters:
ctbn
- continuous-time Bayesian networkminIntensity
- minimum value of the intensitiesmaxIntensity
- maximum value of the intensities
-
generateRandomCPT
Generate an uniformly distributed random conditional probability table for a Bayesian network node.- Parameters:
node
- nodeforceExtremeProb
- true to force the probabilities to be extreme (0 to 0.3 or 0.7 to 1) if the size of the sample space of the class variables is 2, false otherwise
-