├── ByEdisonGuo ├── PGM-Programming_Assignment_1 │ ├── .DS_Store │ ├── AssignmentToIndex.m │ ├── ComputeJointDistribution.m │ ├── ComputeMarginal.m │ ├── ConvertNetwork.m │ ├── CreditWorthinessCheck.m │ ├── Credit_net.net │ ├── FactorMarginalization.m │ ├── FactorProduct.m │ ├── FactorTutorial.m │ ├── GetValueOfAssignment.m │ ├── IndexToAssignment.m │ ├── ObserveEvidence.m │ ├── PGM_Programming_Assignment_1.pdf │ ├── SetValueOfAssignment.m │ ├── StandardizeFactors.m │ ├── submit.m │ ├── submitWeb.m │ └── submit_input.mat ├── PGM-Programming_Assignment_4 │ ├── AssignmentToIndex.m │ ├── CliqueTreeCalibrate.m │ ├── ComputeExactMarginalsBP.m │ ├── ComputeInitialPotentials.m │ ├── ComputeJointDistribution.m │ ├── ComputeMarginal.m │ ├── CreateCliqueTree.m │ ├── DecodedMarginalsToChars.m │ ├── EliminateVar.m │ ├── FactorMarginalization.m │ ├── FactorMaxMarginalization.m │ ├── FactorProduct.m │ ├── FactorSum.m │ ├── GetNextCliques.m │ ├── GetValueOfAssignment.m │ ├── IndexToAssignment.m │ ├── MaxDecoding.m │ ├── ObserveEvidence.m │ ├── PA4Sample.mat │ ├── PA4Test.mat │ ├── ProgrammingAssignment4.pdf │ ├── PruneTree.m │ ├── SetValueOfAssignment.m │ ├── StandardizeFactors.m │ ├── Testing.m │ ├── submit.m │ └── submitWeb.m ├── PGM-Programming_Assignment_5 │ ├── .DS_Store │ ├── AssignmentToIndex.m │ ├── BlockLogDistribution.m │ ├── CheckConvergence.m │ ├── ClusterGraphCalibrate.m │ ├── ComputeApproxMarginalsBP.m │ ├── ComputeInitialPotentials.m │ ├── ConstructRandNetwork.m │ ├── ConstructToyNetwork.m │ ├── CreateClusterGraph.m │ ├── EdgeToFactorCorrespondence.m │ ├── ExtractMarginalsFromSamples.m │ ├── FactorMarginalization.m │ ├── FactorProduct.m │ ├── GetNextClusters.m │ ├── GetValueOfAssignment.m │ ├── GibbsTrans.m │ ├── IndexToAssignment.m │ ├── LogProbOfJointAssignment.m │ ├── MCMCInference.m │ ├── MHGibbsTrans.m │ ├── MHSWTrans.m │ ├── MHUniformTrans.m │ ├── NaiveGetNextClusters.m │ ├── ObserveEvidence.m │ ├── ProgrammingAssignment5.pdf │ ├── SetValueOfAssignment.m │ ├── SmartGetNextClusters.m │ ├── TestToy.m │ ├── VariableToFactorCorrespondence.m │ ├── VisualizeMCMCMarginals.m │ ├── VisualizeToyImageMarginals.m │ ├── exampleIOPA5.mat │ ├── gaimc │ │ ├── scomponents.m │ │ └── sparse_to_csr.m │ ├── pgm_login_data.mat │ ├── rand.m │ ├── randi.m │ ├── randsample.m │ ├── smooth.m │ ├── submit.m │ └── submit_input.mat ├── PGM-Programming_Assignment_5_RBP │ ├── AssignmentToIndex.m │ ├── Backup │ │ ├── .DS_Store │ │ ├── BlockLogDistribution.m │ │ ├── CheckConvergence.m │ │ ├── ConstructRandNetwork.m │ │ ├── ConstructToyNetwork.m │ │ ├── EdgeToFactorCorrespondence.m │ │ ├── ExtractMarginalsFromSamples.m │ │ ├── GetValueOfAssignment.m │ │ ├── GibbsTrans.m │ │ ├── LogProbOfJointAssignment.m │ │ ├── MCMCInference.m │ │ ├── MHGibbsTrans.m │ │ ├── MHSWTrans.m │ │ ├── MHUniformTrans.m │ │ ├── NaiveGetNextClusters.m │ │ ├── ProgrammingAssignment5.pdf │ │ ├── SetValueOfAssignment.m │ │ ├── SmartGetNextClusters.m │ │ ├── TestToy.m │ │ ├── VariableToFactorCorrespondence.m │ │ ├── VisualizeMCMCMarginals.m │ │ ├── VisualizeToyImageMarginals.m │ │ ├── gaimc │ │ │ ├── scomponents.m │ │ │ └── sparse_to_csr.m │ │ ├── rand.m │ │ ├── randi.m │ │ ├── randsample.m │ │ └── smooth.m │ ├── ClusterGraphCalibrate.m │ ├── ComputeApproxMarginalsBP.m │ ├── ComputeInitialPotentials.m │ ├── CreateClusterGraph.m │ ├── FactorMarginalization.m │ ├── FactorProduct.m │ ├── GetNextClusters.m │ ├── IndexToAssignment.m │ ├── Loopy BP Results.png │ ├── ObserveEvidence.m │ ├── Residual BP Results.png │ ├── exampleIOPA5.mat │ ├── pgm_login_data.mat │ ├── submit.m │ └── submit_input.mat ├── PGM_Programming_Assignment_3 │ ├── AssignmentToIndex.m │ ├── BuildOCRNetwork.m │ ├── ChooseTopSimilarityFactors.m │ ├── ComputeAllSimilarityFactors.m │ ├── ComputeEqualPairwiseFactors.m │ ├── ComputeImageFactor.m │ ├── ComputePairwiseFactors.m │ ├── ComputeSimilarityFactor.m │ ├── ComputeSingletonFactors.m │ ├── ComputeTripletFactors.m │ ├── ComputeWordPredictions.m │ ├── GetValueOfAssignment.m │ ├── ImageSimilarity.m │ ├── IndexToAssignment.m │ ├── PA3Data.mat │ ├── PA3Description.pdf │ ├── PA3Models.mat │ ├── PA3SampleCases.mat │ ├── PA3TestCases.mat │ ├── Results.png │ ├── RunInference.m │ ├── ScoreModel.m │ ├── ScorePredictions.m │ ├── SerializeFactorsFg.m │ ├── SetValueOfAssignment.m │ ├── VisualizeWord.m │ ├── factors.fg │ ├── inf.log │ ├── inference │ │ ├── doinference-linux │ │ ├── doinference-mac │ │ ├── doinference.exe │ │ ├── inf.log │ │ └── inference-src.zip │ ├── submit.m │ └── submitWeb.m └── PGM_Programming_Assignment_7 │ ├── AssignmentToIndex.m │ ├── CRFPredict.m │ ├── CRFTest.m │ ├── CRFTrain.m │ ├── CliqueTreeCalibrate.asv │ ├── CliqueTreeCalibrate.m │ ├── ComputeConditionedSingletonFeatures.m │ ├── ComputeExactMarginalsBP.m │ ├── ComputeInitialPotentials.m │ ├── ComputeJointDistribution.m │ ├── ComputeMarginal.m │ ├── ComputeMarginals.m │ ├── ComputePredictionAccuracy.m │ ├── ComputeUnconditionedPairFeatures.m │ ├── ComputeUnconditionedSingletonFeatures.m │ ├── ConstructCliqueTree.m │ ├── CreateCliqueTree.m │ ├── EliminateVar.m │ ├── EmptyFactorStruct.m │ ├── EmptyFeatureStruct.m │ ├── FactorMarginalization.m │ ├── FactorMaxMarginalization.m │ ├── FactorProduct.m │ ├── FactorSum.m │ ├── GenerateAllFeatures.m │ ├── GetNextCliques.m │ ├── GetValueOfAssignment.m │ ├── IndexToAssignment.m │ ├── InstanceNegLogLikelihood.asv │ ├── InstanceNegLogLikelihood.m │ ├── LRAccuracy.m │ ├── LRCostSGD.m │ ├── LRPredict.m │ ├── LRSearchLambdaSGD.m │ ├── LRTrainSGD.m │ ├── MaxDecoding.m │ ├── NumParamsForConditionedFeatures.m │ ├── NumParamsForUnconditionedFeatures.m │ ├── ObserveEvidence.m │ ├── PA7Description.pdf │ ├── Part1Lambdas.mat │ ├── Part2FullDataset.mat │ ├── Part2LogZTest.mat │ ├── Part2Sample.mat │ ├── Part2Test.mat │ ├── PruneTree.m │ ├── SetValueOfAssignment.m │ ├── StochasticGradientDescent.m │ ├── Test1X.mat │ ├── Test1Y.mat │ ├── Train1X.mat │ ├── Train1Y.mat │ ├── Train2X.mat │ ├── Train2Y.mat │ ├── Validation1X.mat │ ├── Validation1Y.mat │ ├── Validation2X.mat │ ├── Validation2Y.mat │ ├── ValidationAccuracy.mat │ ├── VisualizeCharacters.m │ ├── pgm_login_data.mat │ ├── sigmoid.m │ ├── submit.m │ └── submitWeb.m ├── ByJimmyLin ├── .DS_Store ├── PGM-Programming_Assignment_1 │ ├── .DS_Store │ ├── .FactorTutorial.m.swp │ ├── 228_login_data.mat │ ├── AssignmentToIndex.m │ ├── ComputeJointDistribution.m │ ├── ComputeMarginal.m │ ├── ConvertNetwork.m │ ├── Credit_net.net │ ├── FactorMarginalization.m │ ├── FactorProduct.m │ ├── FactorTutorial.m │ ├── GetValueOfAssignment.m │ ├── IndexToAssignment.m │ ├── ObserveEvidence.m │ ├── PGM_Programming_Assignment_1.pdf │ ├── SetValueOfAssignment.m │ ├── TestFactorMarginalization.m │ ├── TestFactorProduct.m │ ├── submit.m │ ├── submitWeb.m │ └── submit_input.mat ├── asgn1 │ ├── .DS_Store │ ├── .FactorTutorial.m.swp │ ├── .ObserveEvidence.m.swp │ ├── 228_login_data.mat │ ├── AssignmentToIndex.m │ ├── ComputeJointDistribution.m │ ├── ComputeMarginal.m │ ├── ConvertNetwork.m │ ├── Credit_net.net │ ├── FactorMarginalization.m │ ├── FactorProduct.m │ ├── FactorTutorial.m │ ├── GetValueOfAssignment.m │ ├── IndexToAssignment.m │ ├── ObserveEvidence.m │ ├── PGM_Programming_Assignment_1.pdf │ ├── SetValueOfAssignment.m │ ├── TestFactorMarginalization.m │ ├── TestFactorProduct.m │ ├── TestObserveEvidence.m │ ├── submit.m │ ├── submitWeb.m │ └── submit_input.mat ├── asgn2 │ ├── .DS_Store │ ├── AssignmentToIndex.m │ ├── GetValueOfAssignment.m │ ├── IndexToAssignment.m │ ├── PA2Appendix.pdf │ ├── PA2Description.pdf │ ├── SetValueOfAssignment.m │ ├── childCopyGivenFreqsFactor.m │ ├── childCopyGivenParentalsFactor.m │ ├── computeSigmoid.m │ ├── constructDecoupledGeneticNetwork.m │ ├── constructGeneticNetwork.m │ ├── constructSigmoidPhenotypeFactor.m │ ├── generateAlleleGenotypeMappers.m │ ├── genotypeGivenAlleleFreqsFactor.m │ ├── genotypeGivenParentsGenotypesFactor.m │ ├── phenotypeGivenCopiesFactor.m │ ├── phenotypeGivenGenotypeFactor.m │ ├── phenotypeGivenGenotypeMendelianFactor.m │ ├── sampleFactorList.mat │ ├── sampleFactorListDecoupled.mat │ ├── sampleGeneticNetworks.m │ ├── sendToSamiam.m │ ├── sendToSamiamGeneCopy.m │ ├── sendToSamiamInfo.m │ ├── sendToSamiamInfoDecoupled.m │ ├── spinalMuscularAtrophyBayesNet.net │ ├── submit.m │ └── submitWeb.m ├── asgn3 │ ├── .DS_Store │ ├── AssignmentToIndex.m │ ├── BuildOCRNetwork.m │ ├── ChooseTopSimilarityFactors.m │ ├── ComputeAllSimilarityFactors.m │ ├── ComputeEqualPairwiseFactors.m │ ├── ComputeImageFactor.m │ ├── ComputePairwiseFactors.m │ ├── ComputeSimilarityFactor.m │ ├── ComputeSingletonFactors.m │ ├── ComputeTripletFactors.m │ ├── ComputeWordPredictions.m │ ├── GetValueOfAssignment.m │ ├── ImageSimilarity.m │ ├── IndexToAssignment.m │ ├── PA3Data.mat │ ├── PA3Description.pdf │ ├── PA3Models.mat │ ├── PA3SampleCases.mat │ ├── PA3TestCases.mat │ ├── RunInference.m │ ├── ScoreModel.m │ ├── ScorePredictions.m │ ├── SerializeFactorsFg.m │ ├── SetValueOfAssignment.m │ ├── TestComputeAllSimilarityFactors.m │ ├── TestComputePairwiseFactors.m │ ├── TestComputeSimilarityFactors.m │ ├── TestComputeSingletonFactors.m │ ├── TestComputeTopSimilarityFactors.m │ ├── TestComputeTripletFactors.m │ ├── VisualizeWord.m │ ├── factors.fg │ ├── inf.log │ ├── inference │ │ ├── .DS_Store │ │ ├── doinference-linux │ │ ├── doinference-mac │ │ ├── doinference.exe │ │ └── inference-src.zip │ ├── pgm_login_data.mat │ ├── submit.m │ └── submitWeb.m ├── asgn4 │ ├── .DS_Store │ ├── .MaxDecoding.m.swp │ ├── AssignmentToIndex.m │ ├── CliqueTreeCalibrate.m │ ├── ComputeExactMarginalsBP.m │ ├── ComputeInitialPotentials.m │ ├── ComputeJointDistribution.m │ ├── ComputeMarginal.m │ ├── CreateCliqueTree.m │ ├── DecodedMarginalsToChars.m │ ├── EliminateVar.m │ ├── FactorMarginalization.m │ ├── FactorMaxMarginalization.m │ ├── FactorProduct.m │ ├── FactorSum.m │ ├── GetNextCliques.m │ ├── GetValueOfAssignment.m │ ├── IndexToAssignment.m │ ├── MaxDecoding.m │ ├── ObserveEvidence.m │ ├── PA4Sample.mat │ ├── PA4Test.mat │ ├── ProgrammingAssignment4.pdf │ ├── PruneTree.m │ ├── SetValueOfAssignment.m │ ├── StandardizeFactors.m │ ├── TestCompteInitialPotentials.m │ ├── isMessageEmpty.m │ ├── pgm_login_data.mat │ ├── submit.m │ └── submitWeb.m ├── asgn5 │ ├── .DS_Store │ ├── AssignmentToIndex.m │ ├── BlockLogDistribution.m │ ├── CheckConvergence.m │ ├── ClusterGraphCalibrate.m │ ├── ComputeApproxMarginalsBP.m │ ├── ComputeInitialPotentials.m │ ├── ConstructRandNetwork.m │ ├── ConstructToyNetwork.m │ ├── CreateClusterGraph.m │ ├── EdgeToFactorCorrespondence.m │ ├── ExtractMarginalsFromSamples.m │ ├── FactorMarginalization.m │ ├── FactorProduct.m │ ├── GetNextClusters.m │ ├── GetValueOfAssignment.m │ ├── GibbsTrans.m │ ├── IndexToAssignment.m │ ├── LogProbOfJointAssignment.m │ ├── MCMCInference.m │ ├── MHGibbsTrans.m │ ├── MHSWTrans.m │ ├── MHUniformTrans.m │ ├── NaiveGetNextClusters.m │ ├── ObserveEvidence.m │ ├── ProgrammingAssignment5.pdf │ ├── SetValueOfAssignment.m │ ├── SmartGetNextClusters.m │ ├── TestToy.m │ ├── VariableToFactorCorrespondence.m │ ├── VisualizeMCMCMarginals.m │ ├── VisualizeToyImageMarginals.m │ ├── exampleIOPA5.mat │ ├── gaimc │ │ ├── scomponents.m │ │ └── sparse_to_csr.m │ ├── pgm_login_data.mat │ ├── rand.m │ ├── randi.m │ ├── randsample.m │ ├── smooth.m │ ├── submit.m │ └── submit_input.mat ├── asgn6 │ ├── AssignmentToIndex.m │ ├── CPDFromFactor.m │ ├── CalculateExpectedUtilityFactor.m │ ├── EliminateVar.m │ ├── FactorMarginalization.m │ ├── FactorProduct.m │ ├── FullI.mat │ ├── GetValueOfAssignment.m │ ├── IndexToAssignment.m │ ├── MultipleUtilityI.mat │ ├── NormalizeCPDFactors.m │ ├── NormalizeFactorValues.m │ ├── ObserveEvidence.m │ ├── OptimizeLinearExpectations.m │ ├── OptimizeMEU.m │ ├── OptimizeWithJointUtility.m │ ├── PrintFactor.m │ ├── ProgrammingAssignment6.pdf │ ├── SetValueOfAssignment.m │ ├── SimpleCalcExpectedUtility.m │ ├── SimpleOptimizeMEU.m │ ├── TestCases.m │ ├── TestI0.mat │ ├── VariableElimination.m │ ├── submit.m │ └── submitWeb.m ├── asgn7 │ ├── AssignmentToIndex.m │ ├── CliqueTreeCalibrate.m │ ├── ComputeConditionedSingletonFeatures.m │ ├── ComputeExactMarginalsBP.m │ ├── ComputeInitialPotentials.m │ ├── ComputeJointDistribution.m │ ├── ComputeMarginal.m │ ├── ComputeUnconditionedPairFeatures.m │ ├── ComputeUnconditionedSingletonFeatures.m │ ├── CreateCliqueTree.m │ ├── EliminateVar.m │ ├── EmptyFactorStruct.m │ ├── EmptyFeatureStruct.m │ ├── FactorMarginalization.m │ ├── FactorMaxMarginalization.m │ ├── FactorProduct.m │ ├── FactorSum.m │ ├── GenerateAllFeatures.m │ ├── GetNextCliques.m │ ├── GetValueOfAssignment.m │ ├── IndexToAssignment.m │ ├── InstanceNegLogLikelihood.m │ ├── LRAccuracy.m │ ├── LRCostSGD.m │ ├── LRPredict.m │ ├── LRSearchLambdaSGD.m │ ├── LRTrainSGD.m │ ├── MaxDecoding.m │ ├── NumParamsForConditionedFeatures.m │ ├── NumParamsForUnconditionedFeatures.m │ ├── ObserveEvidence.m │ ├── PA7Description.pdf │ ├── Part1Lambdas.mat │ ├── Part2FullDataset.mat │ ├── Part2LogZTest.mat │ ├── Part2Sample.mat │ ├── Part2Test.mat │ ├── PruneTree.m │ ├── SetValueOfAssignment.m │ ├── StochasticGradientDescent.m │ ├── Test1X.mat │ ├── Test1Y.mat │ ├── Train1X.mat │ ├── Train1Y.mat │ ├── Train2X.mat │ ├── Train2Y.mat │ ├── Validation1X.mat │ ├── Validation1Y.mat │ ├── Validation2X.mat │ ├── Validation2Y.mat │ ├── ValidationAccuracy.mat │ ├── VisualizeCharacters.m │ ├── sigmoid.m │ ├── submit.m │ └── submitWeb.m └── samiam │ ├── .DS_Store │ ├── .suppress_calljvmti │ ├── Readme for SamIam Release 3.0 Mac OS X i386.pdf │ ├── htmlhelp │ ├── .DS_Store │ ├── assertingevidence.html │ ├── codebandit.html │ ├── data.js │ ├── editingconditionalprobabilities.html │ ├── editingnetworkstructure.html │ ├── em.html │ ├── images │ │ ├── background_01.gif │ │ ├── background_02.gif │ │ ├── buttons_00.gif │ │ ├── buttons_01.gif │ │ ├── buttons_02.gif │ │ ├── buttons_03.gif │ │ ├── buttons_04.gif │ │ ├── buttons_05.gif │ │ ├── buttons_06.gif │ │ ├── buttons_07.gif │ │ ├── buttons_08.gif │ │ ├── buttons_09.gif │ │ ├── buttons_10.gif │ │ ├── buttons_11.gif │ │ ├── buttons_12.gif │ │ ├── buttons_13.gif │ │ ├── buttons_14.gif │ │ ├── buttons_codebandit_01.gif │ │ └── samiamhelp.gif │ ├── index.html │ ├── map.html │ ├── menu.html │ ├── modes.html │ ├── monitors.html │ ├── mpe.html │ ├── preferences.html │ ├── recursiveconditioning.html │ ├── search.js │ ├── selectingnodes.html │ ├── sensitivityanalysis.html │ ├── shots │ │ ├── ae1.png │ │ ├── ae1.thumb.png │ │ ├── codebandit1.png │ │ ├── codebandit1.thumb.png │ │ ├── ecp1.png │ │ ├── ecp1.thumb.png │ │ ├── ecp2.png │ │ ├── ecp2.thumb.png │ │ ├── em1.png │ │ ├── em1.thumb.png │ │ ├── ens1.png │ │ ├── ens1.thumb.png │ │ ├── ens2.png │ │ ├── ens2.thumb.png │ │ ├── ens3.png │ │ ├── ens3.thumb.png │ │ ├── ens4.png │ │ ├── ens4.thumb.png │ │ ├── ens5.png │ │ ├── ens5.thumb.png │ │ ├── ens6.png │ │ ├── ens6.thumb.png │ │ ├── ens7.png │ │ ├── ens7.thumb.png │ │ ├── ens8.png │ │ ├── ens8.thumb.png │ │ ├── map1.png │ │ ├── map1.thumb.png │ │ ├── map2.png │ │ ├── map2.thumb.png │ │ ├── modes1.png │ │ ├── modes1.thumb.png │ │ ├── modes2.png │ │ ├── modes2.thumb.png │ │ ├── monitors1.png │ │ ├── monitors1.thumb.png │ │ ├── monitors2.png │ │ ├── monitors2.thumb.png │ │ ├── mpe1.png │ │ ├── mpe1.thumb.png │ │ ├── mpe2.png │ │ ├── mpe2.thumb.png │ │ ├── pref1.png │ │ ├── pref1.thumb.png │ │ ├── pref2.png │ │ ├── pref2.thumb.png │ │ ├── rc1.png │ │ ├── rc1.thumb.png │ │ ├── rc2.png │ │ ├── rc2.thumb.png │ │ ├── sa1.png │ │ ├── sa1.thumb.png │ │ ├── sa2.png │ │ ├── sa2.thumb.png │ │ ├── sa3.png │ │ ├── sa3.thumb.png │ │ ├── sa4.png │ │ ├── sa4.thumb.png │ │ ├── sn1.png │ │ ├── sn1.thumb.png │ │ ├── wwf1.png │ │ └── wwf1.thumb.png │ ├── top.html │ ├── topics.css │ ├── tutorials.html │ ├── tutorials │ │ └── showtutorial.bat │ └── workingwithfiles.html │ ├── inflib.jar │ ├── libcalljvmti.jnilib │ ├── libcallsmile.jnilib │ ├── library_javadocs │ ├── .DS_Store │ ├── allclasses-frame.html │ ├── allclasses-noframe.html │ ├── constant-values.html │ ├── deprecated-list.html │ ├── edu │ │ └── ucla │ │ │ ├── belief │ │ │ ├── AbstractInferenceEngine.html │ │ │ ├── BeliefNetwork.Auditor.Deed.html │ │ │ ├── BeliefNetwork.Auditor.Intention.html │ │ │ ├── BeliefNetwork.Auditor.Unit.html │ │ │ ├── BeliefNetwork.Auditor.html │ │ │ ├── BeliefNetwork.html │ │ │ ├── BeliefNetworkImpl.html │ │ │ ├── BeliefNetworks.html │ │ │ ├── CPTParameter.html │ │ │ ├── CPTShell.html │ │ │ ├── Copier.html │ │ │ ├── CrouchingTiger.DynamatorImpl.html │ │ │ ├── CrouchingTiger.html │ │ │ ├── DecisionShell.html │ │ │ ├── Definitions.html │ │ │ ├── DynaListener.html │ │ │ ├── Dynamator.Commitable.html │ │ │ ├── Dynamator.Decorator.html │ │ │ ├── Dynamator.RunCompile.html │ │ │ ├── Dynamator.html │ │ │ ├── EOGenerator.EO.html │ │ │ ├── EOGenerator.RC.html │ │ │ ├── EOGenerator.html │ │ │ ├── EliminationHeuristic.RandomizedBestOfNStrategy.html │ │ │ ├── EliminationHeuristic.html │ │ │ ├── EliminationOrders.ScoreFunction.html │ │ │ ├── EliminationOrders.html │ │ │ ├── EvidenceChangeEvent.html │ │ │ ├── EvidenceChangeListener.html │ │ │ ├── EvidenceController.html │ │ │ ├── FiniteVariable.html │ │ │ ├── FiniteVariableImpl.html │ │ │ ├── IDComparator.html │ │ │ ├── InferenceEngine.html │ │ │ ├── KnowledgeBase.KBUnsatisfiableStateException.html │ │ │ ├── KnowledgeBase.KnowledgeBaseListener.html │ │ │ ├── KnowledgeBase.html │ │ │ ├── LabelComparator.html │ │ │ ├── NoisyOrShell.html │ │ │ ├── NoisyOrShellHenrion.html │ │ │ ├── NoisyOrShellPearl.html │ │ │ ├── PartialDerivativeEngine.html │ │ │ ├── Potential.html │ │ │ ├── Prune.html │ │ │ ├── QuantitativeDependencyHandler.html │ │ │ ├── RCGenerator.EO.html │ │ │ ├── RCGenerator.RC.html │ │ │ ├── RCGenerator.Util.html │ │ │ ├── RCGenerator.html │ │ │ ├── RandomNetworks.html │ │ │ ├── Snapshot.html │ │ │ ├── StateNotFoundException.html │ │ │ ├── Table.html │ │ │ ├── TableIndex.Iterator.html │ │ │ ├── TableIndex.html │ │ │ ├── TableScaled.html │ │ │ ├── TableShell.html │ │ │ ├── Variable.html │ │ │ ├── VariableComparator.html │ │ │ ├── VariableImpl.html │ │ │ ├── VariableInstance.html │ │ │ ├── approx │ │ │ │ ├── ApproxCut.html │ │ │ │ ├── ApproxEngine.html │ │ │ │ ├── ApproxEngineGenerator.Properties.html │ │ │ │ ├── ApproxEngineGenerator.html │ │ │ │ ├── ApproxReport.html │ │ │ │ ├── BeliefPropagationSettings.html │ │ │ │ ├── EdgeDeletionBeliefPropagationSetting.html │ │ │ │ ├── EdgeDeletionEngineGenerator.html │ │ │ │ ├── EdgeDeletionInferenceEngine.Attribute.html │ │ │ │ ├── EdgeDeletionInferenceEngine.CPTPolicy.Listener.html │ │ │ │ ├── EdgeDeletionInferenceEngine.CPTPolicy.html │ │ │ │ ├── EdgeDeletionInferenceEngine.Command.html │ │ │ │ ├── EdgeDeletionInferenceEngine.DateFormatFilename.html │ │ │ │ ├── EdgeDeletionInferenceEngine.html │ │ │ │ ├── Macros.Bridge.html │ │ │ │ ├── Macros.Category.html │ │ │ │ ├── Macros.Doubler.html │ │ │ │ ├── Macros.RankingArgs.html │ │ │ │ ├── Macros.Recoverable.html │ │ │ │ ├── Macros.Recoverables.html │ │ │ │ ├── Macros.RecoveryInfo.html │ │ │ │ ├── Macros.html │ │ │ │ ├── MessagePassingScheduler.html │ │ │ │ ├── PropagationEngineGenerator.html │ │ │ │ ├── PropagationInferenceEngine.html │ │ │ │ ├── PropagationInferenceEngineImpl.html │ │ │ │ ├── RecoveryEngineGenerator.html │ │ │ │ ├── RecoveryInferenceEngine.html │ │ │ │ ├── RecoverySetting.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── decision │ │ │ │ ├── Builder.html │ │ │ │ ├── Classifier.html │ │ │ │ ├── DecisionBackup.html │ │ │ │ ├── DecisionEvent.Type.html │ │ │ │ ├── DecisionEvent.html │ │ │ │ ├── DecisionInternal.html │ │ │ │ ├── DecisionLeaf.html │ │ │ │ ├── DecisionListener.html │ │ │ │ ├── DecisionNode.html │ │ │ │ ├── DecisionNodeAbstract.html │ │ │ │ ├── DecisionTree.html │ │ │ │ ├── DecisionTreeImpl.html │ │ │ │ ├── Factory.html │ │ │ │ ├── Optimizer.EquivalenceKey.html │ │ │ │ ├── Optimizer.ParameterOptimizationLevel.html │ │ │ │ ├── Optimizer.ParameterOptimizationOn.html │ │ │ │ ├── Optimizer.Unsortable.html │ │ │ │ ├── Optimizer.html │ │ │ │ ├── Parameter.html │ │ │ │ ├── ParameterImpl.html │ │ │ │ ├── Stats.Stat.html │ │ │ │ ├── Stats.html │ │ │ │ ├── XmlDocumentHandler.html │ │ │ │ ├── XmlElementHandler.html │ │ │ │ ├── XmlWriter.GroupedDecisionWriter.html │ │ │ │ ├── XmlWriter.GroupedOutcomeWriter.html │ │ │ │ ├── XmlWriter.GroupedParameterWriter.html │ │ │ │ ├── XmlWriter.PrintStreamWriter.html │ │ │ │ ├── XmlWriter.PrintWriterWriter.html │ │ │ │ ├── XmlWriter.UniWriter.html │ │ │ │ ├── XmlWriter.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── dtree │ │ │ │ ├── CreationMethod.Settings.html │ │ │ │ ├── CreationMethod.html │ │ │ │ ├── Dtree.Create.html │ │ │ │ ├── Dtree.DtreeComparatorHeightLowToHigh.html │ │ │ │ ├── Dtree.DtreeCreationException.html │ │ │ │ ├── Dtree.html │ │ │ │ ├── DtreeCreateEO.html │ │ │ │ ├── DtreeCreateHMetis.html │ │ │ │ ├── DtreeCreateHMetis1.html │ │ │ │ ├── DtreeCreateHMetis1wn.html │ │ │ │ ├── DtreeCreateJT.html │ │ │ │ ├── DtreeCreateString.html │ │ │ │ ├── DtreeNode.html │ │ │ │ ├── DtreeNodeInternal.html │ │ │ │ ├── DtreeNodeLeaf.html │ │ │ │ ├── Hmetis.html │ │ │ │ ├── Hypergraph.html │ │ │ │ ├── MethodEliminationOrder.html │ │ │ │ ├── MethodHmetis.Algorithm.html │ │ │ │ ├── MethodHmetis.html │ │ │ │ ├── MethodHuginLog.Style.html │ │ │ │ ├── MethodHuginLog.html │ │ │ │ ├── Stats.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── inference │ │ │ │ ├── ArithmeticExpression.html │ │ │ │ ├── BeliefCompilation.html │ │ │ │ ├── DefaultGenerator.html │ │ │ │ ├── HuginEngine.html │ │ │ │ ├── HuginEngineGenerator.html │ │ │ │ ├── HuginWrapper.html │ │ │ │ ├── JEngineGenerator.html │ │ │ │ ├── JTtoET.html │ │ │ │ ├── JoinTreeInferenceEngine.html │ │ │ │ ├── JoinTreeInferenceEngineImpl.html │ │ │ │ ├── JoinTreeSettings.html │ │ │ │ ├── JointWrapper.html │ │ │ │ ├── Messenger.html │ │ │ │ ├── PartialDerivativeWrapper.html │ │ │ │ ├── PartialDerivativeWrapperEngine.html │ │ │ │ ├── RCEngine.html │ │ │ │ ├── RCEngineGenerator.html │ │ │ │ ├── RCInfo.html │ │ │ │ ├── RCSettings.html │ │ │ │ ├── RCWrapper.html │ │ │ │ ├── RandomEngineGenerator.html │ │ │ │ ├── RandomInferenceEngine.html │ │ │ │ ├── S4Compiler.html │ │ │ │ ├── S4DoubleExpression.CircuitWriter.html │ │ │ │ ├── S4DoubleExpression.html │ │ │ │ ├── SSEngine.html │ │ │ │ ├── SSEngineGenerator.html │ │ │ │ ├── SSWrapper.html │ │ │ │ ├── SynchronizedInferenceEngine.SynchronizedPartialDerivativeEngine.html │ │ │ │ ├── SynchronizedInferenceEngine.html │ │ │ │ ├── WrapperInferenceEngine.html │ │ │ │ ├── ZCEngine.html │ │ │ │ ├── ZCEngineGenerator.html │ │ │ │ ├── ZCWrapper.html │ │ │ │ ├── map │ │ │ │ │ ├── ExactMap.SizedOrder.html │ │ │ │ │ ├── ExactMap.html │ │ │ │ │ ├── InitializationMethod.html │ │ │ │ │ ├── MapEngine.html │ │ │ │ │ ├── MapProperty.html │ │ │ │ │ ├── MapRunner.MapResult.html │ │ │ │ │ ├── MapRunner.html │ │ │ │ │ ├── SearchMethod.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── io │ │ │ │ ├── AbstractCopier.html │ │ │ │ ├── AbstractSaxHandler.html │ │ │ │ ├── CPTImport.CompleteParameterRecorder.html │ │ │ │ ├── CPTImport.IncompleteParameterRecorder.html │ │ │ │ ├── CPTImport.ParameterRecorder.html │ │ │ │ ├── CPTImport.html │ │ │ │ ├── CPTImportColumnInfo.html │ │ │ │ ├── CPTInfo.Parameter.html │ │ │ │ ├── CPTInfo.ReadableWritableTable.html │ │ │ │ ├── CPTInfo.html │ │ │ │ ├── CharactersHandler.html │ │ │ │ ├── ElementHandler.html │ │ │ │ ├── Estimate.html │ │ │ │ ├── FileType.html │ │ │ │ ├── GraphvizIO.ExtraDotInfoSupplier.html │ │ │ │ ├── GraphvizIO.StandardNodeDimensionSupplier.html │ │ │ │ ├── GraphvizIO.html │ │ │ │ ├── InflibFileFilter.html │ │ │ │ ├── InstantiationXmlizer.RootCheckHandler.html │ │ │ │ ├── InstantiationXmlizer.ValidRootHandler.html │ │ │ │ ├── InstantiationXmlizer.html │ │ │ │ ├── ListConverter.html │ │ │ │ ├── NetworkIO.BeliefNetworkIOListener.html │ │ │ │ ├── NetworkIO.html │ │ │ │ ├── NodeLinearTask.html │ │ │ │ ├── ParseException.html │ │ │ │ ├── PropertySuperintendent.html │ │ │ │ ├── RunReadNetwork.html │ │ │ │ ├── SimpleCharStream.html │ │ │ │ ├── StandardNode.html │ │ │ │ ├── StandardNodeImpl.Struct.html │ │ │ │ ├── StandardNodeImpl.html │ │ │ │ ├── Token.html │ │ │ │ ├── TokenMgrError.html │ │ │ │ ├── dsl │ │ │ │ │ ├── DSLConstants.html │ │ │ │ │ ├── DSLNode.html │ │ │ │ │ ├── DSLNodeImpl.html │ │ │ │ │ ├── DSLNodeType.html │ │ │ │ │ ├── DSLSubmodel.html │ │ │ │ │ ├── DSLSubmodelFactory.html │ │ │ │ │ ├── DiagnosisType.html │ │ │ │ │ ├── GenieNet.html │ │ │ │ │ ├── GenieNetImpl.html │ │ │ │ │ ├── PotentialInfo.html │ │ │ │ │ ├── RunReadSMILE.html │ │ │ │ │ ├── SMILEReader.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ ├── geneticlinkage │ │ │ │ │ ├── Loci.Footer.BinaryILink.html │ │ │ │ │ ├── Loci.Footer.GH.html │ │ │ │ │ ├── Loci.Footer.Linkmap.html │ │ │ │ │ ├── Loci.Footer.Mlink.html │ │ │ │ │ ├── Loci.Footer.ProgData.html │ │ │ │ │ ├── Loci.Footer.html │ │ │ │ │ ├── Loci.Header.html │ │ │ │ │ ├── Loci.Locus.html │ │ │ │ │ ├── Loci.LocusData.html │ │ │ │ │ ├── Loci.LocusDataAffectionStatus.html │ │ │ │ │ ├── Loci.LocusDataComplexAffection1.html │ │ │ │ │ ├── Loci.LocusDataComplexAffection2.html │ │ │ │ │ ├── Loci.LocusDataNumberedAlleles.html │ │ │ │ │ ├── Loci.html │ │ │ │ │ ├── NuclearFamily.html │ │ │ │ │ ├── Pedigree.GeneticNetwork.html │ │ │ │ │ ├── Pedigree.PseudoLoci.html │ │ │ │ │ ├── Pedigree.html │ │ │ │ │ ├── Person.html │ │ │ │ │ ├── UtilGeneReader.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ ├── hugin │ │ │ │ │ ├── HuginClique.html │ │ │ │ │ ├── HuginCopier.html │ │ │ │ │ ├── HuginFileVersion.html │ │ │ │ │ ├── HuginFunction.html │ │ │ │ │ ├── HuginLogReader.html │ │ │ │ │ ├── HuginLogReaderConstants.html │ │ │ │ │ ├── HuginLogReaderTokenManager.html │ │ │ │ │ ├── HuginNet.html │ │ │ │ │ ├── HuginNetImpl.html │ │ │ │ │ ├── HuginNode.html │ │ │ │ │ ├── HuginNodeImpl.html │ │ │ │ │ ├── HuginPotential.html │ │ │ │ │ ├── HuginReader.html │ │ │ │ │ ├── HuginReaderConstants.html │ │ │ │ │ ├── HuginReaderTokenManager.html │ │ │ │ │ ├── RunReadHugin.html │ │ │ │ │ ├── SkimmerEstimator.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ ├── netica │ │ │ │ │ ├── NeticaObject.html │ │ │ │ │ ├── NeticaReader.html │ │ │ │ │ ├── NeticaReaderConstants.html │ │ │ │ │ ├── NeticaReaderTokenManager.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── xmlbif │ │ │ │ │ ├── RunReadBIF.MonitorableReusableParser.html │ │ │ │ │ ├── RunReadBIF.html │ │ │ │ │ ├── RunWriteBIF.BeliefNetworkWriter.html │ │ │ │ │ ├── RunWriteBIF.html │ │ │ │ │ ├── SkimmerEstimator.html │ │ │ │ │ ├── UAI06Parser.html │ │ │ │ │ ├── XmlbifParser.BifNode.html │ │ │ │ │ ├── XmlbifParser.Definition.html │ │ │ │ │ ├── XmlbifParser.Variable.html │ │ │ │ │ ├── XmlbifParser.VariableType.html │ │ │ │ │ ├── XmlbifParser.html │ │ │ │ │ ├── XmlbifWriter.Element.html │ │ │ │ │ ├── XmlbifWriter.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ ├── learn │ │ │ │ ├── EMThread.LearningListener.html │ │ │ │ ├── EMThread.html │ │ │ │ ├── Learning.html │ │ │ │ ├── LearningData.Struct.html │ │ │ │ ├── LearningData.html │ │ │ │ ├── LearningDataOld.html │ │ │ │ ├── Simulator.SimulationListener.html │ │ │ │ ├── Simulator.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ ├── rc2 │ │ │ │ ├── caching │ │ │ │ │ ├── RC2CachingSchemeUtils.html │ │ │ │ │ ├── RC2CachingScheme_Collection.html │ │ │ │ │ ├── RC2CachingScheme_DFBnB.html │ │ │ │ │ ├── RC2CachingScheme_Full.html │ │ │ │ │ ├── RC2CachingScheme_Greedy.html │ │ │ │ │ ├── RC2CachingScheme_None.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ ├── creation │ │ │ │ │ ├── RC2Creator.Params.html │ │ │ │ │ ├── RC2Creator.html │ │ │ │ │ ├── RC2CreatorDtToDg.ReducedRootSet.html │ │ │ │ │ ├── RC2CreatorDtToDg.html │ │ │ │ │ ├── RC2CreatorEO.Params.html │ │ │ │ │ ├── RC2CreatorEO.html │ │ │ │ │ ├── RC2CreatorFile.Params.html │ │ │ │ │ ├── RC2CreatorFile.html │ │ │ │ │ ├── RC2CreatorHM.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ ├── io │ │ │ │ │ ├── RC2WriteToFile.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ ├── kb │ │ │ │ │ ├── KBMap.Mapping.html │ │ │ │ │ ├── KBMap.html │ │ │ │ │ ├── KnowledgeBase.KnowledgeBaseListener.html │ │ │ │ │ ├── KnowledgeBase.html │ │ │ │ │ ├── KnowledgeBaseImpl.html │ │ │ │ │ ├── Map_EClause.html │ │ │ │ │ ├── Map_L.html │ │ │ │ │ ├── MultiValuedCNF.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ ├── package-tree.html │ │ │ │ │ └── sat │ │ │ │ │ │ ├── KB_SAT.html │ │ │ │ │ │ ├── package-frame.html │ │ │ │ │ │ ├── package-summary.html │ │ │ │ │ │ └── package-tree.html │ │ │ │ ├── structure │ │ │ │ │ ├── RC2.CachingScheme.html │ │ │ │ │ ├── RC2.ComputationStats.html │ │ │ │ │ ├── RC2.RCCreationParams.html │ │ │ │ │ ├── RC2.StoredComputationStats.html │ │ │ │ │ ├── RC2.html │ │ │ │ │ ├── RC2Index.html │ │ │ │ │ ├── RC2Node.html │ │ │ │ │ ├── RC2NodeInternal.html │ │ │ │ │ ├── RC2NodeLeaf.html │ │ │ │ │ ├── RC2NodeLeafEvidInd.html │ │ │ │ │ ├── RC2Utils.MiscStats.html │ │ │ │ │ ├── RC2Utils.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ └── tools │ │ │ │ │ ├── Compiled_MLink.html │ │ │ │ │ ├── NetworkDiff.html │ │ │ │ │ ├── RC_Link.RC_Results.html │ │ │ │ │ ├── RC_Link.html │ │ │ │ │ ├── RC_Link_UAI2006.html │ │ │ │ │ ├── TestClass.html │ │ │ │ │ ├── TimePeVsIl2.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ ├── recursiveconditioning │ │ │ │ ├── Bundle.html │ │ │ │ ├── CachingDFBnB.CacheFactorInstance.html │ │ │ │ ├── CachingDFBnB.ChildExpansion.html │ │ │ │ ├── CachingDFBnB.DFBnB_TmpVars.html │ │ │ │ ├── CachingDFBnB.HeurFunct.html │ │ │ │ ├── CachingDFBnB.HeurResult.html │ │ │ │ ├── CachingDFBnB.OrderingAlgo.html │ │ │ │ ├── CachingDFBnB.RCNodeComparator_Size.html │ │ │ │ ├── CachingDFBnB.SearchGraph.html │ │ │ │ ├── CachingDFBnB.html │ │ │ │ ├── CachingFull.html │ │ │ │ ├── CachingGreedy.html │ │ │ │ ├── CachingNonOptimalSize.RCNodeComparator_Size.html │ │ │ │ ├── CachingNonOptimalSize.html │ │ │ │ ├── CachingNone.html │ │ │ │ ├── CachingScheme.RCCreateListener.html │ │ │ │ ├── CachingScheme.html │ │ │ │ ├── CachingUniform.html │ │ │ │ ├── Computation.All.html │ │ │ │ ├── Computation.Pe.html │ │ │ │ ├── Computation.html │ │ │ │ ├── DecompositionStructureUtils.CreateNodeMethod.html │ │ │ │ ├── DecompositionStructureUtils.Params.html │ │ │ │ ├── DecompositionStructureUtils.ParamsGraph.html │ │ │ │ ├── DecompositionStructureUtils.ParamsGraphDT.html │ │ │ │ ├── DecompositionStructureUtils.ParamsGraphJT.html │ │ │ │ ├── DecompositionStructureUtils.ParamsGraphJT2.html │ │ │ │ ├── DecompositionStructureUtils.ParamsTree.html │ │ │ │ ├── DecompositionStructureUtils.ParamsTreeDT.html │ │ │ │ ├── DecompositionStructureUtils.ParamsTreeJT.html │ │ │ │ ├── DecompositionStructureUtils.ParamsTreeJT2.html │ │ │ │ ├── DecompositionStructureUtils.html │ │ │ │ ├── FileInfo.html │ │ │ │ ├── RC.RCCounters.html │ │ │ │ ├── RC.RCCreationException.html │ │ │ │ ├── RC.RCCreationParams.html │ │ │ │ ├── RC.RCStats.html │ │ │ │ ├── RC.RCStats_All.html │ │ │ │ ├── RC.RCStats_Pe.html │ │ │ │ ├── RC.RecCondThreadListener.html │ │ │ │ ├── RC.html │ │ │ │ ├── RCComparator.html │ │ │ │ ├── RCDgraph.html │ │ │ │ ├── RCDtree.html │ │ │ │ ├── RCEngineGenerator.html │ │ │ │ ├── RCInferenceEngine.html │ │ │ │ ├── RCInstanceIterator.html │ │ │ │ ├── RCInstanceIteratorKB.html │ │ │ │ ├── RCIterator.html │ │ │ │ ├── RCIteratorArray.html │ │ │ │ ├── RCIteratorTraversal.html │ │ │ │ ├── RCNode.html │ │ │ │ ├── RCNodeCache.html │ │ │ │ ├── RCNodeInternalBinaryCache.ChildIterator.html │ │ │ │ ├── RCNodeInternalBinaryCache.html │ │ │ │ ├── RCNodeLeaf.html │ │ │ │ ├── RCUtilities.html │ │ │ │ ├── RCUtilitiesIO.html │ │ │ │ ├── Settings.RCFactory.html │ │ │ │ ├── Settings.html │ │ │ │ ├── StatsHandler.html │ │ │ │ ├── Xmlizer.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── sensitivity │ │ │ │ ├── CovaryingScheme.html │ │ │ │ ├── ExcludePolicy.html │ │ │ │ ├── SensMPEEngine.html │ │ │ │ ├── SensMPEReport.html │ │ │ │ ├── SensitivityConstraint.html │ │ │ │ ├── SensitivityEngine.html │ │ │ │ ├── SensitivityEquation.html │ │ │ │ ├── SensitivityReport.html │ │ │ │ ├── SensitivitySuggestion.html │ │ │ │ ├── SensitivitySuggestionComparator.html │ │ │ │ ├── SensitivityTable.html │ │ │ │ ├── SingleCPTSuggestion.html │ │ │ │ ├── SingleParamSuggestion.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── tree │ │ │ │ ├── AbstractEliminationTreeGenerator.html │ │ │ │ ├── CostFunction.html │ │ │ │ ├── EliminationTree.html │ │ │ │ ├── JoinTree.html │ │ │ │ ├── MinPairCostTreeGenerator.html │ │ │ │ ├── RecursiveEliminationTreeGenerator.html │ │ │ │ ├── Trees.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ └── uai2006 │ │ │ │ ├── RC_Link2PeEngine.html │ │ │ │ ├── TestMpeEngine.html │ │ │ │ ├── TestPeEngine.html │ │ │ │ ├── UaiEdgeCutter.BpInstanceComparator.html │ │ │ │ ├── UaiEdgeCutter.BpVarComparator.html │ │ │ │ ├── UaiEdgeCutter.MyIndex.html │ │ │ │ ├── UaiEdgeCutter.MyRecord.html │ │ │ │ ├── UaiEdgeCutter.html │ │ │ │ ├── UaiMain.html │ │ │ │ ├── UaiMapEngine.html │ │ │ │ ├── UaiMapSolution.html │ │ │ │ ├── UaiMpeEngine.html │ │ │ │ ├── UaiMpeMain.html │ │ │ │ ├── UaiPeEngine.html │ │ │ │ ├── UaiPeMain.html │ │ │ │ ├── UaiPreprocessResult.html │ │ │ │ ├── UaiUnderflowException.html │ │ │ │ ├── UaiUtilsIf.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── structure │ │ │ ├── AbstractDirectedGraph.html │ │ │ ├── DepthFirstIterator.html │ │ │ ├── DirectedEdge.html │ │ │ ├── DirectedGraph.html │ │ │ ├── DoubleFunction.html │ │ │ ├── Edge.html │ │ │ ├── Filter.html │ │ │ ├── Graph.html │ │ │ ├── Graphs.html │ │ │ ├── HashDirectedGraph.html │ │ │ ├── HashGraph.html │ │ │ ├── Heap.HeapElement.html │ │ │ ├── Heap.html │ │ │ ├── IdentityArrayMap.html │ │ │ ├── IntDirectedGraph.html │ │ │ ├── IntGraph.html │ │ │ ├── MappedList.html │ │ │ ├── RecursiveDepthFirstIterator.html │ │ │ ├── SetOperation.html │ │ │ ├── UnionFind.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ │ └── util │ │ │ ├── AbstractEnumProperty.html │ │ │ ├── AbstractStringifier.DateFormatFilename.html │ │ │ ├── AbstractStringifier.html │ │ │ ├── Assert.html │ │ │ ├── BooleanArrays.html │ │ │ ├── BucketEliminator.html │ │ │ ├── CPTShells.html │ │ │ ├── CSITypeProperty.CSIType.html │ │ │ ├── CSITypeProperty.html │ │ │ ├── ChangeBroadcaster.html │ │ │ ├── CompoundTask.html │ │ │ ├── DataSetStatistic.html │ │ │ ├── DblArrays.html │ │ │ ├── EnumProperty.html │ │ │ ├── EnumValue.html │ │ │ ├── EvidenceAssertedProperty.html │ │ │ ├── FlagProperty.FlagValue.html │ │ │ ├── FlagProperty.html │ │ │ ├── Function.html │ │ │ ├── HiddenProperty.html │ │ │ ├── ImpactProperty.html │ │ │ ├── InOutDegreeProperty.InOutDegree.html │ │ │ ├── InOutDegreeProperty.html │ │ │ ├── InferenceValidProperty.html │ │ │ ├── IntArrays.html │ │ │ ├── IntIterator.html │ │ │ ├── Interruptable.Veto.html │ │ │ ├── Interruptable.html │ │ │ ├── Interval.html │ │ │ ├── JVMProfiler.html │ │ │ ├── JVMTI.html │ │ │ ├── LinearFunction.html │ │ │ ├── Maps.html │ │ │ ├── NamedObject.html │ │ │ ├── ObjArrays.html │ │ │ ├── Prob.html │ │ │ ├── ProbabilityInterval.html │ │ │ ├── ProgressMonitorable.html │ │ │ ├── PropertyKey.html │ │ │ ├── QueryParticipantProperty.html │ │ │ ├── Reference.html │ │ │ ├── RepetitionThread.html │ │ │ ├── Setting.Settings.html │ │ │ ├── Setting.html │ │ │ ├── SettingsImpl.html │ │ │ ├── Stringifier.Selector.html │ │ │ ├── Stringifier.html │ │ │ ├── SystemGCThread.html │ │ │ ├── UserEnumProperty.html │ │ │ ├── UserEnumValue.html │ │ │ ├── UserObject.html │ │ │ ├── VariableStringifier.html │ │ │ ├── WeakLinkedList.html │ │ │ ├── WeightedTask.html │ │ │ ├── code │ │ │ ├── AbstractCodeGenius.html │ │ │ ├── AbstractCodeOption.html │ │ │ ├── AbstractScriptGenius.html │ │ │ ├── BatchScriptGenius.html │ │ │ ├── BourneScriptGenius.html │ │ │ ├── CPTCoder.html │ │ │ ├── CShellScriptGenius.html │ │ │ ├── ClassModule.html │ │ │ ├── CodeGenius.html │ │ │ ├── CodeOption.html │ │ │ ├── CodeOptionValue.html │ │ │ ├── EMCoder.html │ │ │ ├── GuessingSource.html │ │ │ ├── JDKCompile.html │ │ │ ├── JDKRun.CompiledClassInfo.html │ │ │ ├── JDKRun.html │ │ │ ├── JDKTool.html │ │ │ ├── JDKToolScript.html │ │ │ ├── MAPCoder.OptionPrune.html │ │ │ ├── MAPCoder.OptionTimings.html │ │ │ ├── MAPCoder.html │ │ │ ├── MPECoder.html │ │ │ ├── ModelCoder.LibraryVersionOption.html │ │ │ ├── ModelCoder.html │ │ │ ├── OptionBreadth.html │ │ │ ├── OptionWithComments.html │ │ │ ├── ParanoidFileFinder.html │ │ │ ├── PerlScriptGenius.html │ │ │ ├── ProbabilityQueryCoder.MarginalScopeOption.html │ │ │ ├── ProbabilityQueryCoder.html │ │ │ ├── Script.html │ │ │ ├── ScriptExecution.Pipe.html │ │ │ ├── ScriptExecution.ProcessCustodian.html │ │ │ ├── ScriptExecution.ProcessSitter.html │ │ │ ├── ScriptExecution.html │ │ │ ├── ScriptGenius.html │ │ │ ├── ScriptTest.html │ │ │ ├── SensitivityCoder.html │ │ │ ├── SoftwareEntity.html │ │ │ ├── SystemSoftwareSource.html │ │ │ ├── Test.html │ │ │ ├── Tree.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ ├── il2 │ │ ├── bridge │ │ │ ├── ConversionException.html │ │ │ ├── Converter.html │ │ │ ├── IO.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ ├── inf │ │ │ ├── Algorithm.EliminationOrderHeuristic.html │ │ │ ├── Algorithm.Key.html │ │ │ ├── Algorithm.Order2JoinTree.html │ │ │ ├── Algorithm.Query.html │ │ │ ├── Algorithm.Result.html │ │ │ ├── Algorithm.Setting.html │ │ │ ├── Algorithm.html │ │ │ ├── BasicInference.html │ │ │ ├── JointEngine.html │ │ │ ├── PartialDerivativeEngine.html │ │ │ ├── bp │ │ │ │ ├── BeliefPropagation.html │ │ │ │ ├── MaxProduct.html │ │ │ │ ├── MaxProductLinearSmoothness.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── schedules │ │ │ │ │ ├── MessagePassingScheduler.html │ │ │ │ │ ├── ParallelSchedule.html │ │ │ │ │ ├── SequentialSchedule.html │ │ │ │ │ ├── TreeSchedule.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ ├── edgedeletion │ │ │ │ ├── EDAlgorithm.RankingHeuristic.html │ │ │ │ ├── EDAlgorithm.html │ │ │ │ ├── EDEdgeDeleter.html │ │ │ │ ├── EDMPAlgorithm.html │ │ │ │ ├── EDNetwork.html │ │ │ │ ├── EDRecovery.html │ │ │ │ ├── EdgeComparator.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── experimental │ │ │ │ ├── VEVariance.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── jointree │ │ │ │ ├── AbstractHuginAlgorithm.html │ │ │ │ ├── AbstractSSAlgorithm.html │ │ │ │ ├── AbstractZCAlgorithm.html │ │ │ │ ├── Flavor.html │ │ │ │ ├── JoinTreeAlgorithm.html │ │ │ │ ├── MPEAlgorithm.html │ │ │ │ ├── NormalizedMaxSSAlgorithm.html │ │ │ │ ├── NormalizedSSAlgorithm.html │ │ │ │ ├── NormalizedZCAlgorithm.html │ │ │ │ ├── UnindexedHuginAlgorithm.html │ │ │ │ ├── UnindexedSSAlgorithm.html │ │ │ │ ├── UnindexedZCAlgorithm.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── map │ │ │ │ ├── Factorizer.html │ │ │ │ ├── IndexedJoinTree.html │ │ │ │ ├── JoinTree.html │ │ │ │ ├── JoinTreeInference.html │ │ │ │ ├── MapInitializer.MapResult.html │ │ │ │ ├── MapInitializer.html │ │ │ │ ├── MapJoinTree.html │ │ │ │ ├── MapOrderMaker.html │ │ │ │ ├── MapSearch.MapInfo.html │ │ │ │ ├── MapSearch.MapResult.html │ │ │ │ ├── MapSearch.html │ │ │ │ ├── MapTree.html │ │ │ │ ├── ShenoyShaferAlgorithm.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── mini │ │ │ │ ├── MiniTree.html │ │ │ │ ├── Partition.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ ├── rc │ │ │ │ ├── CachingScheme.html │ │ │ │ ├── RC.html │ │ │ │ ├── RCEngine.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ └── structure │ │ │ │ ├── Binner.html │ │ │ │ ├── BoundedConstrainedOrderGenerator.html │ │ │ │ ├── Bucketer.html │ │ │ │ ├── ConnectivityOrderer.html │ │ │ │ ├── ConstrainedMinFillOrderGenerator.html │ │ │ │ ├── ConstrainedMinSizeOrderGenerator.html │ │ │ │ ├── DGraph.html │ │ │ │ ├── DGraphs.html │ │ │ │ ├── DgraphCreateHMetis.html │ │ │ │ ├── DgraphCreateHMetis1.html │ │ │ │ ├── DgraphCreateHMetis1wn.html │ │ │ │ ├── DynamicEliminator.html │ │ │ │ ├── EliminationOrders.JT.html │ │ │ │ ├── EliminationOrders.Record.html │ │ │ │ ├── EliminationOrders.html │ │ │ │ ├── InstanceIterator.IterationRec.html │ │ │ │ ├── InstanceIterator.html │ │ │ │ ├── JTUnifier.html │ │ │ │ ├── JoinTree.html │ │ │ │ ├── JoinTreeStats.Stat.html │ │ │ │ ├── JoinTreeStats.StatImpl.html │ │ │ │ ├── JoinTreeStats.StatsSource.html │ │ │ │ ├── JoinTreeStats.html │ │ │ │ ├── MinFillOrderGenerator.html │ │ │ │ ├── MinFillOrderer.html │ │ │ │ ├── MinSizeOrderer.html │ │ │ │ ├── Orderer.html │ │ │ │ ├── minfill2 │ │ │ │ ├── EliminationOrderEngine.html │ │ │ │ ├── IntPriorityQueue.html │ │ │ │ ├── MinfillEoe.html │ │ │ │ ├── PriorityQueue.html │ │ │ │ ├── Util.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ ├── model │ │ │ ├── BayesianNetwork.html │ │ │ ├── Domain.html │ │ │ ├── Index.Partition.html │ │ │ ├── Index.html │ │ │ ├── MPETable.html │ │ │ ├── RandomNetworks.html │ │ │ ├── SubDomain.html │ │ │ ├── Table.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ └── util │ │ │ ├── ArrayUtils.html │ │ │ ├── ComparatorHeap.html │ │ │ ├── DoubleList.html │ │ │ ├── DoubleMap.html │ │ │ ├── Graph.Compressed.html │ │ │ ├── Graph.html │ │ │ ├── Heap.html │ │ │ ├── IndexedHeap.html │ │ │ ├── Instantiation.html │ │ │ ├── IntList.html │ │ │ ├── IntMap.html │ │ │ ├── IntSet.html │ │ │ ├── IntStats.html │ │ │ ├── MPE.html │ │ │ ├── MappedHeap.html │ │ │ ├── Pair.html │ │ │ ├── QuickSort.html │ │ │ ├── UPair.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ ├── index-all.html │ ├── index.html │ ├── overview-frame.html │ ├── overview-summary.html │ ├── overview-tree.html │ ├── package-list │ ├── resources │ │ └── inherit.gif │ ├── serialized-form.html │ └── stylesheet.css │ ├── network_samples │ ├── .DS_Store │ ├── Barley.net │ ├── Tank2.dsl │ ├── cancer.net │ ├── cancer_em.dat │ └── cancer_for_EM.net │ ├── runsamiam │ ├── samiam.jar │ └── samiamrc.xml ├── Papers ├── .DS_Store ├── Belief Propagation │ ├── .DS_Store │ ├── A Tutorial Introduction to Belief Propagation.pdf │ ├── Bethe free energy, Kikuchi approximations, and belief propagation algorithms.pdf │ ├── Beyond Feature Points - Structured Prediction for Monocular Non-rigid 3D Reconstruction.pdf │ ├── Constructing Free Energy Approximations and Generalized Belief Propagation Algorithms.pdf │ ├── Convergent Message-Passing Algorithms for Inference over General Graphs with Convex Free Energies.pdf │ ├── Convexity Arguments for Efficient Minimization of the Bethe and Kikuchi Free Energies.pdf │ ├── Describing the Scene as a Whole - Joint Object Detection, Scene Classification and Semantic Segmentation.pdf │ ├── Distributed Message Passing for Large Scale Graphical Models.pdf │ ├── Efficient Belief Propagation for Higher Order Cliques Using Linear Constraint Nodes.pdf │ ├── Efficient Structured Prediction with Latent Variables for General Graphical Models.pdf │ ├── Estimation and Marginalization using Kikuchi Approximation Methods.pdf │ ├── Free Energy in Statistical Physics and Inference.pdf │ ├── Generalized Belief Propagation.ppt │ ├── Globally Convergent Dual MAP LP Relaxation Solvers using Fenchel-Young Margins.pdf │ ├── Joint, Marginal, and Conditional Probability.pdf │ ├── Norm-Product Belief Propagation - Primal-Dual Message-Passing for Approximate Inference.pdf │ ├── Prioritized Asynchronous Belief Propagation.pdf │ ├── Residual Belief Propagation - Informed Scheduling for Asynchronous Message Passing.pdf │ ├── Residual Splash for Optimally Parallelizing Belief Propagation.pdf │ └── Simplifying Generalized Belief Propagation on Redundant Region Graphs.pdf └── The Multiple-Try Method and Local Optimisation in Metropolis Sampling.pdf └── README.md /ByEdisonGuo/PGM-Programming_Assignment_1/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_1/.DS_Store -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_1/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m and FactorTutorial.m 8 | 9 | function I = AssignmentToIndex(A, D) 10 | 11 | D = D(:)'; % ensure that D is a row vector 12 | if (any(size(A) == 1)), 13 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 14 | else 15 | I = sum(repmat(cumprod([1, D(1:end - 1)]), size(A, 1), 1) .* (A - 1), 2) + 1; 16 | end; 17 | 18 | end 19 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_1/CreditWorthinessCheck.m: -------------------------------------------------------------------------------- 1 | function CreditWorthiness_Test() 2 | fileName = 'C:\Users\edison\Desktop\Probabilistic Graphical Models\Assignments\PGM-Programming_Assignment_1\Credit_net.net'; 3 | E{1, 1} = 'DebtIncomeRatio'; 4 | E{1, 2} = 'Low'; 5 | 6 | disp('Observed evidence: ') 7 | disp(E) 8 | M = CheckCreditWorthiness(fileName, E); 9 | disp(M); 10 | 11 | disp('Without observed evidence: ') 12 | M = CheckCreditWorthiness(fileName, []); 13 | disp(M); 14 | end 15 | 16 | function M = CheckCreditWorthiness(fileName, E) 17 | 18 | [F, names, valNames] = ConvertNetwork(fileName); 19 | 20 | evidence = []; 21 | if ~isempty(E) 22 | evidence = zeros(size(E)); 23 | for i = 1:size(E, 1) 24 | ivar = find(strcmp(E(i, 1), names)); 25 | val = find(strcmp(E(i, 2), valNames{ivar})); 26 | 27 | evidence(i, :) = [ivar val]; 28 | end 29 | end 30 | 31 | idx = find(strcmp(names, 'CreditWorthiness')); 32 | M = ComputeMarginal(idx, F, evidence); 33 | 34 | end 35 | 36 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_1/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | % GetValueOfAssignment Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GetValueOfAssignment(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GetValueOfAssignment(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SetValueOfAssignment.m and FactorTutorial.m 11 | 12 | function v = GetValueOfAssignment(F, A, VO) 13 | 14 | if (nargin == 2), 15 | indx = AssignmentToIndex(A, F.card); 16 | else 17 | map = zeros(length(F.var), 1); 18 | for i = 1:length(F.var), 19 | map(i) = find(VO == F.var(i)); 20 | end; 21 | indx = AssignmentToIndex(A(map), F.card); 22 | end; 23 | 24 | v = F.val(indx); 25 | 26 | end 27 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_1/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and FactorTutorial.m 9 | 10 | function A = IndexToAssignment(I, D) 11 | 12 | D = D(:)'; % ensure that D is a row vector 13 | A = mod(floor(repmat(I(:) - 1, 1, length(D)) ./ repmat(cumprod([1, D(1:end - 1)]), length(I), 1)), ... 14 | repmat(D, length(I), 1)) + 1; 15 | 16 | end 17 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_1/PGM_Programming_Assignment_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_1/PGM_Programming_Assignment_1.pdf -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_1/StandardizeFactors.m: -------------------------------------------------------------------------------- 1 | % Function that sorts the variables in F and returns an equivalent 2 | % factor G. Used only to standardize output for grading purposes. 3 | function G = StandardizeFactors(F) 4 | G = struct('var', [], 'card', [], 'val', []); 5 | for i = 1:length(F) 6 | G(i) = StandardizeFactor(F(i)); 7 | end 8 | 9 | function G = StandardizeFactor(F); 10 | 11 | G = struct('var', [], 'card', [], 'val', []); 12 | 13 | [G.var, F2G] = sort(F.var); 14 | G.card = F.card(F2G); 15 | G.val = zeros(size(F.val)); 16 | for i = 1:length(F.val) 17 | F_assn = IndexToAssignment(i, F.card); 18 | j = AssignmentToIndex(F_assn(F2G), G.card); 19 | G.val(j) = F.val(i); 20 | end 21 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_1/submitWeb.m: -------------------------------------------------------------------------------- 1 | % submitWeb Creates files from your code and output for web submission. 2 | % 3 | % If the submit function does not work for you, use the web-submission mechanism. 4 | % Call this function to produce a file for the part you wish to submit. Then, 5 | % submit the file to the class servers using the "Web Submission" button on the 6 | % Programming Assignments page on the course website. 7 | % 8 | % You should call this function without arguments (submitWeb), to receive 9 | % an interactive prompt for submission; optionally you can call it with the partID 10 | % if you so wish. Make sure your working directory is set to the directory 11 | % containing the submitWeb.m file and your assignment files. 12 | 13 | function submitWeb(partId) 14 | if ~exist('partId', 'var') || isempty(partId) 15 | partId = []; 16 | end 17 | 18 | submit(partId, 1); 19 | end 20 | 21 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_1/submit_input.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_1/submit_input.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_4/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m 8 | % 9 | % Copyright (C) Daphne Koller, Stanford University, 2012 10 | 11 | 12 | function I = AssignmentToIndex(A, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | if (any(size(A) == 1)), 16 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 17 | else 18 | I = sum(repmat(cumprod([1, D(1:end - 1)]), size(A, 1), 1) .* (A - 1), 2) + 1; 19 | end; 20 | 21 | end 22 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_4/DecodedMarginalsToChars.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function DecodedMarginalsToChars(decodedMarginals) 4 | chars = 'abcdefghijklmnopqrstuvwxyz'; 5 | fprintf('%c', chars(decodedMarginals)); 6 | fprintf('\n'); 7 | end 8 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_4/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | % GetValueOfAssignment Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GetValueOfAssignment(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GetValueOfAssignment(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SetValueOfAssignment.m and SampleFactors.m 11 | % 12 | % Copyright (C) Daphne Koller, Stanford University, 2012 13 | 14 | function v = GetValueOfAssignment(F, A, VO) 15 | 16 | if (nargin == 2), 17 | indx = AssignmentToIndex(A, F.card); 18 | else 19 | map = zeros(length(F.var), 1); 20 | for i = 1:length(F.var), 21 | map(i) = find(VO == F.var(i)); 22 | end; 23 | indx = AssignmentToIndex(A(map), F.card); 24 | end; 25 | 26 | v = F.val(indx); 27 | 28 | end 29 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_4/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and SampleFactors.m 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = IndexToAssignment(I, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | A = mod(floor(repmat(I(:) - 1, 1, length(D)) ./ repmat(cumprod([1, D(1:end - 1)]), length(I), 1)), ... 16 | repmat(D, length(I), 1)) + 1; 17 | 18 | end 19 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_4/MaxDecoding.m: -------------------------------------------------------------------------------- 1 | %MAXDECODING Finds the best assignment for each variable from the marginals M 2 | %passed in. Returns A such that A(i) returns the index of the best 3 | %instantiation for variable i. 4 | % 5 | % For instance: Let's say we have two variables 1 and 2. 6 | % Marginals for 1 = [0.1, 0.3, 0.6] 7 | % Marginals for 2 = [0.92, 0.08] 8 | % A(1) = 3, A(2) = 1. 9 | % 10 | % M is a list of factors, where each factor is only over one variable. 11 | % 12 | % See also COMPUTEEXACTMARGINALSBP 13 | % 14 | % Copyright (C) Daphne Koller, Stanford University, 2012 15 | 16 | 17 | function A = MaxDecoding( M ) 18 | 19 | A = zeros(length(M), 1); 20 | 21 | for i = 1:length(M) 22 | [~, idx] = max(M(i).val); 23 | A(i) = idx; 24 | end 25 | 26 | end 27 | 28 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_4/PA4Sample.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_4/PA4Sample.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_4/PA4Test.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_4/PA4Test.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_4/ProgrammingAssignment4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_4/ProgrammingAssignment4.pdf -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_4/StandardizeFactors.m: -------------------------------------------------------------------------------- 1 | % Function that sorts the variables in F and returns an equivalent 2 | % factor G. Used only to standardize output for grading purposes. 3 | function G = StandardizeFactors(F) 4 | G = struct('var', [], 'card', [], 'val', []); 5 | for i = 1:length(F) 6 | G(i) = StandardizeFactor(F(i)); 7 | end 8 | 9 | function G = StandardizeFactor(F); 10 | 11 | G = struct('var', [], 'card', [], 'val', []); 12 | 13 | [G.var, F2G] = sort(F.var); 14 | G.card = F.card(F2G); 15 | G.val = zeros(size(F.val)); 16 | 17 | fval = [1:length(F.val)]; 18 | if isempty(fval); fval = []; end; 19 | 20 | F_assn = IndexToAssignment(1:length(F.val), F.card); 21 | idx = AssignmentToIndex(F_assn(:, F2G), G.card); 22 | G.val(idx) = F.val; 23 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_4/Testing.m: -------------------------------------------------------------------------------- 1 | load('PA4Sample.mat', 'OCRNetworkToRun'); 2 | maxMarginals = ComputeExactMarginalsBP(OCRNetworkToRun, [], 1); 3 | MAPAssignment = MaxDecoding(maxMarginals); 4 | DecodedMarginalsToChars(MAPAssignment) -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_4/submitWeb.m: -------------------------------------------------------------------------------- 1 | % submitWeb Creates files from your code and output for web submission. 2 | % 3 | % If the submit function does not work for you, use the web-submission mechanism. 4 | % Call this function to produce a file for the part you wish to submit. Then, 5 | % submit the file to the class servers using the "Web Submission" button on the 6 | % Programming Assignments page on the course website. 7 | % 8 | % Copyright (C) Daphne Koller, Stanford University, 2012 9 | 10 | function submitWeb(partId) 11 | if ~exist('partId', 'var') || isempty(partId) 12 | partId = []; 13 | end 14 | 15 | submit(partId, 1); 16 | end 17 | 18 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5/.DS_Store -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m 8 | % Copyright (C) Daphne Koller, Stanford University, 2012 9 | 10 | function I = AssignmentToIndex(A, D) 11 | 12 | D = D(:)'; % ensure that D is a row vector 13 | if (any(size(A) == 1)), 14 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 15 | else 16 | I = sum(repmat(cumprod([1, D(1:end - 1)]), size(A, 1), 1) .* (A - 1), 2) + 1; 17 | end; 18 | 19 | end 20 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/EdgeToFactorCorrespondence.m: -------------------------------------------------------------------------------- 1 | % Returns a matrix that maps edges to a list of factors in which both ends partake 2 | % 3 | % Copyright (C) Daphne Koller, Stanford University, 2012 4 | 5 | function E2F = EdgeToFactorCorrespondence(V, F) 6 | 7 | E2F = cell(length(V), length(V)); 8 | 9 | for f = 1:length(F) 10 | for i = 1:length(F(f).var) 11 | for j = i+1:length(F(f).var) 12 | u = F(f).var(i); 13 | v = F(f).var(j); 14 | E2F{u,v} = union(E2F{u,v}, f); 15 | E2F{v,u} = union(E2F{v,u}, f); 16 | end 17 | end 18 | end -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %GETVALUEOFASSIGNMENT Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GETVALUEOFASSIGNMENT(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GETVALUEOFASSIGNMENT(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SETVALUEOFASSIGNMENT 11 | % 12 | % Copyright (C) Daphne Koller, Stanford University, 2012 13 | 14 | function v = GetValueOfAssignment(F, A, VO); 15 | 16 | if (nargin == 2), 17 | indx = AssignmentToIndex(A, F.card); 18 | else 19 | map = zeros(length(F.var), 1); 20 | for i = 1:length(F.var), 21 | map(i) = find(VO == F.var(i)); 22 | end; 23 | indx = AssignmentToIndex(A(map), F.card); 24 | end; 25 | 26 | v = F.val(indx); 27 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/GibbsTrans.m: -------------------------------------------------------------------------------- 1 | % GIBBSTRANS 2 | % 3 | % MCMC transition function that performs Gibbs sampling. 4 | % A - The current joint assignment. This should be 5 | % updated to be the next assignment 6 | % G - The network 7 | % F - List of all factors 8 | % 9 | % Copyright (C) Daphne Koller, Stanford University, 2012 10 | 11 | function A = GibbsTrans(A, G, F) 12 | 13 | for i = 1:length(G.names) 14 | dist = BlockLogDistribution(i, G, F, A); 15 | A(i) = randsample(1:G.card(i), 1, true, exp(dist)); 16 | end 17 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and SampleFactors.m 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = IndexToAssignment(I, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | A = mod(floor(repmat(I(:) - 1, 1, length(D)) ./ repmat(cumprod([1, D(1:end - 1)]), length(I), 1)), ... 16 | repmat(D, length(I), 1)) + 1; 17 | 18 | end 19 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/LogProbOfJointAssignment.m: -------------------------------------------------------------------------------- 1 | % Returns the log probability of an assignment A in a distribution defined by factors F 2 | % 3 | % Copyright (C) Daphne Koller, Stanford University, 2012 4 | 5 | function logp = LogProbOfJointAssignment(F, A) 6 | 7 | % work in log-space to prevent underflow 8 | logp = 0.0; 9 | for i = 1:length(F) 10 | logp = logp + log(GetValueOfAssignment(F(i), A, 1:length(A))); 11 | end 12 | 13 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/MHGibbsTrans.m: -------------------------------------------------------------------------------- 1 | % MHGIBBSTRANS 2 | % 3 | % MCMC Metropolis-Hastings transition function that 4 | % utilizes the Gibbs sampling distribution for proposals. 5 | % A - The current joint assignment. This should be 6 | % updated to be the next assignment 7 | % G - The network 8 | % F - List of all factors 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = MHGibbsTrans(A, G, F) 13 | 14 | % Draw proposed new state from Gibbs Transition distribution 15 | A_prop = GibbsTrans(A, G, F); 16 | 17 | % Compute acceptance probability 18 | p_acceptance = 1.0; 19 | 20 | % Accept or reject proposal 21 | if rand() < p_acceptance 22 | A = A_prop; 23 | end -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/MHUniformTrans.m: -------------------------------------------------------------------------------- 1 | % MHUNIFORMTRANS 2 | % 3 | % MCMC Metropolis-Hastings transition function that 4 | % utilizes the uniform proposal distribution. 5 | % A - The current joint assignment. This should be 6 | % updated to be the next assignment 7 | % G - The network 8 | % F - List of all factors 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = MHUniformTrans(A, G, F) 13 | 14 | % Draw proposed new state from uniform distribution 15 | A_prop = ceil(rand(1, length(A)) .* G.card); 16 | 17 | p_acceptance = exp(LogProbOfJointAssignment(F, A_prop) - ... 18 | LogProbOfJointAssignment(F, A)); 19 | 20 | % Accept or reject proposal 21 | if rand() < p_acceptance 22 | % disp('Accepted'); 23 | A = A_prop; 24 | end -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/ProgrammingAssignment5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5/ProgrammingAssignment5.pdf -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/SetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %SETVALUEOFASSIGNMENT Sets the value of a variable assignment in a factor. 2 | % 3 | % F = SETVALUEOFASSIGNMENT(F, A, v) sets the value of a variable assignment, 4 | % A, in factor F to v. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % F = SETVALUEOFASSIGNMENT(F, A, v, VO) sets the value of a variable 8 | % assignment, A, in factor F to v. The order of the variables in A are given 9 | % by the vector VO. 10 | % 11 | % See also GETVALUEOFASSIGNMENT 12 | % 13 | % Copyright (C) Daphne Koller, Stanford University, 2012 14 | 15 | function F = SetValueOfAssignment(F, A, v, VO); 16 | 17 | if (nargin == 3), 18 | indx = AssignmentToIndex(A, F.card); 19 | else 20 | map = zeros(length(F.var), 1); 21 | for i = 1:length(F.var), 22 | map(i) = find(VO == F.var(i)); 23 | end; 24 | indx = AssignmentToIndex(A(map), F.card); 25 | end; 26 | 27 | F.val(indx) = v; 28 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/VariableToFactorCorrespondence.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function V2F = VariableToFactorCorrespondence(V, F) 4 | 5 | V2F = cell(length(V), 1); 6 | 7 | for f = 1:length(F) 8 | for i = 1:length(F(f).var) 9 | v = F(f).var(i); 10 | V2F{v} = union(V2F{v}, f); 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/VisualizeToyImageMarginals.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function VisualizeToyImageMarginals(G, M, chain_num, tname) 4 | 5 | n = sqrt(length(G.names)); 6 | marginal_vector = []; 7 | for i = 1:length(M) 8 | marginal_vector(end+1) = M(i).val(1); 9 | end 10 | clims = [0, 1]; 11 | imagesc(reshape(marginal_vector, n, n), clims); 12 | colormap(gray); 13 | title(['Marginals for chain ' num2str(chain_num) ' ' tname]) -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/exampleIOPA5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5/exampleIOPA5.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/pgm_login_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5/pgm_login_data.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/rand.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [val] = rand(arg1,arg2); 4 | val = -1; 5 | gran = 1e6; 6 | 7 | if(nargin>0&&ischar(arg1)) 8 | if(nargin==1) 9 | arg2=1; 10 | end 11 | randi(arg1,arg2); 12 | val=0; 13 | else 14 | if(nargin==0) 15 | val = randi(1e6)/(1e6); 16 | else 17 | if(nargin==1) 18 | if(length(arg1)>1) 19 | arg2=arg1(2); 20 | arg1=arg1(1); 21 | else 22 | arg2=arg1; 23 | end 24 | end 25 | val = randi(1e6,arg1,arg2)/1e6; 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/randi.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [num mv] = randi(arg1,arg2,arg3) 4 | 5 | num = -1; 6 | persistent x_i; 7 | persistent p1; 8 | persistent p2; 9 | if(isempty(x_i)) 10 | x_i = 1; 11 | p1 = 160481183; 12 | p2 = 179424673; 13 | end 14 | mv=p2; 15 | if(ischar(arg1)==1) 16 | if(strcmp(arg1,'seed')) 17 | if(nargin>1) 18 | x_i = arg2; 19 | num = 0; 20 | else 21 | x_i=1; 22 | num=0; 23 | end 24 | else 25 | 'Unrecognized option. The only accepted option to this random library is -seed-.' 26 | end 27 | else 28 | if(arg1>p2) 29 | 'Max too high, range cutoff at 1 million' 30 | end 31 | if(nargin>1) 32 | if(nargin==2) 33 | arg3=arg2; 34 | end 35 | num = zeros(arg2,arg3); 36 | for i=1:arg2 37 | for j = 1:arg3 38 | x_i = mod(x_i*(p1+1)+p1,p2); 39 | num(i,j) = mod(x_i,arg1)+1; 40 | end 41 | end 42 | else 43 | x_i = mod(x_i*(p1+1)+p1,p2); 44 | num=mod(x_i,arg1)+1; 45 | end 46 | end 47 | 48 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/smooth.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [YY] = smooth(Y,window) 4 | if(~exist('window','var')) 5 | window =5; 6 | end 7 | if(mod(window,2)==0) 8 | window = window+1; 9 | end 10 | mid = (window+1)/2; 11 | 12 | len = length(Y); 13 | Smoother =zeros(len); 14 | for i=1:len 15 | dev = min([mid-1 min([i-1 len-i])]); 16 | % dev 17 | Smoother(i,(i-dev):(i+dev))=1; 18 | end 19 | if(size(Y,2)>size(Y,1)) 20 | Y = Y'; 21 | end 22 | 23 | col = sum(Smoother,2); 24 | YY = Smoother*Y; 25 | YY = YY./col; 26 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5/submit_input.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5/submit_input.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m 8 | % Copyright (C) Daphne Koller, Stanford University, 2012 9 | 10 | function I = AssignmentToIndex(A, D) 11 | 12 | D = D(:)'; % ensure that D is a row vector 13 | if (any(size(A) == 1)), 14 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 15 | else 16 | I = sum(repmat(cumprod([1, D(1:end - 1)]), size(A, 1), 1) .* (A - 1), 2) + 1; 17 | end; 18 | 19 | end 20 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/.DS_Store -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/CheckConvergence.m: -------------------------------------------------------------------------------- 1 | % CHECKCONVERGENCE Ascertain whether the messages indicate that we have converged 2 | % converged = CHECKCONVERGENCE(MNEW,MOLD) compares lists of messages MNEW 3 | % and MOLD. If the values listed in any message differs by more than the 4 | % value 'thresh' then we determine that convergence has not occured and 5 | % return converged=0, otherwise we have converged and converged=1 6 | % 7 | % The 'message' data structure is an array of structs with the following 3 fields: 8 | % -.var: the variables covered in this message 9 | % -.card: the cardinalities of those variables 10 | % -.val: the value of the message w.r.t. the message's variables 11 | % 12 | % MNEW and MOLD are the message where M(i,j).val gives the values associated 13 | % with the message from cluster i to cluster j. 14 | % 15 | % Copyright (C) Daphne Koller, Stanford University, 2012 16 | 17 | function converged = CheckConvergence(mNew, mOld) 18 | 19 | thresh = 1.0e-6; 20 | 21 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/EdgeToFactorCorrespondence.m: -------------------------------------------------------------------------------- 1 | % Returns a matrix that maps edges to a list of factors in which both ends partake 2 | % 3 | % Copyright (C) Daphne Koller, Stanford University, 2012 4 | 5 | function E2F = EdgeToFactorCorrespondence(V, F) 6 | 7 | E2F = cell(length(V), length(V)); 8 | 9 | for f = 1:length(F) 10 | for i = 1:length(F(f).var) 11 | for j = i+1:length(F(f).var) 12 | u = F(f).var(i); 13 | v = F(f).var(j); 14 | E2F{u,v} = union(E2F{u,v}, f); 15 | E2F{v,u} = union(E2F{v,u}, f); 16 | end 17 | end 18 | end -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %GETVALUEOFASSIGNMENT Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GETVALUEOFASSIGNMENT(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GETVALUEOFASSIGNMENT(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SETVALUEOFASSIGNMENT 11 | % 12 | % Copyright (C) Daphne Koller, Stanford University, 2012 13 | 14 | function v = GetValueOfAssignment(F, A, VO); 15 | 16 | if (nargin == 2), 17 | indx = AssignmentToIndex(A, F.card); 18 | else 19 | map = zeros(length(F.var), 1); 20 | for i = 1:length(F.var), 21 | map(i) = find(VO == F.var(i)); 22 | end; 23 | indx = AssignmentToIndex(A(map), F.card); 24 | end; 25 | 26 | v = F.val(indx); 27 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/LogProbOfJointAssignment.m: -------------------------------------------------------------------------------- 1 | % Returns the log probability of an assignment A in a distribution defined by factors F 2 | % 3 | % Copyright (C) Daphne Koller, Stanford University, 2012 4 | 5 | function logp = LogProbOfJointAssignment(F, A) 6 | 7 | % work in log-space to prevent underflow 8 | logp = 0.0; 9 | for i = 1:length(F) 10 | logp = logp + log(GetValueOfAssignment(F(i), A, 1:length(A))); 11 | end 12 | 13 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/MHGibbsTrans.m: -------------------------------------------------------------------------------- 1 | % MHGIBBSTRANS 2 | % 3 | % MCMC Metropolis-Hastings transition function that 4 | % utilizes the Gibbs sampling distribution for proposals. 5 | % A - The current joint assignment. This should be 6 | % updated to be the next assignment 7 | % G - The network 8 | % F - List of all factors 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = MHGibbsTrans(A, G, F) 13 | 14 | % Draw proposed new state from Gibbs Transition distribution 15 | A_prop = GibbsTrans(A, G, F); 16 | 17 | % Compute acceptance probability 18 | p_acceptance = 1.0; 19 | 20 | % Accept or reject proposal 21 | if rand() < p_acceptance 22 | A = A_prop; 23 | end -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/MHUniformTrans.m: -------------------------------------------------------------------------------- 1 | % MHUNIFORMTRANS 2 | % 3 | % MCMC Metropolis-Hastings transition function that 4 | % utilizes the uniform proposal distribution. 5 | % A - The current joint assignment. This should be 6 | % updated to be the next assignment 7 | % G - The network 8 | % F - List of all factors 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = MHUniformTrans(A, G, F) 13 | 14 | % Draw proposed new state from uniform distribution 15 | A_prop = ceil(rand(1, length(A)) .* G.card); 16 | 17 | p_acceptance = 0.0; 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | % YOUR CODE HERE 20 | % Compute acceptance probability 21 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 22 | 23 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 24 | 25 | % Accept or reject proposal 26 | if rand() < p_acceptance 27 | % disp('Accepted'); 28 | A = A_prop; 29 | end -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/ProgrammingAssignment5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/ProgrammingAssignment5.pdf -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/SetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %SETVALUEOFASSIGNMENT Sets the value of a variable assignment in a factor. 2 | % 3 | % F = SETVALUEOFASSIGNMENT(F, A, v) sets the value of a variable assignment, 4 | % A, in factor F to v. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % F = SETVALUEOFASSIGNMENT(F, A, v, VO) sets the value of a variable 8 | % assignment, A, in factor F to v. The order of the variables in A are given 9 | % by the vector VO. 10 | % 11 | % See also GETVALUEOFASSIGNMENT 12 | % 13 | % Copyright (C) Daphne Koller, Stanford University, 2012 14 | 15 | function F = SetValueOfAssignment(F, A, v, VO); 16 | 17 | if (nargin == 3), 18 | indx = AssignmentToIndex(A, F.card); 19 | else 20 | map = zeros(length(F.var), 1); 21 | for i = 1:length(F.var), 22 | map(i) = find(VO == F.var(i)); 23 | end; 24 | indx = AssignmentToIndex(A(map), F.card); 25 | end; 26 | 27 | F.val(indx) = v; 28 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/VariableToFactorCorrespondence.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function V2F = VariableToFactorCorrespondence(V, F) 4 | 5 | V2F = cell(length(V), 1); 6 | 7 | for f = 1:length(F) 8 | for i = 1:length(F(f).var) 9 | v = F(f).var(i); 10 | V2F{v} = union(V2F{v}, f); 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/VisualizeToyImageMarginals.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function VisualizeToyImageMarginals(G, M, chain_num, tname) 4 | 5 | n = sqrt(length(G.names)); 6 | marginal_vector = []; 7 | for i = 1:length(M) 8 | marginal_vector(end+1) = M(i).val(1); 9 | end 10 | clims = [0, 1]; 11 | imagesc(reshape(marginal_vector, n, n), clims); 12 | colormap(gray); 13 | title(['Marginals for chain ' num2str(chain_num) ' ' tname]) -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/rand.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [val] = rand(arg1,arg2); 4 | val = -1; 5 | gran = 1e6; 6 | 7 | if(nargin>0&&ischar(arg1)) 8 | if(nargin==1) 9 | arg2=1; 10 | end 11 | randi(arg1,arg2); 12 | val=0; 13 | else 14 | if(nargin==0) 15 | val = randi(1e6)/(1e6); 16 | else 17 | if(nargin==1) 18 | if(length(arg1)>1) 19 | arg2=arg1(2); 20 | arg1=arg1(1); 21 | else 22 | arg2=arg1; 23 | end 24 | end 25 | val = randi(1e6,arg1,arg2)/1e6; 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/randi.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [num mv] = randi(arg1,arg2,arg3) 4 | 5 | num = -1; 6 | persistent x_i; 7 | persistent p1; 8 | persistent p2; 9 | if(isempty(x_i)) 10 | x_i = 1; 11 | p1 = 160481183; 12 | p2 = 179424673; 13 | end 14 | mv=p2; 15 | if(ischar(arg1)==1) 16 | if(strcmp(arg1,'seed')) 17 | if(nargin>1) 18 | x_i = arg2; 19 | num = 0; 20 | else 21 | x_i=1; 22 | num=0; 23 | end 24 | else 25 | 'Unrecognized option. The only accepted option to this random library is -seed-.' 26 | end 27 | else 28 | if(arg1>p2) 29 | 'Max too high, range cutoff at 1 million' 30 | end 31 | if(nargin>1) 32 | if(nargin==2) 33 | arg3=arg2; 34 | end 35 | num = zeros(arg2,arg3); 36 | for i=1:arg2 37 | for j = 1:arg3 38 | x_i = mod(x_i*(p1+1)+p1,p2); 39 | num(i,j) = mod(x_i,arg1)+1; 40 | end 41 | end 42 | else 43 | x_i = mod(x_i*(p1+1)+p1,p2); 44 | num=mod(x_i,arg1)+1; 45 | end 46 | end 47 | 48 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Backup/smooth.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [YY] = smooth(Y,window) 4 | if(~exist('window','var')) 5 | window =5; 6 | end 7 | if(mod(window,2)==0) 8 | window = window+1; 9 | end 10 | mid = (window+1)/2; 11 | 12 | len = length(Y); 13 | Smoother =zeros(len); 14 | for i=1:len 15 | dev = min([mid-1 min([i-1 len-i])]); 16 | % dev 17 | Smoother(i,(i-dev):(i+dev))=1; 18 | end 19 | if(size(Y,2)>size(Y,1)) 20 | Y = Y'; 21 | end 22 | 23 | col = sum(Smoother,2); 24 | YY = Smoother*Y; 25 | YY = YY./col; 26 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and SampleFactors.m 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = IndexToAssignment(I, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | A = mod(floor(repmat(I(:) - 1, 1, length(D)) ./ repmat(cumprod([1, D(1:end - 1)]), length(I), 1)), ... 16 | repmat(D, length(I), 1)) + 1; 17 | 18 | end 19 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Loopy BP Results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Loopy BP Results.png -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Residual BP Results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5_RBP/Residual BP Results.png -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/exampleIOPA5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5_RBP/exampleIOPA5.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/pgm_login_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5_RBP/pgm_login_data.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM-Programming_Assignment_5_RBP/submit_input.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM-Programming_Assignment_5_RBP/submit_input.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m and SampleFactors.m 8 | % 9 | % Copyright (C) Daphne Koller, Stanford University, 2012 10 | 11 | 12 | function I = AssignmentToIndex(A, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | if (any(size(A) == 1)), 16 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 17 | else 18 | I = sum(bsxfun(@times, A - 1, cumprod([1, D(1:end - 1)])), 2) + 1; 19 | end; 20 | 21 | end 22 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/ChooseTopSimilarityFactors.m: -------------------------------------------------------------------------------- 1 | function factors = ChooseTopSimilarityFactors (allFactors, F) 2 | % This function chooses the similarity factors with the highest similarity 3 | % out of all the possibilities. 4 | % 5 | % Input: 6 | % allFactors: An array of all the similarity factors. 7 | % F: The number of factors to select. 8 | % 9 | % Output: 10 | % factors: The F factors out of allFactors for which the similarity score 11 | % is highest. 12 | % 13 | % Hint: Recall that the similarity score for two images will be in every 14 | % factor table entry (for those two images' factor) where they are 15 | % assigned the same character value. 16 | % 17 | % Copyright (C) Daphne Koller, Stanford University, 2012 18 | 19 | % If there are fewer than F factors total, just return all of them. 20 | 21 | n = length(allFactors); 22 | if (n <= F) 23 | factors = allFactors; 24 | return; 25 | end 26 | 27 | factorVals = zeros(n, 1); 28 | for i = 1:n 29 | factorVals(i) = allFactors(i).val(1); 30 | end 31 | 32 | [~, idx] = sort(factorVals, 'descend'); 33 | 34 | factors = allFactors(idx(1:F)); 35 | 36 | end 37 | 38 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/ComputeAllSimilarityFactors.m: -------------------------------------------------------------------------------- 1 | function factors = ComputeAllSimilarityFactors (images, K) 2 | % This function computes all of the similarity factors for the images in 3 | % one word. 4 | % 5 | % Input: 6 | % images: An array of structs containing the 'img' value for each 7 | % character in the word. 8 | % K: The alphabet size (accessible in imageModel.K for the provided 9 | % imageModel). 10 | % 11 | % Output: 12 | % factors: Every similarity factor in the word. You should use 13 | % ComputeSimilarityFactor to compute these. 14 | % 15 | % Copyright (C) Daphne Koller, Stanford University, 2012 16 | 17 | n = length(images); 18 | nFactors = nchoosek (n, 2); 19 | 20 | factors = repmat(struct('var', [], 'card', [], 'val', []), nFactors, 1); 21 | 22 | idx = 1; 23 | for i = 1:n 24 | for j = (i+1):n 25 | factors(idx) = ComputeSimilarityFactor(images, K, i, j); 26 | idx = idx + 1; 27 | end 28 | end 29 | 30 | end 31 | 32 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/ComputeEqualPairwiseFactors.m: -------------------------------------------------------------------------------- 1 | function factors = ComputeEqualPairwiseFactors (images, K) 2 | % This function computes the pairwise factors for one word in which every 3 | % factor value is set to be 1. 4 | % 5 | % Input: 6 | % images: An array of structs containing the 'img' value for each 7 | % character in the word. 8 | % K: The alphabet size (accessible in imageModel.K for the provided 9 | % imageModel). 10 | % 11 | % Output: 12 | % factors: The pairwise factors for this word. Every entry in the factor 13 | % vals should be 1. 14 | % 15 | % Copyright (C) Daphne Koller, Stanford University, 2012 16 | 17 | n = length(images); 18 | 19 | factors = repmat(struct('var', [], 'card', [], 'val', []), n - 1, 1); 20 | 21 | for i = 1:n - 1 22 | factors(i).var = [i i + 1]; 23 | factors(i).card = [K K]; 24 | factors(i).val = ones(K^2, 1); 25 | 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/ComputeImageFactor.m: -------------------------------------------------------------------------------- 1 | function P = ComputeImageFactor (img, imgModel) 2 | % This function computes the singleton OCR factor values for a single 3 | % image. 4 | % 5 | % Input: 6 | % img: The 16x8 matrix of the image 7 | % imgModel: The provided, trained image model 8 | % 9 | % Output: 10 | % P: A K-by-1 array of the factor values for each of the K possible 11 | % character assignments to the given image 12 | % 13 | % Copyright (C) Daphne Koller, Stanford University, 2012 14 | 15 | X = img(:); 16 | N = length(X); 17 | K = imgModel.K; 18 | 19 | theta = reshape(imgModel.params(1:N*(K-1)), K-1, N); 20 | bias = reshape(imgModel.params((1+N*(K-1)):end), K-1, 1); 21 | 22 | W = [ bsxfun(@plus, theta * X, bias) ; 0 ]; 23 | W = bsxfun(@minus, W, max(W)); 24 | W = exp(W); 25 | 26 | P=bsxfun(@rdivide, W, sum(W)); 27 | 28 | 29 | end 30 | 31 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %GETVALUEOFASSIGNMENT Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GETVALUEOFASSIGNMENT(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GETVALUEOFASSIGNMENT(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SETVALUEOFASSIGNMENT 11 | 12 | % Copyright (C) Daphne Koller, Stanford University, 2012 13 | 14 | function v = GetValueOfAssignment(F, A, VO) 15 | 16 | if (nargin == 2), 17 | indx = AssignmentToIndex(A, F.card); 18 | else 19 | map = zeros(length(F.var), 1); 20 | for i = 1:length(F.var), 21 | map(i) = find(VO == F.var(i)); 22 | end; 23 | indx = AssignmentToIndex(A(map), F.card); 24 | end; 25 | 26 | v = F.val(indx); 27 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/ImageSimilarity.m: -------------------------------------------------------------------------------- 1 | function sim = ImageSimilarity (im1, im2) 2 | % This function computes the "similarity score" between two images. You 3 | % should use the value for the similarity factor value when the two images 4 | % are assigned the same character. 5 | % 6 | % Input: 7 | % im1, im2: Two images from the provided dataset (they should be 16x8 8 | % matrices of 0s and 1s). 9 | % 10 | % Output: 11 | % sim: The similarity score of those images. 12 | % 13 | % Copyright (C) Daphne Koller, Stanford University, 2012 14 | 15 | a = im1(:); 16 | b = im2(:); 17 | 18 | meanSim = 0.283; % Avg sim score computed over held-out data. 19 | 20 | cosDist = (a' * b) / (norm(a) * norm(b)); 21 | 22 | diff = (cosDist - meanSim) ^ 2; 23 | 24 | if (cosDist > meanSim) 25 | sim = 1 + 5*diff; 26 | else 27 | sim = 1 / (1 + 5*diff); 28 | end 29 | 30 | end 31 | 32 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = IndexToAssignment(I, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | A = bsxfun(@mod, floor(bsxfun(@rdivide, I(:) - 1, cumprod([1, D(1:end - 1)]))), D) + 1; 16 | 17 | end 18 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/PA3Data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_3/PA3Data.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/PA3Description.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_3/PA3Description.pdf -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/PA3Models.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_3/PA3Models.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/PA3SampleCases.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_3/PA3SampleCases.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/PA3TestCases.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_3/PA3TestCases.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/Results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_3/Results.png -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/SetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %SETVALUEOFASSIGNMENT Sets the value of a variable assignment in a factor. 2 | % 3 | % F = SETVALUEOFASSIGNMENT(F, A, v) sets the value of a variable assignment, 4 | % A, in factor F to v. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % F = SETVALUEOFASSIGNMENT(F, A, v, VO) sets the value of a variable 8 | % assignment, A, in factor F to v. The order of the variables in A are given 9 | % by the vector VO. 10 | % 11 | % See also GETVALUEOFASSIGNMENT 12 | 13 | % Copyright (C) Daphne Koller, Stanford University, 2012 14 | 15 | function F = SetValueOfAssignment(F, A, v, VO) 16 | 17 | if (nargin == 3), 18 | indx = AssignmentToIndex(A, F.card); 19 | else 20 | map = zeros(length(F.var), 1); 21 | for i = 1:length(F.var), 22 | map(i) = find(VO == F.var(i)); 23 | end; 24 | indx = AssignmentToIndex(A(map), F.card); 25 | end; 26 | 27 | F.val(indx) = v; 28 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/VisualizeWord.m: -------------------------------------------------------------------------------- 1 | function VisualizeWord (word) 2 | % This function allows you to visualize the characters for a single word. 3 | % 4 | % Input: 5 | % word: A struct array, each with an 'img' attribute that gives the 16x8 6 | % pixel matrix for that image. 7 | % 8 | % Copyright (C) Daphne Koller, Stanford University, 2012 9 | 10 | padding = zeros(size(word(1).img, 1), 1); 11 | 12 | totalWidth = 10 * length(word); 13 | im = zeros(16, totalWidth); 14 | for i = 1:length(word) 15 | charIm = [padding word(i).img padding]; 16 | im(:, (1 + 10 * (i-1)) + (1:10)) = charIm; 17 | end 18 | 19 | width = size(im, 2); 20 | padding = zeros(1, width); 21 | im = [padding; im; padding]; 22 | 23 | figure; 24 | colormap(gray); 25 | imagesc(1 - im); 26 | axis equal; 27 | [height, width] = size(im); 28 | axis([0 width 0 height]); 29 | 30 | end 31 | 32 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/inf.log: -------------------------------------------------------------------------------- 1 | Starting BP[tol=1e-009,maxiter=10000,maxtime=1.#INF,verbose=1,logdomain=1,updates=SEQMAX,damping=0,inference=SUMPROD]...converged in 11 passes (-50.024 seconds). 2 | LBP posterior decoding (highest prob assignment in marginal): 3 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/inference/doinference-linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_3/inference/doinference-linux -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/inference/doinference-mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_3/inference/doinference-mac -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/inference/doinference.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_3/inference/doinference.exe -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/inference/inf.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_3/inference/inf.log -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/inference/inference-src.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_3/inference/inference-src.zip -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_3/submitWeb.m: -------------------------------------------------------------------------------- 1 | % submitWeb Creates files from your code and output for web submission. 2 | % 3 | % If the submit function does not work for you, use the web-submission mechanism. 4 | % Call this function to produce a file for the part you wish to submit. Then, 5 | % submit the file to the class servers using the "Web Submission" button on the 6 | % Programming Assignments page on the course website. 7 | % 8 | % Copyright (C) Daphne Koller, Stanford University, 2012 9 | 10 | function submitWeb(partId) 11 | if ~exist('partId', 'var') || isempty(partId) 12 | partId = []; 13 | end 14 | 15 | submit(partId, 1); 16 | end 17 | 18 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m 8 | % 9 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 10 | 11 | function I = AssignmentToIndex(A, D) 12 | 13 | D = D(:)'; % ensure that D is a row vector 14 | if (any(size(A) == 1)), 15 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 16 | else 17 | I = sum(bsxfun(@times, A - 1, cumprod([1, D(1:end - 1)])), 2) + 1; 18 | end; 19 | 20 | end 21 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/CRFPredict.m: -------------------------------------------------------------------------------- 1 | function predictions = CRFPredict(X, theta, modelParams) 2 | featureSet = GenerateAllFeatures(X, modelParams); 3 | 4 | P = ConstructCliqueTree(X, theta, modelParams, featureSet); 5 | P = CliqueTreeCalibrate(P, 1); 6 | 7 | M = ComputeMarginals(size(X, 1), P, 1); 8 | predictions = MaxDecoding(M); 9 | end -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/CRFTest.m: -------------------------------------------------------------------------------- 1 | 2 | theta = zeros(1, 2366); 3 | maxEpoch = 5; 4 | 5 | modelParams.numHiddenStates = 26; 6 | modelParams.numObservedStates = 2; 7 | modelParams.lambda = 0.003; 8 | 9 | [loglik theta] = CRFTrain(trainData, theta, maxEpoch, modelParams); 10 | 11 | plot(1:length(loglik), loglik); 12 | xlabel('iter') 13 | ylabel('negative log-likelihood') 14 | title('Negative log-likelihood vs. iterations') 15 | 16 | [trainCharAccuracy trainWordAccuracy] ... 17 | = ComputePredictionAccuracy(trainData, theta, modelParams); 18 | 19 | disp('Test set accuracy') 20 | disp([' Char accuracy: ', num2str(trainCharAccuracy)]) 21 | disp([' Word accuracy: ', num2str(trainWordAccuracy)]) 22 | 23 | [testCharAccuracy testWordAccuracy] ... 24 | = ComputePredictionAccuracy(testData, theta, modelParams); 25 | 26 | disp('Test set accuracy') 27 | disp([' Char accuracy: ', num2str(testCharAccuracy)]) 28 | disp([' Word accuracy: ', num2str(testWordAccuracy)]) -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/CRFTrain.m: -------------------------------------------------------------------------------- 1 | function [logliks theta] = CRFTrain(trainData, theta, maxEpoch, modelParams) 2 | 3 | nObs = length(trainData); 4 | logliks = zeros(1, nObs*maxEpoch); 5 | 6 | for i = 1:maxEpoch 7 | for k = 1:nObs 8 | [loglik grad] = InstanceNegLogLikelihood(trainData(k).X, trainData(k).y, theta, modelParams); 9 | 10 | alpha = 1 / (1 + 0.05*k); 11 | theta = theta - alpha * grad; 12 | 13 | logliks( (i-1)*nObs + k ) = loglik; 14 | 15 | if mod(k, 10) == 0 16 | disp(['Epoch: ', num2str(i), ', samples: ', num2str(k)]); 17 | end 18 | end 19 | end 20 | end -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/ComputeJointDistribution.m: -------------------------------------------------------------------------------- 1 | %ComputeJointDistribution Computes the joint distribution defined by a set 2 | % of given factors 3 | % 4 | % Joint = ComputeJointDistribution(F) computes the joint distribution 5 | % defined by a set of given factors 6 | % 7 | % Joint is a factor that encapsulates the joint distribution given by F 8 | % F is a vector of factors (struct array) containing the factors 9 | % defining the distribution 10 | % 11 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 12 | 13 | function Joint = ComputeJointDistribution(F) 14 | 15 | % Check for empty factor list 16 | assert(numel(F) ~= 0, 'Error: empty factor list'); 17 | 18 | if (length(F) == 0) 19 | % There are no factors, so create an empty factor list 20 | Joint = struct('var', [], 'card', [], 'val', []); 21 | else 22 | Joint = F(1); 23 | for i = 2:length(F) 24 | % Iterate through factors and incorporate them into the joint distribution 25 | Joint = FactorProduct(Joint, F(i)); 26 | end 27 | end 28 | end 29 | 30 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/ComputeMarginal.m: -------------------------------------------------------------------------------- 1 | %ComputeMarginal Computes the marginal over a set of given variables 2 | % M = ComputeMarginal(V, F, E) computes the marginal over variables V 3 | % in the distribution induced by the set of factors F, given evidence E 4 | % 5 | % M is a factor containing the marginal over variables V 6 | % V is a vector containing the variables in the marginal e.g. [1 2 3] for 7 | % X_1, X_2 and X_3. 8 | % F is a vector of factors (struct array) containing the factors 9 | % defining the distribution 10 | % E is an N-by-2 matrix, each row being a variable/value pair. 11 | % Variables are in the first column and values are in the second column. 12 | % 13 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 14 | 15 | function M = ComputeMarginal(V, F, E) 16 | 17 | % Check for empty factor list 18 | assert(numel(F) ~= 0, 'Error: empty factor list'); 19 | 20 | F = ObserveEvidence(F, E); 21 | Joint = ComputeJointDistribution(F); 22 | Joint.val = Joint.val ./ sum(Joint.val); 23 | M = FactorMarginalization(Joint, setdiff(Joint.var, V)); 24 | end 25 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/ComputeMarginals.m: -------------------------------------------------------------------------------- 1 | function M = ComputeMarginals(nVar, P, isMax) 2 | 3 | M = repmat(struct('var', [], 'card', [], 'val', []), length(P.cliqueList), 1); 4 | for iVar = 1:nVar 5 | for iClq = 1:length(P.cliqueList) 6 | 7 | if any(P.cliqueList(iClq).var == iVar) 8 | 9 | marginalisedVars = setdiff(P.cliqueList(iClq).var, iVar); 10 | if isMax 11 | M(iVar) = FactorMaxMarginalization(P.cliqueList(iClq), marginalisedVars); 12 | else 13 | M(iVar) = FactorMarginalization(P.cliqueList(iClq), marginalisedVars); 14 | M(iVar).val = M(iVar).val / sum(M(iVar).val); 15 | end 16 | 17 | break; 18 | end 19 | end 20 | 21 | end 22 | end -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/ComputePredictionAccuracy.m: -------------------------------------------------------------------------------- 1 | function [charAccuracy wordAccuracy] ... 2 | = ComputePredictionAccuracy(testData, theta, modelParams) 3 | 4 | nCharCorrect = 0; 5 | nCharTotal = 0; 6 | 7 | nWordCorrect = 0; 8 | nWordTotal = 0; 9 | 10 | for i = 1:length(testData) 11 | predictions = CRFPredict(testData(i).X, theta, modelParams); 12 | 13 | nCorrect = sum(predictions == testData(i).y); 14 | 15 | nCharCorrect = nCharCorrect + nCorrect; 16 | nCharTotal = nCharTotal + length(testData(i).y); 17 | 18 | if nCorrect == length(testData(i).y) 19 | nWordCorrect = nWordCorrect + 1; 20 | end 21 | 22 | nWordTotal = nWordTotal + 1; 23 | 24 | if mod(i, 10) == 0 25 | disp(['samples: ', num2str(i)]); 26 | end 27 | end 28 | 29 | charAccuracy = nCharCorrect / nCharTotal; 30 | wordAccuracy = nWordCorrect / nWordTotal; 31 | 32 | end -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/ComputeUnconditionedPairFeatures.m: -------------------------------------------------------------------------------- 1 | function features = ComputeUnconditionedPairFeatures (len, modelParams) 2 | % Creates indicator features on assignments to adjacent variables in the 3 | % sequence. 4 | % 5 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 6 | 7 | if (len < 2) 8 | features = []; 9 | return; 10 | end 11 | 12 | K = modelParams.numHiddenStates; 13 | nPairFeatures = (len - 1) * K * K; 14 | 15 | features(nPairFeatures) = EmptyFeatureStruct(); 16 | 17 | featureIdx = 0; 18 | for s1 = 1:K 19 | for s2 = 1:K 20 | paramVal = sub2ind([K K], s2, s1); 21 | for v = 1:(len - 1) 22 | featureIdx = featureIdx + 1; 23 | features(featureIdx).var = [v v+1]; 24 | features(featureIdx).assignment = [s1 s2]; 25 | features(featureIdx).paramIdx = paramVal; 26 | end 27 | end 28 | end 29 | 30 | 31 | end 32 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/ComputeUnconditionedSingletonFeatures.m: -------------------------------------------------------------------------------- 1 | function features = ComputeUnconditionedSingletonFeatures (len, modelParams) 2 | % Creates indicator features on assignments to single variables in the 3 | % sequence. 4 | % 5 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 6 | 7 | nSingleFeatures = len * modelParams.numHiddenStates; 8 | features(nSingleFeatures) = EmptyFeatureStruct(); 9 | 10 | K = modelParams.numHiddenStates; 11 | featureIdx = 0; 12 | 13 | for st = 1:K 14 | paramVal = st; 15 | for v = 1:len 16 | featureIdx = featureIdx + 1; 17 | features(featureIdx).var = v; 18 | features(featureIdx).assignment = st; 19 | features(featureIdx).paramIdx = paramVal; 20 | 21 | end 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/EmptyFactorStruct.m: -------------------------------------------------------------------------------- 1 | function f = EmptyFactorStruct 2 | % Dummy function for the factor struct. 3 | % 4 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 5 | 6 | f = struct ('var', [], 'card', [], 'val', []); 7 | 8 | end 9 | 10 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/EmptyFeatureStruct.m: -------------------------------------------------------------------------------- 1 | function s = EmptyFeatureStruct 2 | % Dummy function for the feature struct. 3 | % 4 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 5 | 6 | s = struct('var', [], 'assignment', [], 'paramIdx', []); 7 | 8 | end 9 | 10 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %GETVALUEOFASSIGNMENT Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GETVALUEOFASSIGNMENT(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GETVALUEOFASSIGNMENT(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SETVALUEOFASSIGNMENT 11 | 12 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 13 | 14 | function v = GetValueOfAssignment(F, A, VO) 15 | 16 | if (nargin == 2), 17 | indx = AssignmentToIndex(A, F.card); 18 | else 19 | map = zeros(length(F.var), 1); 20 | for i = 1:length(F.var), 21 | map(i) = find(VO == F.var(i)); 22 | end; 23 | indx = AssignmentToIndex(A(map), F.card); 24 | end; 25 | 26 | v = F.val(indx); 27 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and SampleFactors.m 9 | % 10 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 11 | 12 | function A = IndexToAssignment(I, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | A = bsxfun(@mod, floor(bsxfun(@rdivide, I(:) - 1, cumprod([1, D(1:end - 1)]))), D) + 1; 16 | 17 | end 18 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/LRAccuracy.m: -------------------------------------------------------------------------------- 1 | % function acc = LRAccuracy(GroundTruth, Predictions) compares the 2 | % vector of predictions with the vector of ground truth values, 3 | % and returns the accuracy (fraction of predictions that are correct). 4 | % 5 | % Input: 6 | % GroundTruth (numInstances x 1 vector) 7 | % Predictions (numInstances x 1 vector) 8 | % 9 | % Output: 10 | % err (scalar between 0 and 1 inclusive) 11 | % 12 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 13 | 14 | function acc = LRAccuracy(GroundTruth, Predictions) 15 | 16 | GroundTruth = GroundTruth(:); 17 | Predictions = Predictions(:); 18 | assert(all(size(GroundTruth) == size(Predictions))); 19 | 20 | acc = mean(GroundTruth == Predictions); 21 | 22 | end 23 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/LRPredict.m: -------------------------------------------------------------------------------- 1 | % pred = LRPredict(X, theta) uses the LR classifier encoded by theta 2 | % to predict the labels on data X. 3 | % 4 | % Inputs: 5 | % X data. (numInstances x numFeatures matrix) 6 | % theta LR parameters. (numFeatures x 1 vector) 7 | % 8 | % Outputs: 9 | % pred predicted labels for X. (numInstances x 1 binary vector). 10 | % 11 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 12 | 13 | function pred = LRPredict (X, theta) 14 | 15 | thresh = 0.5; 16 | h = sigmoid (X * theta); 17 | pred = h > thresh; 18 | 19 | end 20 | 21 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/MaxDecoding.m: -------------------------------------------------------------------------------- 1 | %MAXDECODING Finds the best assignment for each variable from the marginals 2 | %passed in. Returns A such that A(i) returns the index of the best 3 | %instantiation for variable i. 4 | % 5 | % For instance: Let's say we have two variables 1 and 2. 6 | % Marginals for 1 = [0.1, 0.3, 0.6] 7 | % Marginals for 2 = [0.92, 0.08] 8 | % A(1) = 3, A(2) = 1. 9 | % 10 | % See also COMPUTEEXACTMARGINALSBP 11 | 12 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 13 | 14 | function A = MaxDecoding( M ) 15 | 16 | % Compute the best assignment for variables in the network. 17 | A = zeros(1, length(M)); 18 | for i = 1:length(M) 19 | % Iterate through variables 20 | [maxVal, idx] = max(M(i).val); 21 | A(i) = idx; 22 | end 23 | 24 | end 25 | 26 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/NumParamsForConditionedFeatures.m: -------------------------------------------------------------------------------- 1 | function n = NumParamsForConditionedFeatures (features, numObservedStates) 2 | % Number of parameters "consumed" by a set of conditioned features. 3 | % 4 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 5 | 6 | maxParam = max([features.paramIdx]); 7 | n = maxParam + numObservedStates - 1 - mod(maxParam - 1, numObservedStates); 8 | 9 | end 10 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/NumParamsForUnconditionedFeatures.m: -------------------------------------------------------------------------------- 1 | function n = NumParamsForUnconditionedFeatures (features) 2 | % Number of parameters "consumed" by a set of unconditioned features. 3 | % 4 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 5 | 6 | n = max([features.paramIdx]); 7 | 8 | end 9 | 10 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/PA7Description.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/PA7Description.pdf -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Part1Lambdas.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Part1Lambdas.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Part2FullDataset.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Part2FullDataset.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Part2LogZTest.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Part2LogZTest.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Part2Sample.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Part2Sample.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Part2Test.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Part2Test.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/SetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %SETVALUEOFASSIGNMENT Sets the value of a variable assignment in a factor. 2 | % 3 | % F = SETVALUEOFASSIGNMENT(F, A, v) sets the value of a variable assignment, 4 | % A, in factor F to v. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % F = SETVALUEOFASSIGNMENT(F, A, v, VO) sets the value of a variable 8 | % assignment, A, in factor F to v. The order of the variables in A are given 9 | % by the vector VO. 10 | % 11 | % See also GETVALUEOFASSIGNMENT 12 | 13 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 14 | 15 | function F = SetValueOfAssignment(F, A, v, VO); 16 | 17 | if (nargin == 3), 18 | indx = AssignmentToIndex(A, F.card); 19 | else 20 | map = zeros(length(F.var), 1); 21 | for i = 1:length(F.var), 22 | map(i) = find(VO == F.var(i)); 23 | end; 24 | indx = AssignmentToIndex(A(map), F.card); 25 | end; 26 | 27 | F.val(indx) = v; 28 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Test1X.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Test1X.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Test1Y.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Test1Y.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Train1X.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Train1X.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Train1Y.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Train1Y.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Train2X.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Train2X.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Train2Y.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Train2Y.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Validation1X.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Validation1X.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Validation1Y.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Validation1Y.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Validation2X.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Validation2X.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/Validation2Y.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/Validation2Y.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/ValidationAccuracy.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/ValidationAccuracy.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/VisualizeCharacters.m: -------------------------------------------------------------------------------- 1 | function VisualizeCharacters (X) 2 | % VisualizeCharacters(X) displays the characters of observation X. The 3 | % input X should be a numCharacters x 32 matrix, since each character is 4 | % 8x4 and is stored in one row. The entries are 1's and 2's corresponding 5 | % to white and black pixels, respectively. This is the format of the 6 | % provided data for PA7, so this function should "just work" on the 7 | % provided data. 8 | % 9 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 10 | 11 | if (~isequal(size(X, 2), 32)) 12 | error('Input to VisualizeCharacters.m of incorrect size.'); 13 | end 14 | 15 | if (any(X(:) == 2)) 16 | X = X - 1; 17 | end 18 | 19 | len = size(X, 1); 20 | totalWidth = 5 * len + 1; 21 | 22 | im = zeros(8, totalWidth); 23 | for i = 1:len 24 | charIm = reshape(X(i,:), 8, 4); 25 | im(:, (2:5) + (5 * (i-1))) = charIm; 26 | end 27 | 28 | figure; 29 | colormap(gray); 30 | imagesc(1 - im); 31 | axis equal; 32 | [height, width] = size(im); 33 | axis([0 width 0 height]); 34 | 35 | end 36 | 37 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/pgm_login_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByEdisonGuo/PGM_Programming_Assignment_7/pgm_login_data.mat -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/sigmoid.m: -------------------------------------------------------------------------------- 1 | function s = sigmoid (z) 2 | % Sigmoid function (scalar or element-wise) 3 | % 4 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 5 | 6 | s = 1 ./ (1 + exp (-z)); 7 | 8 | end 9 | -------------------------------------------------------------------------------- /ByEdisonGuo/PGM_Programming_Assignment_7/submitWeb.m: -------------------------------------------------------------------------------- 1 | % submitWeb Creates files from your code and output for web submission. 2 | % 3 | % If the submit function does not work for you, use the web-submission mechanism. 4 | % Call this function to produce a file for the part you wish to submit. Then, 5 | % submit the file to the class servers using the "Web Submission" button on the 6 | % Programming Assignments page on the course website. 7 | % 8 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 9 | 10 | function submitWeb(partId) 11 | if ~exist('partId', 'var') || isempty(partId) 12 | partId = []; 13 | end 14 | 15 | submit(partId, 1); 16 | end 17 | 18 | -------------------------------------------------------------------------------- /ByJimmyLin/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/PGM-Programming_Assignment_1/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/PGM-Programming_Assignment_1/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/PGM-Programming_Assignment_1/.FactorTutorial.m.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/PGM-Programming_Assignment_1/.FactorTutorial.m.swp -------------------------------------------------------------------------------- /ByJimmyLin/PGM-Programming_Assignment_1/228_login_data.mat: -------------------------------------------------------------------------------- 1 | # Created by Octave 3.6.4, Tue Apr 09 01:50:37 2013 PDT 2 | # name: login 3 | # type: sq_string 4 | # elements: 1 5 | # length: 20 6 | beyang.liu@gmail.com 7 | 8 | 9 | # name: password 10 | # type: sq_string 11 | # elements: 1 12 | # length: 10 13 | QytuJr8vx8 14 | 15 | 16 | -------------------------------------------------------------------------------- /ByJimmyLin/PGM-Programming_Assignment_1/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m and FactorTutorial.m 8 | 9 | function I = AssignmentToIndex(A, D) 10 | 11 | D = D(:)'; % ensure that D is a row vector 12 | if (any(size(A) == 1)), 13 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 14 | else 15 | I = sum(repmat(cumprod([1, D(1:end - 1)]), size(A, 1), 1) .* (A - 1), 2) + 1; 16 | end; 17 | 18 | end 19 | -------------------------------------------------------------------------------- /ByJimmyLin/PGM-Programming_Assignment_1/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | % GetValueOfAssignment Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GetValueOfAssignment(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GetValueOfAssignment(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SetValueOfAssignment.m and FactorTutorial.m 11 | 12 | function v = GetValueOfAssignment(F, A, VO) 13 | 14 | if (nargin == 2), 15 | indx = AssignmentToIndex(A, F.card); 16 | else 17 | map = zeros(length(F.var), 1); 18 | for i = 1:length(F.var), 19 | map(i) = find(VO == F.var(i)); 20 | end; 21 | indx = AssignmentToIndex(A(map), F.card); 22 | end; 23 | 24 | v = F.val(indx); 25 | 26 | end 27 | -------------------------------------------------------------------------------- /ByJimmyLin/PGM-Programming_Assignment_1/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and FactorTutorial.m 9 | 10 | function A = IndexToAssignment(I, D) 11 | 12 | D = D(:)'; % ensure that D is a row vector 13 | A = mod(floor(repmat(I(:) - 1, 1, length(D)) ./ repmat(cumprod([1, D(1:end - 1)]), length(I), 1)), ... 14 | repmat(D, length(I), 1)) + 1; 15 | 16 | end 17 | -------------------------------------------------------------------------------- /ByJimmyLin/PGM-Programming_Assignment_1/PGM_Programming_Assignment_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/PGM-Programming_Assignment_1/PGM_Programming_Assignment_1.pdf -------------------------------------------------------------------------------- /ByJimmyLin/PGM-Programming_Assignment_1/TestFactorMarginalization.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/PGM-Programming_Assignment_1/TestFactorMarginalization.m -------------------------------------------------------------------------------- /ByJimmyLin/PGM-Programming_Assignment_1/TestFactorProduct.m: -------------------------------------------------------------------------------- 1 | function TestFactorProduct 2 | % Load the test data first 3 | % FACTORS.INPUT(1) contains P(X_1) 4 | FACTORS.INPUT(1) = struct('var', [1], 'card', [2], 'val', [0.11, 0.89]); 5 | 6 | % FACTORS.INPUT(2) contains P(X_2 | X_1) 7 | FACTORS.INPUT(2) = struct('var', [2, 1], 'card', [2, 2], 'val', [0.59, 0.41, 0.22, 0.78]); 8 | 9 | % Execute the FactorProduct module 10 | FACTORS.PRODUCT = FactorProduct(FACTORS.INPUT(1), FACTORS.INPUT(2)); 11 | 12 | % Test suites 13 | FLT_EPSILON = 1e-6 ; 14 | assert(all(FACTORS.PRODUCT.var == [1 2]), 'VARIABLE element test failed..') ; 15 | assert(all(FACTORS.PRODUCT.card == [2 2]), 'CARDINALITY element test failed..') ; 16 | assert(all(FACTORS.PRODUCT.val >= (1 - FLT_EPSILON) * [0.0649, 0.1958, 0.0451, 0.6942]), 'VALUE element test failed..') ; 17 | assert(all(FACTORS.PRODUCT.val <= (1 + FLT_EPSILON) * [0.0649, 0.1958, 0.0451, 0.6942]), 'VALUE element test failed..') ; 18 | disp('Congratulations. All tests suites passed..') 19 | -------------------------------------------------------------------------------- /ByJimmyLin/PGM-Programming_Assignment_1/submitWeb.m: -------------------------------------------------------------------------------- 1 | % submitWeb Creates files from your code and output for web submission. 2 | % 3 | % If the submit function does not work for you, use the web-submission mechanism. 4 | % Call this function to produce a file for the part you wish to submit. Then, 5 | % submit the file to the class servers using the "Web Submission" button on the 6 | % Programming Assignments page on the course website. 7 | % 8 | % You should call this function without arguments (submitWeb), to receive 9 | % an interactive prompt for submission; optionally you can call it with the partID 10 | % if you so wish. Make sure your working directory is set to the directory 11 | % containing the submitWeb.m file and your assignment files. 12 | 13 | function submitWeb(partId) 14 | if ~exist('partId', 'var') || isempty(partId) 15 | partId = []; 16 | end 17 | 18 | submit(partId, 1); 19 | end 20 | 21 | -------------------------------------------------------------------------------- /ByJimmyLin/PGM-Programming_Assignment_1/submit_input.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/PGM-Programming_Assignment_1/submit_input.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn1/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/.FactorTutorial.m.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn1/.FactorTutorial.m.swp -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/.ObserveEvidence.m.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn1/.ObserveEvidence.m.swp -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/228_login_data.mat: -------------------------------------------------------------------------------- 1 | # Created by Octave 3.6.4, Tue Apr 09 01:50:37 2013 PDT 2 | # name: login 3 | # type: sq_string 4 | # elements: 1 5 | # length: 20 6 | beyang.liu@gmail.com 7 | 8 | 9 | # name: password 10 | # type: sq_string 11 | # elements: 1 12 | # length: 10 13 | QytuJr8vx8 14 | 15 | 16 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m and FactorTutorial.m 8 | 9 | function I = AssignmentToIndex(A, D) 10 | 11 | D = D(:)'; % ensure that D is a row vector 12 | if (any(size(A) == 1)), 13 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 14 | else 15 | I = sum(repmat(cumprod([1, D(1:end - 1)]), size(A, 1), 1) .* (A - 1), 2) + 1; 16 | end; 17 | 18 | end 19 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | % GetValueOfAssignment Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GetValueOfAssignment(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GetValueOfAssignment(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SetValueOfAssignment.m and FactorTutorial.m 11 | 12 | function v = GetValueOfAssignment(F, A, VO) 13 | 14 | if (nargin == 2), 15 | indx = AssignmentToIndex(A, F.card); 16 | else 17 | map = zeros(length(F.var), 1); 18 | for i = 1:length(F.var), 19 | map(i) = find(VO == F.var(i)); 20 | end; 21 | indx = AssignmentToIndex(A(map), F.card); 22 | end; 23 | 24 | v = F.val(indx); 25 | 26 | end 27 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and FactorTutorial.m 9 | 10 | function A = IndexToAssignment(I, D) 11 | 12 | D = D(:)'; % ensure that D is a row vector 13 | A = mod(floor(repmat(I(:) - 1, 1, length(D)) ./ repmat(cumprod([1, D(1:end - 1)]), length(I), 1)), ... 14 | repmat(D, length(I), 1)) + 1; 15 | 16 | end 17 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/PGM_Programming_Assignment_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn1/PGM_Programming_Assignment_1.pdf -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/TestFactorMarginalization.m: -------------------------------------------------------------------------------- 1 | function TestFactorMarginalization() 2 | % FACTORS.INPUT(2) contains P(X_2 | X_1) 3 | FACTORS.INPUT(2) = struct('var', [2, 1], 'card', [2, 2], 'val', [0.59, 0.41, 0.22, 0.78]); 4 | 5 | % execute the marginalisation 6 | FACTORS.MARGINALIZATION = FactorMarginalization(FACTORS.INPUT(2), [2]); 7 | 8 | x = FACTORS.MARGINALIZATION 9 | 10 | % test suites 11 | assert( x.var == [1], 'Test 1 failed' ) 12 | assert( x.card == [2], 'Test 1 failed' ) 13 | assert( all(x.val == [1 1]), 'Test 1 failed' ) 14 | disp('Test 1 passed..') 15 | 16 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/TestFactorProduct.m: -------------------------------------------------------------------------------- 1 | function TestFactorProduct 2 | % Load the test data first 3 | % FACTORS.INPUT(1) contains P(X_1) 4 | FACTORS.INPUT(1) = struct('var', [1], 'card', [2], 'val', [0.11, 0.89]); 5 | 6 | % FACTORS.INPUT(2) contains P(X_2 | X_1) 7 | FACTORS.INPUT(2) = struct('var', [2, 1], 'card', [2, 2], 'val', [0.59, 0.41, 0.22, 0.78]); 8 | 9 | % Execute the FactorProduct module 10 | FACTORS.PRODUCT = FactorProduct(FACTORS.INPUT(1), FACTORS.INPUT(2)); 11 | 12 | % Test suites 13 | FLT_EPSILON = 1e-6 ; 14 | assert(all(FACTORS.PRODUCT.var == [1 2]), 'VARIABLE element test failed..') ; 15 | assert(all(FACTORS.PRODUCT.card == [2 2]), 'CARDINALITY element test failed..') ; 16 | assert(all(FACTORS.PRODUCT.val >= (1 - FLT_EPSILON) * [0.0649, 0.1958, 0.0451, 0.6942]), 'VALUE element test failed..') ; 17 | assert(all(FACTORS.PRODUCT.val <= (1 + FLT_EPSILON) * [0.0649, 0.1958, 0.0451, 0.6942]), 'VALUE element test failed..') ; 18 | disp('Congratulations. All tests suites passed..') 19 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/submitWeb.m: -------------------------------------------------------------------------------- 1 | % submitWeb Creates files from your code and output for web submission. 2 | % 3 | % If the submit function does not work for you, use the web-submission mechanism. 4 | % Call this function to produce a file for the part you wish to submit. Then, 5 | % submit the file to the class servers using the "Web Submission" button on the 6 | % Programming Assignments page on the course website. 7 | % 8 | % You should call this function without arguments (submitWeb), to receive 9 | % an interactive prompt for submission; optionally you can call it with the partID 10 | % if you so wish. Make sure your working directory is set to the directory 11 | % containing the submitWeb.m file and your assignment files. 12 | 13 | function submitWeb(partId) 14 | if ~exist('partId', 'var') || isempty(partId) 15 | partId = []; 16 | end 17 | 18 | submit(partId, 1); 19 | end 20 | 21 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn1/submit_input.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn1/submit_input.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn2/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m and SampleFactors.m 8 | 9 | function I = AssignmentToIndex(A, D) 10 | 11 | D = D(:)'; % ensure that D is a row vector 12 | if (any(size(A) == 1)), 13 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 14 | else 15 | I = sum(repmat(cumprod([1, D(1:end - 1)]), size(A, 1), 1) .* (A - 1), 2) + 1; 16 | end; 17 | 18 | end 19 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | % GetValueOfAssignment Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GetValueOfAssignment(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GetValueOfAssignment(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SetValueOfAssignment.m and SampleFactors.m 11 | 12 | function v = GetValueOfAssignment(F, A, VO) 13 | 14 | if (nargin == 2), 15 | indx = AssignmentToIndex(A, F.card); 16 | else 17 | map = zeros(length(F.var), 1); 18 | for i = 1:length(F.var), 19 | map(i) = find(VO == F.var(i)); 20 | end; 21 | indx = AssignmentToIndex(A(map), F.card); 22 | end; 23 | 24 | v = F.val(indx); 25 | 26 | end 27 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and SampleFactors.m 9 | 10 | function A = IndexToAssignment(I, D) 11 | 12 | D = D(:)'; % ensure that D is a row vector 13 | A = mod(floor(repmat(I(:) - 1, 1, length(D)) ./ repmat(cumprod([1, D(1:end - 1)]), length(I), 1)), ... 14 | repmat(D, length(I), 1)) + 1; 15 | 16 | end 17 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/PA2Appendix.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn2/PA2Appendix.pdf -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/PA2Description.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn2/PA2Description.pdf -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/childCopyGivenFreqsFactor.m: -------------------------------------------------------------------------------- 1 | function geneCopyFactor = childCopyGivenFreqsFactor(alleleFreqs, geneCopyVar) 2 | % This function creates a factor whose values are the frequencies of each 3 | % allele in the population. 4 | % 5 | % Input: 6 | % alleleFreqs: A list of the frequencies of the alleles in the population 7 | % genotypeVar: The variable number for the genotype 8 | % 9 | % Output: 10 | % geneCopyFactor: A factor for the prior probability of genotypeVar (note 11 | % that this is the FULL CPD with no evidence observed) 12 | 13 | numAlleles = length(alleleFreqs); 14 | geneCopyFactor = struct('var', [], 'card', [], 'val', []); 15 | geneCopyFactor.var(1) = geneCopyVar; 16 | geneCopyFactor.card(1) = numAlleles; 17 | geneCopyFactor.val = alleleFreqs'; -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/computeSigmoid.m: -------------------------------------------------------------------------------- 1 | function sigVal = computeSigmoid(z) 2 | % This function computes the value of the sigmoid of all of the numbers in 3 | % an n x 1 vector, where n is the length of z. 4 | % 5 | % Input: 6 | % z: The n x 1 vector, where n is the length of z, of values whose 7 | % sigmoids need to be found 8 | % 9 | % Output: 10 | % sigVal: The value of the sigmoid 11 | 12 | expz = exp(z); 13 | sigVal = expz ./ (1 + expz); -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/sampleFactorList.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn2/sampleFactorList.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/sampleFactorListDecoupled.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn2/sampleFactorListDecoupled.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/sendToSamiamInfo.m: -------------------------------------------------------------------------------- 1 | % You can create a network and convert it to a format that can be viewed in 2 | % Samiam by running this script. 3 | 4 | pedigree = struct('parents', [0,0;1,3;0,0;1,3;2,6;0,0;2,6;4,9;0,0]); 5 | pedigree.names = {'Ira','James','Robin','Eva','Jason','Rene','Benjamin','Sandra','Aaron'}; 6 | alleleFreqs = [0.1; 0.9]; 7 | alleleList = {'F', 'f'}; 8 | alphaList = [0.8; 0.6; 0.1]; 9 | phenotypeList = {'CysticFibrosis', 'NoCysticFibrosis'}; 10 | positions = [520, 600, 520, 500; 650, 400, 650, 300; 390, 600, 390, 500; 260, 400, 260, 300; 780, 200, 780, 100; 1040, 400, 1040, 300; 910, 200, 910, 100; 130, 200, 130, 100; 0, 400, 0, 300]; 11 | 12 | % This will construct a Bayesian network and convert it into a file that 13 | % can be viewed in SamIam. 14 | 15 | factorList = constructGeneticNetwork(pedigree, alleleFreqs, alphaList); 16 | sendToSamiam(pedigree, factorList, alleleList, phenotypeList, positions, 'cysticFibrosisBayesNet'); -------------------------------------------------------------------------------- /ByJimmyLin/asgn2/submitWeb.m: -------------------------------------------------------------------------------- 1 | % submitWeb Creates files from your code and output for web submission. 2 | % 3 | % If the submit function does not work for you, use the web-submission mechanism. 4 | % Call this function to produce a file for the part you wish to submit. Then, 5 | % submit the file to the class servers using the "Web Submission" button on the 6 | % Programming Assignments page on the course website. 7 | % 8 | 9 | function submitWeb(partId) 10 | if ~exist('partId', 'var') || isempty(partId) 11 | partId = []; 12 | end 13 | 14 | submit(partId, 1); 15 | end 16 | 17 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m and SampleFactors.m 8 | % 9 | % Copyright (C) Daphne Koller, Stanford University, 2012 10 | 11 | 12 | function I = AssignmentToIndex(A, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | if (any(size(A) == 1)), 16 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 17 | else 18 | I = sum(bsxfun(@times, A - 1, cumprod([1, D(1:end - 1)])), 2) + 1; 19 | end; 20 | 21 | end 22 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/ComputeAllSimilarityFactors.m: -------------------------------------------------------------------------------- 1 | function factors = ComputeAllSimilarityFactors (images, K) 2 | % This function computes all of the similarity factors for the images in 3 | % one word. 4 | % 5 | % Input: 6 | % images: An array of structs containing the 'img' value for each 7 | % character in the word. 8 | % K: The alphabet size (accessible in imageModel.K for the provided 9 | % imageModel). 10 | % 11 | % Output: 12 | % factors: Every similarity factor in the word. You should use 13 | % ComputeSimilarityFactor to compute these. 14 | % 15 | % Copyright (C) Daphne Koller, Stanford University, 2012 16 | 17 | n = length(images); 18 | nFactors = nchoosek (n, 2); 19 | 20 | factors = repmat(struct('var', [], 'card', [], 'val', []), nFactors, 1); 21 | 22 | % Your code here: 23 | k = 0; 24 | weights = [1 26]; 25 | for i = 1:n, 26 | for j = (i+1):n, 27 | k = k + 1; % index of factor, use independent variable to record 28 | factors(k) = ComputeSimilarityFactor(images, K, i, j); 29 | end 30 | end 31 | 32 | end 33 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/ComputeEqualPairwiseFactors.m: -------------------------------------------------------------------------------- 1 | function factors = ComputeEqualPairwiseFactors (images, K) 2 | % This function computes the pairwise factors for one word in which every 3 | % factor value is set to be 1. 4 | % 5 | % Input: 6 | % images: An array of structs containing the 'img' value for each 7 | % character in the word. 8 | % K: The alphabet size (accessible in imageModel.K for the provided 9 | % imageModel). 10 | % 11 | % Output: 12 | % factors: The pairwise factors for this word. Every entry in the factor 13 | % vals should be 1. 14 | % 15 | % Copyright (C) Daphne Koller, Stanford University, 2012 16 | 17 | n = length(images); 18 | 19 | factors = repmat(struct('var', [], 'card', [], 'val', []), n - 1, 1); 20 | 21 | % Your code here: 22 | 23 | end 24 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/ComputeImageFactor.m: -------------------------------------------------------------------------------- 1 | function P = ComputeImageFactor (img, imgModel) 2 | % This function computes the singleton OCR factor values for a single 3 | % image. 4 | % 5 | % Input: 6 | % img: The 16x8 matrix of the image 7 | % imgModel: The provided, trained image model 8 | % 9 | % Output: 10 | % P: A K-by-1 array of the factor values for each of the K possible 11 | % character assignments to the given image 12 | % 13 | % Copyright (C) Daphne Koller, Stanford University, 2012 14 | 15 | X = img(:); 16 | N = length(X); 17 | K = imgModel.K; 18 | 19 | theta = reshape(imgModel.params(1:N*(K-1)), K-1, N); 20 | bias = reshape(imgModel.params((1+N*(K-1)):end), K-1, 1); 21 | 22 | W = [ bsxfun(@plus, theta * X, bias) ; 0 ]; 23 | W = bsxfun(@minus, W, max(W)); 24 | W = exp(W); 25 | 26 | P=bsxfun(@rdivide, W, sum(W)); 27 | 28 | 29 | end 30 | 31 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %GETVALUEOFASSIGNMENT Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GETVALUEOFASSIGNMENT(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GETVALUEOFASSIGNMENT(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SETVALUEOFASSIGNMENT 11 | 12 | % Copyright (C) Daphne Koller, Stanford University, 2012 13 | 14 | function v = GetValueOfAssignment(F, A, VO) 15 | 16 | if (nargin == 2), 17 | indx = AssignmentToIndex(A, F.card); 18 | else 19 | map = zeros(length(F.var), 1); 20 | for i = 1:length(F.var), 21 | map(i) = find(VO == F.var(i)); 22 | end; 23 | indx = AssignmentToIndex(A(map), F.card); 24 | end; 25 | 26 | v = F.val(indx); 27 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/ImageSimilarity.m: -------------------------------------------------------------------------------- 1 | function sim = ImageSimilarity (im1, im2) 2 | % This function computes the "similarity score" between two images. You 3 | % should use the value for the similarity factor value when the two images 4 | % are assigned the same character. 5 | % 6 | % Input: 7 | % im1, im2: Two images from the provided dataset (they should be 16x8 8 | % matrices of 0s and 1s). 9 | % 10 | % Output: 11 | % sim: The similarity score of those images. 12 | % 13 | % Copyright (C) Daphne Koller, Stanford University, 2012 14 | 15 | a = im1(:); 16 | b = im2(:); 17 | 18 | meanSim = 0.283; % Avg sim score computed over held-out data. 19 | 20 | cosDist = (a' * b) / (norm(a) * norm(b)); 21 | 22 | diff = (cosDist - meanSim) ^ 2; 23 | 24 | if (cosDist > meanSim) 25 | sim = 1 + 5*diff; 26 | else 27 | sim = 1 / (1 + 5*diff); 28 | end 29 | 30 | end 31 | 32 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = IndexToAssignment(I, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | A = bsxfun(@mod, floor(bsxfun(@rdivide, I(:) - 1, cumprod([1, D(1:end - 1)]))), D) + 1; 16 | 17 | end 18 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/PA3Data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/PA3Data.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/PA3Description.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/PA3Description.pdf -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/PA3Models.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/PA3Models.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/PA3SampleCases.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/PA3SampleCases.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/PA3TestCases.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/PA3TestCases.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/SetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %SETVALUEOFASSIGNMENT Sets the value of a variable assignment in a factor. 2 | % 3 | % F = SETVALUEOFASSIGNMENT(F, A, v) sets the value of a variable assignment, 4 | % A, in factor F to v. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % F = SETVALUEOFASSIGNMENT(F, A, v, VO) sets the value of a variable 8 | % assignment, A, in factor F to v. The order of the variables in A are given 9 | % by the vector VO. 10 | % 11 | % See also GETVALUEOFASSIGNMENT 12 | 13 | % Copyright (C) Daphne Koller, Stanford University, 2012 14 | 15 | function F = SetValueOfAssignment(F, A, v, VO) 16 | 17 | if (nargin == 3), 18 | indx = AssignmentToIndex(A, F.card); 19 | else 20 | map = zeros(length(F.var), 1); 21 | for i = 1:length(F.var), 22 | map(i) = find(VO == F.var(i)); 23 | end; 24 | indx = AssignmentToIndex(A(map), F.card); 25 | end; 26 | 27 | F.val(indx) = v; 28 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/TestComputeAllSimilarityFactors.m: -------------------------------------------------------------------------------- 1 | function TestComputeAllSimilarityFactors () 2 | 3 | % load original data 4 | load PA3Data.mat 5 | load PA3Models.mat 6 | % load test data 7 | load PA3SampleCases.mat 8 | 9 | % invoke the function you want to test 10 | factors = ComputeAllSimilarityFactors(Part5SampleImagesInput, imageModel.K); 11 | 12 | % floating point comparison threshold 13 | FLT_EPSILON = 1e-6; 14 | % test suites for the factors totally equals to provided solution 15 | for i = 1:length(factors), 16 | assert(all(factors(i).var == Part5SampleFactorsOutput(i).var), 'Variable tests failed..'); 17 | assert(all(factors(i).card == Part5SampleFactorsOutput(i).card), 'Cardinality tests failed..'); 18 | assert(all(factors(i).val <= (1+FLT_EPSILON) * Part5SampleFactorsOutput(i).val), 'Value test failed..(beyond the upper bound)'); 19 | assert(all(factors(i).val >= (1-FLT_EPSILON) * Part5SampleFactorsOutput(i).val), 'Value test failed..(beyond the lower bound)'); 20 | end 21 | 22 | % success result display 23 | disp('Congratulation.. TestComputeAllSimilarityFactors passed.') 24 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/TestComputePairwiseFactors.m: -------------------------------------------------------------------------------- 1 | function TestComputePairwiseFactors () 2 | 3 | load PA3Data.mat 4 | load PA3Models.mat 5 | load PA3SampleCases.mat 6 | 7 | factors = ComputePairwiseFactors(Part2SampleImagesInput, pairwiseModel, imageModel.K); 8 | % test suites for the factors totally equals to provided solution 9 | 10 | FLT_EPSILON = 1e-6; 11 | for i = 1:length(factors), 12 | assert(all(factors(i).var == Part2SampleFactorsOutput(i).var), 'Variable tests failed..'); 13 | assert(all(factors(i).card == Part2SampleFactorsOutput(i).card), 'Cardinality tests failed..'); 14 | assert(all(factors(i).val <= (1+FLT_EPSILON) * Part2SampleFactorsOutput(i).val), 'Value test failed..(beyond the upper bound)'); 15 | assert(all(factors(i).val >= (1-FLT_EPSILON) * Part2SampleFactorsOutput(i).val), 'Value test failed..(beyond the lower bound)'); 16 | end 17 | 18 | disp('Congratulation.. All testing cases passed.') 19 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/TestComputeSimilarityFactors.m: -------------------------------------------------------------------------------- 1 | function TestComputeSimilarityFactor () 2 | 3 | load PA3Data.mat 4 | load PA3Models.mat 5 | load PA3SampleCases.mat 6 | 7 | factor = ComputeSimilarityFactor(Part4SampleImagesInput, imageModel.K, 1, 2); 8 | 9 | % test suites for the factors totally equals to provided solution 10 | 11 | FLT_EPSILON = 1e-6; 12 | assert(all(factor.var == Part4SampleFactorOutput.var), 'Variable tests failed..'); 13 | assert(all(factor.card == Part4SampleFactorOutput.card), 'Cardinality tests failed..'); 14 | assert(all(factor.val <= (1+FLT_EPSILON) * Part4SampleFactorOutput.val), 'Value test failed..(beyond the upper bound)'); 15 | assert(all(factor.val >= (1-FLT_EPSILON) * Part4SampleFactorOutput.val), 'Value test failed..(beyond the lower bound)'); 16 | 17 | disp('Congratulation.. TestComputeSimilarityFactor passed.') 18 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/TestComputeSingletonFactors.m: -------------------------------------------------------------------------------- 1 | function TestComputeSingletonFactors () 2 | 3 | load PA3Data.mat 4 | load PA3Models.mat 5 | load PA3SampleCases.mat 6 | 7 | factors = ComputeSingletonFactors(Part1SampleImagesInput, imageModel); 8 | 9 | % test suites for the factors totally equals to provided solution 10 | 11 | FLT_EPSILON = 1e-6; 12 | for i = 1:length(factors), 13 | assert(all(factors(i).var == Part1SampleFactorsOutput(i).var), 'Variable tests failed..'); 14 | assert(all(factors(i).card == Part1SampleFactorsOutput(i).card), 'Cardinality tests failed..'); 15 | assert(all(factors(i).val <= (1+FLT_EPSILON) * Part1SampleFactorsOutput(i).val), 'Value test failed..(beyond the upper bound)'); 16 | assert(all(factors(i).val >= (1-FLT_EPSILON) * Part1SampleFactorsOutput(i).val), 'Value test failed..(beyond the lower bound)'); 17 | end 18 | 19 | disp('Congratulation.. All testing cases passed.') 20 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/TestComputeTopSimilarityFactors.m: -------------------------------------------------------------------------------- 1 | function TestComputeTopSimilarityFactors () 2 | 3 | % load original data 4 | load PA3Data.mat 5 | load PA3Models.mat 6 | % load test data 7 | load PA3SampleCases.mat 8 | 9 | % invoke the function you want to test 10 | factors = ChooseTopSimilarityFactors (Part6SampleFactorsInput, 2); 11 | 12 | % floating point comparison threshold 13 | FLT_EPSILON = 1e-6; 14 | % test suites for the factors totally equals to provided solution 15 | for i = 1:length(factors), 16 | % assert(all(factors(i).var == Part6SampleFactorsOutput(i).var), 'Variable tests failed..'); 17 | assert(all(factors(i).card == Part6SampleFactorsOutput(i).card), 'Cardinality tests failed..'); 18 | assert(all(factors(i).val <= (1+FLT_EPSILON) * Part6SampleFactorsOutput(i).val), 'Value test failed..(beyond the upper bound)'); 19 | assert(all(factors(i).val >= (1-FLT_EPSILON) * Part6SampleFactorsOutput(i).val), 'Value test failed..(beyond the lower bound)'); 20 | end 21 | 22 | % success result display 23 | disp('Congratulation.. TestComputeTopSimilarityFactors passed.') 24 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/TestComputeTripletFactors.m: -------------------------------------------------------------------------------- 1 | function TestComputeTripletFactors () 2 | 3 | load PA3Data.mat 4 | load PA3Models.mat 5 | load PA3SampleCases.mat 6 | 7 | factors = ComputeTripletFactors(Part3SampleImagesInput, tripletList, imageModel.K); 8 | 9 | % test suites for the factors totally equals to provided solution 10 | 11 | FLT_EPSILON = 1e-10; 12 | for i = 1:length(factors), 13 | assert(all(factors(i).var == Part3SampleFactorsOutput(i).var), 'Variable tests failed..'); 14 | assert(all(factors(i).card == Part3SampleFactorsOutput(i).card), 'Cardinality tests failed..'); 15 | %assert(length(factors(i)) == length(Part3SampleFactorsOutput(i).val)) 16 | assert(all(factors(i).val <= (1+FLT_EPSILON) * Part3SampleFactorsOutput(i).val), 'Value test failed..(beyond the upper bound)'); 17 | assert(all(factors(i).val >= (1-FLT_EPSILON) * Part3SampleFactorsOutput(i).val), 'Value test failed..(beyond the lower bound)'); 18 | end 19 | 20 | disp('Congratulation.. All testing cases passed.') 21 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/VisualizeWord.m: -------------------------------------------------------------------------------- 1 | function VisualizeWord (word) 2 | % This function allows you to visualize the characters for a single word. 3 | % 4 | % Input: 5 | % word: A struct array, each with an 'img' attribute that gives the 16x8 6 | % pixel matrix for that image. 7 | % 8 | % Copyright (C) Daphne Koller, Stanford University, 2012 9 | 10 | padding = zeros(size(word(1).img, 1), 1); 11 | 12 | totalWidth = 10 * length(word); 13 | im = zeros(16, totalWidth); 14 | for i = 1:length(word) 15 | charIm = [padding word(i).img padding]; 16 | im(:, (1 + 10 * (i-1)) + (1:10)) = charIm; 17 | end 18 | 19 | width = size(im, 2); 20 | padding = zeros(1, width); 21 | im = [padding; im; padding]; 22 | 23 | figure; 24 | colormap(gray); 25 | imagesc(1 - im); 26 | axis equal; 27 | [height, width] = size(im); 28 | axis([0 width 0 height]); 29 | 30 | end 31 | 32 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/inf.log: -------------------------------------------------------------------------------- 1 | Starting BP[tol=1e-09,maxiter=10000,maxtime=inf,verbose=1,logdomain=1,updates=SEQMAX,damping=0,inference=SUMPROD]...converged in 11 passes (0.31777 seconds). 2 | LBP posterior decoding (highest prob assignment in marginal): 3 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/inference/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/inference/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/inference/doinference-linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/inference/doinference-linux -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/inference/doinference-mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/inference/doinference-mac -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/inference/doinference.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/inference/doinference.exe -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/inference/inference-src.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/inference/inference-src.zip -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/pgm_login_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn3/pgm_login_data.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn3/submitWeb.m: -------------------------------------------------------------------------------- 1 | % submitWeb Creates files from your code and output for web submission. 2 | % 3 | % If the submit function does not work for you, use the web-submission mechanism. 4 | % Call this function to produce a file for the part you wish to submit. Then, 5 | % submit the file to the class servers using the "Web Submission" button on the 6 | % Programming Assignments page on the course website. 7 | % 8 | % Copyright (C) Daphne Koller, Stanford University, 2012 9 | 10 | function submitWeb(partId) 11 | if ~exist('partId', 'var') || isempty(partId) 12 | partId = []; 13 | end 14 | 15 | submit(partId, 1); 16 | end 17 | 18 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn4/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/.MaxDecoding.m.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn4/.MaxDecoding.m.swp -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m 8 | % 9 | % Copyright (C) Daphne Koller, Stanford University, 2012 10 | 11 | 12 | function I = AssignmentToIndex(A, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | if (any(size(A) == 1)), 16 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 17 | else 18 | I = sum(repmat(cumprod([1, D(1:end - 1)]), size(A, 1), 1) .* (A - 1), 2) + 1; 19 | end; 20 | 21 | end 22 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/DecodedMarginalsToChars.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function DecodedMarginalsToChars(decodedMarginals) 4 | chars = 'abcdefghijklmnopqrstuvwxyz'; 5 | fprintf('%c', chars(decodedMarginals)); 6 | fprintf('\n'); 7 | end 8 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | % GetValueOfAssignment Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GetValueOfAssignment(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GetValueOfAssignment(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SetValueOfAssignment.m and SampleFactors.m 11 | % 12 | % Copyright (C) Daphne Koller, Stanford University, 2012 13 | 14 | function v = GetValueOfAssignment(F, A, VO) 15 | 16 | if (nargin == 2), 17 | indx = AssignmentToIndex(A, F.card); 18 | else 19 | map = zeros(length(F.var), 1); 20 | for i = 1:length(F.var), 21 | map(i) = find(VO == F.var(i)); 22 | end; 23 | indx = AssignmentToIndex(A(map), F.card); 24 | end; 25 | 26 | v = F.val(indx); 27 | 28 | end 29 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and SampleFactors.m 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = IndexToAssignment(I, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | A = mod(floor(repmat(I(:) - 1, 1, length(D)) ./ repmat(cumprod([1, D(1:end - 1)]), length(I), 1)), ... 16 | repmat(D, length(I), 1)) + 1; 17 | 18 | end 19 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/PA4Sample.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn4/PA4Sample.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/PA4Test.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn4/PA4Test.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/ProgrammingAssignment4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn4/ProgrammingAssignment4.pdf -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/StandardizeFactors.m: -------------------------------------------------------------------------------- 1 | % Function that sorts the variables in F and returns an equivalent 2 | % factor G. Used only to standardize output for grading purposes. 3 | function G = StandardizeFactors(F) 4 | G = struct('var', [], 'card', [], 'val', []); 5 | for i = 1:length(F) 6 | G(i) = StandardizeFactor(F(i)); 7 | end 8 | 9 | function G = StandardizeFactor(F); 10 | 11 | G = struct('var', [], 'card', [], 'val', []); 12 | 13 | [G.var, F2G] = sort(F.var); 14 | G.card = F.card(F2G); 15 | G.val = zeros(size(F.val)); 16 | 17 | fval = [1:length(F.val)]; 18 | if isempty(fval); fval = []; end; 19 | 20 | F_assn = IndexToAssignment(1:length(F.val), F.card); 21 | idx = AssignmentToIndex(F_assn(:, F2G), G.card); 22 | G.val(idx) = F.val; 23 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/TestCompteInitialPotentials.m: -------------------------------------------------------------------------------- 1 | function TestCompteInitialPotentials () 2 | 3 | load PA4Sample.mat 4 | 5 | % invoke the function you want to test 6 | tmp = ComputeInitialPotentials(InitPotential.INPUT); 7 | factors = tmp.cliqueList; 8 | 9 | % floating point comparison threshold 10 | FLT_EPSILON = 1e-6; 11 | % test suites for the factors totally equals to provided solution 12 | for i = 1:length(factors), 13 | assert(all(factors(i).var == InitPotential.RESULT.cliqueList(i).var), 'Variable tests failed..'); 14 | assert(all(factors(i).card == InitPotential.RESULT.cliqueList(i).card), 'Cardinality tests failed..'); 15 | assert(all(factors(i).val <= (1+FLT_EPSILON) * InitPotential.RESULT.cliqueList(i).val), 'Value test failed..(beyond the upper bound)'); 16 | assert(all(factors(i).val >= (1-FLT_EPSILON) * InitPotential.RESULT.cliqueList(i).val), 'Value test failed..(beyond the lower bound)'); 17 | end 18 | 19 | % success result display 20 | disp('Congratulation.. TestCompteInitialPotentials passed.') 21 | end 22 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/isMessageEmpty.m: -------------------------------------------------------------------------------- 1 | 2 | % subroutine to test the emptiness of certain message 3 | function emptiness = isMessageEmpty(message) 4 | emptiness = isempty(message.var) && isempty(message.card) && (isempty(message.val) || message.val == 0); 5 | end 6 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/pgm_login_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn4/pgm_login_data.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn4/submitWeb.m: -------------------------------------------------------------------------------- 1 | % submitWeb Creates files from your code and output for web submission. 2 | % 3 | % If the submit function does not work for you, use the web-submission mechanism. 4 | % Call this function to produce a file for the part you wish to submit. Then, 5 | % submit the file to the class servers using the "Web Submission" button on the 6 | % Programming Assignments page on the course website. 7 | % 8 | % Copyright (C) Daphne Koller, Stanford University, 2012 9 | 10 | function submitWeb(partId) 11 | if ~exist('partId', 'var') || isempty(partId) 12 | partId = []; 13 | end 14 | 15 | submit(partId, 1); 16 | end 17 | 18 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn5/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m 8 | % Copyright (C) Daphne Koller, Stanford University, 2012 9 | 10 | function I = AssignmentToIndex(A, D) 11 | 12 | D = D(:)'; % ensure that D is a row vector 13 | if (any(size(A) == 1)), 14 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 15 | else 16 | I = sum(repmat(cumprod([1, D(1:end - 1)]), size(A, 1), 1) .* (A - 1), 2) + 1; 17 | end; 18 | 19 | end 20 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/EdgeToFactorCorrespondence.m: -------------------------------------------------------------------------------- 1 | % Returns a matrix that maps edges to a list of factors in which both ends partake 2 | % 3 | % Copyright (C) Daphne Koller, Stanford University, 2012 4 | 5 | function E2F = EdgeToFactorCorrespondence(V, F) 6 | 7 | E2F = cell(length(V), length(V)); 8 | 9 | for f = 1:length(F) 10 | for i = 1:length(F(f).var) 11 | for j = i+1:length(F(f).var) 12 | u = F(f).var(i); 13 | v = F(f).var(j); 14 | E2F{u,v} = union(E2F{u,v}, f); 15 | E2F{v,u} = union(E2F{v,u}, f); 16 | end 17 | end 18 | end -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %GETVALUEOFASSIGNMENT Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GETVALUEOFASSIGNMENT(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GETVALUEOFASSIGNMENT(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SETVALUEOFASSIGNMENT 11 | % 12 | % Copyright (C) Daphne Koller, Stanford University, 2012 13 | 14 | function v = GetValueOfAssignment(F, A, VO); 15 | 16 | if (nargin == 2), 17 | indx = AssignmentToIndex(A, F.card); 18 | else 19 | map = zeros(length(F.var), 1); 20 | for i = 1:length(F.var), 21 | map(i) = find(VO == F.var(i)); 22 | end; 23 | indx = AssignmentToIndex(A(map), F.card); 24 | end; 25 | 26 | v = F.val(indx); 27 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/GibbsTrans.m: -------------------------------------------------------------------------------- 1 | % GIBBSTRANS 2 | % 3 | % MCMC transition function that performs Gibbs sampling. 4 | % A - The current joint assignment. This should be 5 | % updated to be the next assignment 6 | % G - The network 7 | % F - List of all factors 8 | % 9 | % Copyright (C) Daphne Koller, Stanford University, 2012 10 | 11 | function A = GibbsTrans(A, G, F) 12 | 13 | for i = 1:length(G.names) 14 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15 | % YOUR CODE HERE 16 | % For each variable in the network sample a new value for it given everything 17 | % else consistent with A. Then update A with this new value for the 18 | % variable. NOTE: Your code should call BlockLogDistribution(). 19 | % IMPORTANT: you should call the function randsample() exactly once 20 | % here, and it should be the only random function you call. 21 | % 22 | % Also, note that randsample() requires arguments in raw probability space 23 | % be sure that the arguments you pass to it meet that criteria 24 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 25 | 26 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 27 | end 28 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and SampleFactors.m 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = IndexToAssignment(I, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | A = mod(floor(repmat(I(:) - 1, 1, length(D)) ./ repmat(cumprod([1, D(1:end - 1)]), length(I), 1)), ... 16 | repmat(D, length(I), 1)) + 1; 17 | 18 | end 19 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/LogProbOfJointAssignment.m: -------------------------------------------------------------------------------- 1 | % Returns the log probability of an assignment A in a distribution defined by factors F 2 | % 3 | % Copyright (C) Daphne Koller, Stanford University, 2012 4 | 5 | function logp = LogProbOfJointAssignment(F, A) 6 | 7 | % work in log-space to prevent underflow 8 | logp = 0.0; 9 | for i = 1:length(F) 10 | logp = logp + log(GetValueOfAssignment(F(i), A, 1:length(A))); 11 | end 12 | 13 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/MHGibbsTrans.m: -------------------------------------------------------------------------------- 1 | % MHGIBBSTRANS 2 | % 3 | % MCMC Metropolis-Hastings transition function that 4 | % utilizes the Gibbs sampling distribution for proposals. 5 | % A - The current joint assignment. This should be 6 | % updated to be the next assignment 7 | % G - The network 8 | % F - List of all factors 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = MHGibbsTrans(A, G, F) 13 | 14 | % Draw proposed new state from Gibbs Transition distribution 15 | A_prop = GibbsTrans(A, G, F); 16 | 17 | % Compute acceptance probability 18 | p_acceptance = 1.0; 19 | 20 | % Accept or reject proposal 21 | if rand() < p_acceptance 22 | A = A_prop; 23 | end -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/MHUniformTrans.m: -------------------------------------------------------------------------------- 1 | % MHUNIFORMTRANS 2 | % 3 | % MCMC Metropolis-Hastings transition function that 4 | % utilizes the uniform proposal distribution. 5 | % A - The current joint assignment. This should be 6 | % updated to be the next assignment 7 | % G - The network 8 | % F - List of all factors 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = MHUniformTrans(A, G, F) 13 | 14 | % Draw proposed new state from uniform distribution 15 | A_prop = ceil(rand(1, length(A)) .* G.card); 16 | 17 | p_acceptance = 0.0; 18 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 | % YOUR CODE HERE 20 | % Compute acceptance probability 21 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 22 | 23 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 24 | 25 | % Accept or reject proposal 26 | if rand() < p_acceptance 27 | % disp('Accepted'); 28 | A = A_prop; 29 | end -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/ProgrammingAssignment5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn5/ProgrammingAssignment5.pdf -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/SetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %SETVALUEOFASSIGNMENT Sets the value of a variable assignment in a factor. 2 | % 3 | % F = SETVALUEOFASSIGNMENT(F, A, v) sets the value of a variable assignment, 4 | % A, in factor F to v. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % F = SETVALUEOFASSIGNMENT(F, A, v, VO) sets the value of a variable 8 | % assignment, A, in factor F to v. The order of the variables in A are given 9 | % by the vector VO. 10 | % 11 | % See also GETVALUEOFASSIGNMENT 12 | % 13 | % Copyright (C) Daphne Koller, Stanford University, 2012 14 | 15 | function F = SetValueOfAssignment(F, A, v, VO); 16 | 17 | if (nargin == 3), 18 | indx = AssignmentToIndex(A, F.card); 19 | else 20 | map = zeros(length(F.var), 1); 21 | for i = 1:length(F.var), 22 | map(i) = find(VO == F.var(i)); 23 | end; 24 | indx = AssignmentToIndex(A(map), F.card); 25 | end; 26 | 27 | F.val(indx) = v; 28 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/VariableToFactorCorrespondence.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function V2F = VariableToFactorCorrespondence(V, F) 4 | 5 | V2F = cell(length(V), 1); 6 | 7 | for f = 1:length(F) 8 | for i = 1:length(F(f).var) 9 | v = F(f).var(i); 10 | V2F{v} = union(V2F{v}, f); 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/VisualizeToyImageMarginals.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function VisualizeToyImageMarginals(G, M, chain_num, tname) 4 | 5 | n = sqrt(length(G.names)); 6 | marginal_vector = []; 7 | for i = 1:length(M) 8 | marginal_vector(end+1) = M(i).val(1); 9 | end 10 | clims = [0, 1]; 11 | imagesc(reshape(marginal_vector, n, n), clims); 12 | colormap(gray); 13 | title(['Marginals for chain ' num2str(chain_num) ' ' tname]) -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/exampleIOPA5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn5/exampleIOPA5.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/pgm_login_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn5/pgm_login_data.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/rand.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [val] = rand(arg1,arg2); 4 | val = -1; 5 | gran = 1e6; 6 | 7 | if(nargin>0&&ischar(arg1)) 8 | if(nargin==1) 9 | arg2=1; 10 | end 11 | randi(arg1,arg2); 12 | val=0; 13 | else 14 | if(nargin==0) 15 | val = randi(1e6)/(1e6); 16 | else 17 | if(nargin==1) 18 | if(length(arg1)>1) 19 | arg2=arg1(2); 20 | arg1=arg1(1); 21 | else 22 | arg2=arg1; 23 | end 24 | end 25 | val = randi(1e6,arg1,arg2)/1e6; 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/randi.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [num mv] = randi(arg1,arg2,arg3) 4 | 5 | num = -1; 6 | persistent x_i; 7 | persistent p1; 8 | persistent p2; 9 | if(isempty(x_i)) 10 | x_i = 1; 11 | p1 = 160481183; 12 | p2 = 179424673; 13 | end 14 | mv=p2; 15 | if(ischar(arg1)==1) 16 | if(strcmp(arg1,'seed')) 17 | if(nargin>1) 18 | x_i = arg2; 19 | num = 0; 20 | else 21 | x_i=1; 22 | num=0; 23 | end 24 | else 25 | 'Unrecognized option. The only accepted option to this random library is -seed-.' 26 | end 27 | else 28 | if(arg1>p2) 29 | 'Max too high, range cutoff at 1 million' 30 | end 31 | if(nargin>1) 32 | if(nargin==2) 33 | arg3=arg2; 34 | end 35 | num = zeros(arg2,arg3); 36 | for i=1:arg2 37 | for j = 1:arg3 38 | x_i = mod(x_i*(p1+1)+p1,p2); 39 | num(i,j) = mod(x_i,arg1)+1; 40 | end 41 | end 42 | else 43 | x_i = mod(x_i*(p1+1)+p1,p2); 44 | num=mod(x_i,arg1)+1; 45 | end 46 | end 47 | 48 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/smooth.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [YY] = smooth(Y,window) 4 | if(~exist('window','var')) 5 | window =5; 6 | end 7 | if(mod(window,2)==0) 8 | window = window+1; 9 | end 10 | mid = (window+1)/2; 11 | 12 | len = length(Y); 13 | Smoother =zeros(len); 14 | for i=1:len 15 | dev = min([mid-1 min([i-1 len-i])]); 16 | % dev 17 | Smoother(i,(i-dev):(i+dev))=1; 18 | end 19 | if(size(Y,2)>size(Y,1)) 20 | Y = Y'; 21 | end 22 | 23 | col = sum(Smoother,2); 24 | YY = Smoother*Y; 25 | YY = YY./col; 26 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn5/submit_input.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn5/submit_input.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m 8 | % 9 | % Copyright (C) Daphne Koller, Stanford University, 2012 10 | 11 | function I = AssignmentToIndex(A, D) 12 | 13 | D = D(:)'; % ensure that D is a row vector 14 | if (any(size(A) == 1)), 15 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 16 | else 17 | I = sum(repmat(cumprod([1, D(1:end - 1)]), size(A, 1), 1) .* (A - 1), 2) + 1; 18 | end; 19 | 20 | end 21 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/CPDFromFactor.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [CPD] = CPDFromFactor(F, Y) 4 | nvars = length(F.var); 5 | 6 | % Reorder the var, card and val fields of Fnew so that the first var is the 7 | % child variable. 8 | Fnew = F; 9 | YIndexInF = find(F.var == Y); 10 | this.card = F.card( YIndexInF ); 11 | 12 | % Parents is a dummy factor 13 | Parents.var = F.var(find(F.var ~= Y)); 14 | Parents.card = F.card(find(F.var ~= Y)); 15 | Parents.val = ones(prod(Parents.card),1); 16 | 17 | Fnew.var = [Y Parents.var]; 18 | Fnew.card = [this.card Parents.card]; 19 | for i=1:length(F.val) 20 | A = IndexToAssignment(i, F.card); 21 | y = A(YIndexInF); 22 | A( YIndexInF ) = []; 23 | A = [y A]; 24 | j = AssignmentToIndex(A, Fnew.card); 25 | Fnew.val(j) = F.val(i); 26 | end 27 | 28 | % normalize 29 | CPD = NormalizeCPDFactors(Fnew); 30 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/CalculateExpectedUtilityFactor.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function EUF = CalculateExpectedUtilityFactor( I ) 4 | 5 | % Inputs: An influence diagram I with a single decision node and a single utility node. 6 | % I.RandomFactors = list of factors for each random variable. These are CPDs, with 7 | % the child variable = D.var(1) 8 | % I.DecisionFactors = factor for the decision node. 9 | % I.UtilityFactors = list of factors representing conditional utilities. 10 | % Return value: A factor over the scope of the decision rule D from I that 11 | % gives the conditional utility given each assignment for D.var 12 | % 13 | % Note - We assume I has a single decision node and utility node. 14 | EUF = []; 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 | % 17 | % YOUR CODE HERE... 18 | % 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | 21 | 22 | 23 | end 24 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/FullI.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn6/FullI.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | % GetValueOfAssignment Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GetValueOfAssignment(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GetValueOfAssignment(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SetValueOfAssignment.m and SampleFactors.m 11 | % 12 | % Copyright (C) Daphne Koller, Stanford University, 2012 13 | 14 | function v = GetValueOfAssignment(F, A, VO) 15 | 16 | if (nargin == 2), 17 | indx = AssignmentToIndex(A, F.card); 18 | else 19 | map = zeros(length(F.var), 1); 20 | for i = 1:length(F.var), 21 | map(i) = find(VO == F.var(i)); 22 | end; 23 | indx = AssignmentToIndex(A(map), F.card); 24 | end; 25 | 26 | v = F.val(indx); 27 | 28 | end 29 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and SampleFactors.m 9 | % 10 | % Copyright (C) Daphne Koller, Stanford University, 2012 11 | 12 | function A = IndexToAssignment(I, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | A = mod(floor(repmat(I(:) - 1, 1, length(D)) ./ repmat(cumprod([1, D(1:end - 1)]), length(I), 1)), ... 16 | repmat(D, length(I), 1)) + 1; 17 | 18 | end 19 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/MultipleUtilityI.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn6/MultipleUtilityI.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/NormalizeCPDFactors.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [F] = NormalizeCPDFactors(F) 4 | 5 | NumFactors = length(F); 6 | for i=1:NumFactors 7 | 8 | f = F(i); 9 | dummy.var = f.var(2:end); 10 | dummy.card = f.card(2:end); 11 | dummy.val = zeros(1,prod(dummy.card)); 12 | 13 | % Now for each joint assignment to parents, renormalize the 14 | % values for that joint assignment to sum to 1. 15 | 16 | for a=1:length(dummy.val) 17 | A = IndexToAssignment(a, dummy.card); 18 | Indices = []; 19 | for d=1:f.card(1) 20 | Indices = [Indices AssignmentToIndex([d A], f.card);]; 21 | end 22 | if sum(f.val(Indices)) == 0 23 | % Set f.val(Indices) to 0 24 | f.val(Indices) = 0; 25 | else 26 | f.val(Indices) = f.val(Indices) / sum(f.val(Indices)); 27 | end 28 | end 29 | 30 | f.val(find(isnan(f.val))) = 0; 31 | 32 | F(i) = f; 33 | 34 | end 35 | 36 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/NormalizeFactorValues.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function F = NormalizeFactorValues( F ) 4 | 5 | for i=1:length(F) 6 | ThisFactor = F(i); 7 | ThisFactor.val = ThisFactor.val / sum(ThisFactor.val); 8 | F(i) = ThisFactor; 9 | end 10 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/PrintFactor.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [] = PrintFactor(F) 4 | % Pretty print the factor F. 5 | % The first row lists the variables and subsequent rows are 6 | % the joint assignment and their associated factor value in 7 | % the last column. 8 | 9 | for i=1:length(F.var) 10 | fprintf(1, '%d\t', F.var(i)); 11 | end 12 | fprintf(1, '\n'); 13 | 14 | for i=1:length(F.val) 15 | A = IndexToAssignment(i, F.card); 16 | for j=1:length(A) 17 | fprintf(1, '%d\t', A(j)); 18 | end 19 | fprintf(1, '%f\n', F.val(i)); 20 | end 21 | 22 | 23 | end -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/ProgrammingAssignment6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn6/ProgrammingAssignment6.pdf -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/SimpleOptimizeMEU.m: -------------------------------------------------------------------------------- 1 | % Copyright (C) Daphne Koller, Stanford University, 2012 2 | 3 | function [MEU OptimalDecisionRule] = SimpleOptimizeMEU(I) 4 | 5 | % We assume there is only one decision rule in this function. 6 | D = I.DecisionFactors(1); 7 | 8 | PossibleDecisionRules = EnumerateDecisionRules(D); 9 | 10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 11 | % 12 | % YOUR CODE HERE 13 | % 1. You must find which of the decision rules you have enumerated has the 14 | % highest expected utility. You should use your implementation of 15 | % SimpleCalcExpectedUtility from P1. Set the values of MEU and OptimalDecisionRule 16 | % to the best achieved expected utility and the corresponding decision 17 | % rule respectively. 18 | % 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | 21 | 22 | end 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/TestI0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn6/TestI0.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn6/submitWeb.m: -------------------------------------------------------------------------------- 1 | % submitWeb Creates files from your code and output for web submission. 2 | % 3 | % If the submit function does not work for you, use the web-submission mechanism. 4 | % Call this function to produce a file for the part you wish to submit. Then, 5 | % submit the file to the class servers using the "Web Submission" button on the 6 | % Programming Assignments page on the course website. 7 | % 8 | % Copyright (C) Daphne Koller, Stanford University, 2012 9 | 10 | function submitWeb(partId) 11 | if ~exist('partId', 'var') || isempty(partId) 12 | partId = []; 13 | end 14 | 15 | submit(partId, 1); 16 | end 17 | 18 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/AssignmentToIndex.m: -------------------------------------------------------------------------------- 1 | % AssignmentToIndex Convert assignment to index. 2 | % 3 | % I = AssignmentToIndex(A, D) converts an assignment, A, over variables 4 | % with cardinality D to an index into the .val vector for a factor. 5 | % If A is a matrix then the function converts each row of A to an index. 6 | % 7 | % See also IndexToAssignment.m 8 | % 9 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 10 | 11 | function I = AssignmentToIndex(A, D) 12 | 13 | D = D(:)'; % ensure that D is a row vector 14 | if (any(size(A) == 1)), 15 | I = cumprod([1, D(1:end - 1)]) * (A(:) - 1) + 1; 16 | else 17 | I = sum(bsxfun(@times, A - 1, cumprod([1, D(1:end - 1)])), 2) + 1; 18 | end; 19 | 20 | end 21 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/ComputeJointDistribution.m: -------------------------------------------------------------------------------- 1 | %ComputeJointDistribution Computes the joint distribution defined by a set 2 | % of given factors 3 | % 4 | % Joint = ComputeJointDistribution(F) computes the joint distribution 5 | % defined by a set of given factors 6 | % 7 | % Joint is a factor that encapsulates the joint distribution given by F 8 | % F is a vector of factors (struct array) containing the factors 9 | % defining the distribution 10 | % 11 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 12 | 13 | function Joint = ComputeJointDistribution(F) 14 | 15 | % Check for empty factor list 16 | assert(numel(F) ~= 0, 'Error: empty factor list'); 17 | 18 | if (length(F) == 0) 19 | % There are no factors, so create an empty factor list 20 | Joint = struct('var', [], 'card', [], 'val', []); 21 | else 22 | Joint = F(1); 23 | for i = 2:length(F) 24 | % Iterate through factors and incorporate them into the joint distribution 25 | Joint = FactorProduct(Joint, F(i)); 26 | end 27 | end 28 | end 29 | 30 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/ComputeMarginal.m: -------------------------------------------------------------------------------- 1 | %ComputeMarginal Computes the marginal over a set of given variables 2 | % M = ComputeMarginal(V, F, E) computes the marginal over variables V 3 | % in the distribution induced by the set of factors F, given evidence E 4 | % 5 | % M is a factor containing the marginal over variables V 6 | % V is a vector containing the variables in the marginal e.g. [1 2 3] for 7 | % X_1, X_2 and X_3. 8 | % F is a vector of factors (struct array) containing the factors 9 | % defining the distribution 10 | % E is an N-by-2 matrix, each row being a variable/value pair. 11 | % Variables are in the first column and values are in the second column. 12 | % 13 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 14 | 15 | function M = ComputeMarginal(V, F, E) 16 | 17 | % Check for empty factor list 18 | assert(numel(F) ~= 0, 'Error: empty factor list'); 19 | 20 | F = ObserveEvidence(F, E); 21 | Joint = ComputeJointDistribution(F); 22 | Joint.val = Joint.val ./ sum(Joint.val); 23 | M = FactorMarginalization(Joint, setdiff(Joint.var, V)); 24 | end 25 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/ComputeUnconditionedPairFeatures.m: -------------------------------------------------------------------------------- 1 | function features = ComputeUnconditionedPairFeatures (len, modelParams) 2 | % Creates indicator features on assignments to adjacent variables in the 3 | % sequence. 4 | % 5 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 6 | 7 | if (len < 2) 8 | features = []; 9 | return; 10 | end 11 | 12 | K = modelParams.numHiddenStates; 13 | nPairFeatures = (len - 1) * K * K; 14 | 15 | features(nPairFeatures) = EmptyFeatureStruct(); 16 | 17 | featureIdx = 0; 18 | for s1 = 1:K 19 | for s2 = 1:K 20 | paramVal = sub2ind([K K], s2, s1); 21 | for v = 1:(len - 1) 22 | featureIdx = featureIdx + 1; 23 | features(featureIdx).var = [v v+1]; 24 | features(featureIdx).assignment = [s1 s2]; 25 | features(featureIdx).paramIdx = paramVal; 26 | end 27 | end 28 | end 29 | 30 | 31 | end 32 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/ComputeUnconditionedSingletonFeatures.m: -------------------------------------------------------------------------------- 1 | function features = ComputeUnconditionedSingletonFeatures (len, modelParams) 2 | % Creates indicator features on assignments to single variables in the 3 | % sequence. 4 | % 5 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 6 | 7 | nSingleFeatures = len * modelParams.numHiddenStates; 8 | features(nSingleFeatures) = EmptyFeatureStruct(); 9 | 10 | K = modelParams.numHiddenStates; 11 | featureIdx = 0; 12 | 13 | for st = 1:K 14 | paramVal = st; 15 | for v = 1:len 16 | featureIdx = featureIdx + 1; 17 | features(featureIdx).var = v; 18 | features(featureIdx).assignment = st; 19 | features(featureIdx).paramIdx = paramVal; 20 | 21 | end 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/EmptyFactorStruct.m: -------------------------------------------------------------------------------- 1 | function f = EmptyFactorStruct 2 | % Dummy function for the factor struct. 3 | % 4 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 5 | 6 | f = struct ('var', [], 'card', [], 'val', []); 7 | 8 | end 9 | 10 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/EmptyFeatureStruct.m: -------------------------------------------------------------------------------- 1 | function s = EmptyFeatureStruct 2 | % Dummy function for the feature struct. 3 | % 4 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 5 | 6 | s = struct('var', [], 'assignment', [], 'paramIdx', []); 7 | 8 | end 9 | 10 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/GetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %GETVALUEOFASSIGNMENT Gets the value of a variable assignment in a factor. 2 | % 3 | % v = GETVALUEOFASSIGNMENT(F, A) returns the value of a variable assignment, 4 | % A, in factor F. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % v = GETVALUEOFASSIGNMENT(F, A, VO) gets the value of a variable assignment, 8 | % A, in factor F. The order of the variables in A are given by the vector VO. 9 | % 10 | % See also SETVALUEOFASSIGNMENT 11 | 12 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 13 | 14 | function v = GetValueOfAssignment(F, A, VO) 15 | 16 | if (nargin == 2), 17 | indx = AssignmentToIndex(A, F.card); 18 | else 19 | map = zeros(length(F.var), 1); 20 | for i = 1:length(F.var), 21 | map(i) = find(VO == F.var(i)); 22 | end; 23 | indx = AssignmentToIndex(A(map), F.card); 24 | end; 25 | 26 | v = F.val(indx); 27 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/IndexToAssignment.m: -------------------------------------------------------------------------------- 1 | % IndexToAssignment Convert index to variable assignment. 2 | % 3 | % A = IndexToAssignment(I, D) converts an index, I, into the .val vector 4 | % into an assignment over variables with cardinality D. If I is a vector, 5 | % then the function produces a matrix of assignments, one assignment 6 | % per row. 7 | % 8 | % See also AssignmentToIndex.m and SampleFactors.m 9 | % 10 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 11 | 12 | function A = IndexToAssignment(I, D) 13 | 14 | D = D(:)'; % ensure that D is a row vector 15 | A = bsxfun(@mod, floor(bsxfun(@rdivide, I(:) - 1, cumprod([1, D(1:end - 1)]))), D) + 1; 16 | 17 | end 18 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/LRAccuracy.m: -------------------------------------------------------------------------------- 1 | % function acc = LRAccuracy(GroundTruth, Predictions) compares the 2 | % vector of predictions with the vector of ground truth values, 3 | % and returns the accuracy (fraction of predictions that are correct). 4 | % 5 | % Input: 6 | % GroundTruth (numInstances x 1 vector) 7 | % Predictions (numInstances x 1 vector) 8 | % 9 | % Output: 10 | % err (scalar between 0 and 1 inclusive) 11 | % 12 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 13 | 14 | function acc = LRAccuracy(GroundTruth, Predictions) 15 | 16 | GroundTruth = GroundTruth(:); 17 | Predictions = Predictions(:); 18 | assert(all(size(GroundTruth) == size(Predictions))); 19 | 20 | acc = mean(GroundTruth == Predictions); 21 | 22 | end 23 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/LRPredict.m: -------------------------------------------------------------------------------- 1 | % pred = LRPredict(X, theta) uses the LR classifier encoded by theta 2 | % to predict the labels on data X. 3 | % 4 | % Inputs: 5 | % X data. (numInstances x numFeatures matrix) 6 | % theta LR parameters. (numFeatures x 1 vector) 7 | % 8 | % Outputs: 9 | % pred predicted labels for X. (numInstances x 1 binary vector). 10 | % 11 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 12 | 13 | function pred = LRPredict (X, theta) 14 | 15 | thresh = 0.5; 16 | h = sigmoid (X * theta); 17 | pred = h > thresh; 18 | 19 | end 20 | 21 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/MaxDecoding.m: -------------------------------------------------------------------------------- 1 | %MAXDECODING Finds the best assignment for each variable from the marginals 2 | %passed in. Returns A such that A(i) returns the index of the best 3 | %instantiation for variable i. 4 | % 5 | % For instance: Let's say we have two variables 1 and 2. 6 | % Marginals for 1 = [0.1, 0.3, 0.6] 7 | % Marginals for 2 = [0.92, 0.08] 8 | % A(1) = 3, A(2) = 1. 9 | % 10 | % See also COMPUTEEXACTMARGINALSBP 11 | 12 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 13 | 14 | function A = MaxDecoding( M ) 15 | 16 | % Compute the best assignment for variables in the network. 17 | A = zeros(1, length(M)); 18 | for i = 1:length(M) 19 | % Iterate through variables 20 | [maxVal, idx] = max(M(i).val); 21 | A(i) = idx; 22 | end 23 | 24 | end 25 | 26 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/NumParamsForConditionedFeatures.m: -------------------------------------------------------------------------------- 1 | function n = NumParamsForConditionedFeatures (features, numObservedStates) 2 | % Number of parameters "consumed" by a set of conditioned features. 3 | % 4 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 5 | 6 | maxParam = max([features.paramIdx]); 7 | n = maxParam + numObservedStates - 1 - mod(maxParam - 1, numObservedStates); 8 | 9 | end 10 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/NumParamsForUnconditionedFeatures.m: -------------------------------------------------------------------------------- 1 | function n = NumParamsForUnconditionedFeatures (features) 2 | % Number of parameters "consumed" by a set of unconditioned features. 3 | % 4 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 5 | 6 | n = max([features.paramIdx]); 7 | 8 | end 9 | 10 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/PA7Description.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/PA7Description.pdf -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Part1Lambdas.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Part1Lambdas.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Part2FullDataset.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Part2FullDataset.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Part2LogZTest.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Part2LogZTest.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Part2Sample.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Part2Sample.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Part2Test.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Part2Test.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/SetValueOfAssignment.m: -------------------------------------------------------------------------------- 1 | %SETVALUEOFASSIGNMENT Sets the value of a variable assignment in a factor. 2 | % 3 | % F = SETVALUEOFASSIGNMENT(F, A, v) sets the value of a variable assignment, 4 | % A, in factor F to v. The order of the variables in A are assumed to be the 5 | % same as the order in F.var. 6 | % 7 | % F = SETVALUEOFASSIGNMENT(F, A, v, VO) sets the value of a variable 8 | % assignment, A, in factor F to v. The order of the variables in A are given 9 | % by the vector VO. 10 | % 11 | % See also GETVALUEOFASSIGNMENT 12 | 13 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 14 | 15 | function F = SetValueOfAssignment(F, A, v, VO); 16 | 17 | if (nargin == 3), 18 | indx = AssignmentToIndex(A, F.card); 19 | else 20 | map = zeros(length(F.var), 1); 21 | for i = 1:length(F.var), 22 | map(i) = find(VO == F.var(i)); 23 | end; 24 | indx = AssignmentToIndex(A(map), F.card); 25 | end; 26 | 27 | F.val(indx) = v; 28 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Test1X.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Test1X.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Test1Y.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Test1Y.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Train1X.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Train1X.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Train1Y.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Train1Y.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Train2X.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Train2X.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Train2Y.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Train2Y.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Validation1X.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Validation1X.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Validation1Y.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Validation1Y.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Validation2X.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Validation2X.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/Validation2Y.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/Validation2Y.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/ValidationAccuracy.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/asgn7/ValidationAccuracy.mat -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/VisualizeCharacters.m: -------------------------------------------------------------------------------- 1 | function VisualizeCharacters (X) 2 | % VisualizeCharacters(X) displays the characters of observation X. The 3 | % input X should be a numCharacters x 32 matrix, since each character is 4 | % 8x4 and is stored in one row. The entries are 1's and 2's corresponding 5 | % to white and black pixels, respectively. This is the format of the 6 | % provided data for PA7, so this function should "just work" on the 7 | % provided data. 8 | % 9 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 10 | 11 | if (~isequal(size(X, 2), 32)) 12 | error('Input to VisualizeCharacters.m of incorrect size.'); 13 | end 14 | 15 | if (any(X(:) == 2)) 16 | X = X - 1; 17 | end 18 | 19 | len = size(X, 1); 20 | totalWidth = 5 * len + 1; 21 | 22 | im = zeros(8, totalWidth); 23 | for i = 1:len 24 | charIm = reshape(X(i,:), 8, 4); 25 | im(:, (2:5) + (5 * (i-1))) = charIm; 26 | end 27 | 28 | figure; 29 | colormap(gray); 30 | imagesc(1 - im); 31 | axis equal; 32 | [height, width] = size(im); 33 | axis([0 width 0 height]); 34 | 35 | end 36 | 37 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/sigmoid.m: -------------------------------------------------------------------------------- 1 | function s = sigmoid (z) 2 | % Sigmoid function (scalar or element-wise) 3 | % 4 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 5 | 6 | s = 1 ./ (1 + exp (-z)); 7 | 8 | end 9 | -------------------------------------------------------------------------------- /ByJimmyLin/asgn7/submitWeb.m: -------------------------------------------------------------------------------- 1 | % submitWeb Creates files from your code and output for web submission. 2 | % 3 | % If the submit function does not work for you, use the web-submission mechanism. 4 | % Call this function to produce a file for the part you wish to submit. Then, 5 | % submit the file to the class servers using the "Web Submission" button on the 6 | % Programming Assignments page on the course website. 7 | % 8 | % Copyright (C) Daphne Koller, Stanford Univerity, 2012 9 | 10 | function submitWeb(partId) 11 | if ~exist('partId', 'var') || isempty(partId) 12 | partId = []; 13 | end 14 | 15 | submit(partId, 1); 16 | end 17 | 18 | -------------------------------------------------------------------------------- /ByJimmyLin/samiam/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/samiam/.suppress_calljvmti: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/.suppress_calljvmti -------------------------------------------------------------------------------- /ByJimmyLin/samiam/Readme for SamIam Release 3.0 Mac OS X i386.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/Readme for SamIam Release 3.0 Mac OS X i386.pdf -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/data.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/data.js -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/background_01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/background_01.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/background_02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/background_02.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_00.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_00.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_01.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_02.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_03.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_03.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_04.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_04.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_05.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_05.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_06.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_06.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_07.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_07.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_08.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_08.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_09.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_09.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_10.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_11.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_12.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_13.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_14.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/buttons_codebandit_01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/buttons_codebandit_01.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/images/samiamhelp.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/images/samiamhelp.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SamIam User Documentation 5 | 6 | 7 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | <body bgcolor="#FFFFFF" text="#000000"></body> 28 | 29 | -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/map.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/map.html -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/monitors.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/monitors.html -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/recursiveconditioning.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/recursiveconditioning.html -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ae1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ae1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ae1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ae1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/codebandit1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/codebandit1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/codebandit1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/codebandit1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ecp1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ecp1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ecp1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ecp1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ecp2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ecp2.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ecp2.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ecp2.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/em1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/em1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/em1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/em1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens2.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens2.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens2.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens3.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens3.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens3.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens4.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens4.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens4.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens5.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens5.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens5.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens6.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens6.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens6.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens7.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens7.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens7.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens8.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/ens8.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/ens8.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/map1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/map1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/map1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/map1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/map2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/map2.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/map2.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/map2.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/modes1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/modes1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/modes1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/modes1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/modes2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/modes2.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/modes2.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/modes2.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/monitors1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/monitors1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/monitors1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/monitors1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/monitors2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/monitors2.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/monitors2.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/monitors2.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/mpe1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/mpe1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/mpe1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/mpe1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/mpe2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/mpe2.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/mpe2.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/mpe2.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/pref1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/pref1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/pref1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/pref1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/pref2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/pref2.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/pref2.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/pref2.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/rc1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/rc1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/rc1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/rc1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/rc2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/rc2.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/rc2.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/rc2.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/sa1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/sa1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/sa1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/sa1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/sa2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/sa2.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/sa2.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/sa2.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/sa3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/sa3.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/sa3.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/sa3.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/sa4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/sa4.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/sa4.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/sa4.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/sn1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/sn1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/sn1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/sn1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/wwf1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/wwf1.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/shots/wwf1.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/shots/wwf1.thumb.png -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/topics.css: -------------------------------------------------------------------------------- 1 | /* 2 | Keith Cascio 3 | 090402 4 | */ 5 | 6 | body 7 | { 8 | background-color: rgb(255,255,255); 9 | color: rgb(0,0,0); 10 | } 11 | 12 | .topictitle 13 | { 14 | font-weight: bold; 15 | font-size: 20; 16 | /* 17 | font-family: arial; 18 | font-style: bold; 19 | color: orange; 20 | */ 21 | } 22 | 23 | .topicparagraph:first-letter 24 | { 25 | margin-left: 2em; 26 | } 27 | 28 | .topicparagraph:first-line 29 | { 30 | /* 31 | text-indent: 50; 32 | padding-left: 50; 33 | */ 34 | /* 35 | font-variant: small-caps; 36 | font-weight: bold; 37 | font-family: arial; 38 | font-size: 20; 39 | font-style: bold; 40 | color: orange; 41 | */ 42 | } 43 | 44 | .keyword 45 | { 46 | font-weight: bold; 47 | } 48 | 49 | /* 50 | 51 | a:link 52 | { 53 | color: rgb(0,0,0); 54 | text-decoration:none; 55 | } 56 | a:visited 57 | { 58 | color: rgb(0,0,0); 59 | text-decoration:none; 60 | } 61 | a:active 62 | { 63 | color: rgb(102,255,0); 64 | text-decoration:none; 65 | } 66 | */ -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/tutorials.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/htmlhelp/tutorials.html -------------------------------------------------------------------------------- /ByJimmyLin/samiam/htmlhelp/tutorials/showtutorial.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem msdos script to invoke an type-associated file (e.g. a video tutorial) 3 | rem designed to work under Windows 98/NT/2000/XP 4 | rem see http://support.microsoft.com/default.aspx?kbid=126410 5 | rem since 030804 6 | 7 | rem %1 = first parameter must be the absolute 8 | rem path of the directory that contains 9 | rem the type-associated file, quoted 10 | 11 | rem %2 = second parameter must be the file 12 | rem name, containing no spaces, unquoted 13 | 14 | cd %1 15 | start %2 16 | -------------------------------------------------------------------------------- /ByJimmyLin/samiam/inflib.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/inflib.jar -------------------------------------------------------------------------------- /ByJimmyLin/samiam/libcalljvmti.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/libcalljvmti.jnilib -------------------------------------------------------------------------------- /ByJimmyLin/samiam/libcallsmile.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/libcallsmile.jnilib -------------------------------------------------------------------------------- /ByJimmyLin/samiam/library_javadocs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/library_javadocs/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/samiam/library_javadocs/edu/ucla/belief/rc2/io/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | edu.ucla.belief.rc2.io (INFLIB v3.0 Public API at 2010-01-14 19:23:22) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | edu.ucla.belief.rc2.io 20 | 21 | 22 | 27 | 28 |
23 | Classes  24 | 25 |
26 | RC2WriteToFile
29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /ByJimmyLin/samiam/library_javadocs/edu/ucla/belief/rc2/kb/sat/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | edu.ucla.belief.rc2.kb.sat (INFLIB v3.0 Public API at 2010-01-14 19:23:22) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | edu.ucla.belief.rc2.kb.sat 20 | 21 | 22 | 27 | 28 |
23 | Classes  24 | 25 |
26 | KB_SAT
29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /ByJimmyLin/samiam/library_javadocs/il2/inf/experimental/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | il2.inf.experimental (INFLIB v3.0 Public API at 2010-01-14 19:23:22) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | il2.inf.experimental 20 | 21 | 22 | 27 | 28 |
23 | Classes  24 | 25 |
26 | VEVariance
29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /ByJimmyLin/samiam/library_javadocs/package-list: -------------------------------------------------------------------------------- 1 | edu.ucla.belief 2 | edu.ucla.belief.approx 3 | edu.ucla.belief.decision 4 | edu.ucla.belief.dtree 5 | edu.ucla.belief.inference 6 | edu.ucla.belief.inference.map 7 | edu.ucla.belief.io 8 | edu.ucla.belief.io.dsl 9 | edu.ucla.belief.io.geneticlinkage 10 | edu.ucla.belief.io.hugin 11 | edu.ucla.belief.io.netica 12 | edu.ucla.belief.io.xmlbif 13 | edu.ucla.belief.learn 14 | edu.ucla.belief.rc2.caching 15 | edu.ucla.belief.rc2.creation 16 | edu.ucla.belief.rc2.io 17 | edu.ucla.belief.rc2.kb 18 | edu.ucla.belief.rc2.kb.sat 19 | edu.ucla.belief.rc2.structure 20 | edu.ucla.belief.rc2.tools 21 | edu.ucla.belief.recursiveconditioning 22 | edu.ucla.belief.sensitivity 23 | edu.ucla.belief.tree 24 | edu.ucla.belief.uai2006 25 | edu.ucla.structure 26 | edu.ucla.util 27 | edu.ucla.util.code 28 | il2.bridge 29 | il2.inf 30 | il2.inf.bp 31 | il2.inf.bp.schedules 32 | il2.inf.edgedeletion 33 | il2.inf.experimental 34 | il2.inf.jointree 35 | il2.inf.map 36 | il2.inf.mini 37 | il2.inf.rc 38 | il2.inf.structure 39 | il2.inf.structure.minfill2 40 | il2.model 41 | il2.util 42 | -------------------------------------------------------------------------------- /ByJimmyLin/samiam/library_javadocs/resources/inherit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/library_javadocs/resources/inherit.gif -------------------------------------------------------------------------------- /ByJimmyLin/samiam/network_samples/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/network_samples/.DS_Store -------------------------------------------------------------------------------- /ByJimmyLin/samiam/network_samples/Barley.net: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/network_samples/Barley.net -------------------------------------------------------------------------------- /ByJimmyLin/samiam/samiam.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/ByJimmyLin/samiam/samiam.jar -------------------------------------------------------------------------------- /Papers/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/.DS_Store -------------------------------------------------------------------------------- /Papers/Belief Propagation/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/.DS_Store -------------------------------------------------------------------------------- /Papers/Belief Propagation/A Tutorial Introduction to Belief Propagation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/A Tutorial Introduction to Belief Propagation.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Bethe free energy, Kikuchi approximations, and belief propagation algorithms.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Bethe free energy, Kikuchi approximations, and belief propagation algorithms.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Beyond Feature Points - Structured Prediction for Monocular Non-rigid 3D Reconstruction.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Beyond Feature Points - Structured Prediction for Monocular Non-rigid 3D Reconstruction.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Constructing Free Energy Approximations and Generalized Belief Propagation Algorithms.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Constructing Free Energy Approximations and Generalized Belief Propagation Algorithms.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Convergent Message-Passing Algorithms for Inference over General Graphs with Convex Free Energies.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Convergent Message-Passing Algorithms for Inference over General Graphs with Convex Free Energies.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Convexity Arguments for Efficient Minimization of the Bethe and Kikuchi Free Energies.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Convexity Arguments for Efficient Minimization of the Bethe and Kikuchi Free Energies.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Describing the Scene as a Whole - Joint Object Detection, Scene Classification and Semantic Segmentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Describing the Scene as a Whole - Joint Object Detection, Scene Classification and Semantic Segmentation.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Distributed Message Passing for Large Scale Graphical Models.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Distributed Message Passing for Large Scale Graphical Models.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Efficient Belief Propagation for Higher Order Cliques Using Linear Constraint Nodes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Efficient Belief Propagation for Higher Order Cliques Using Linear Constraint Nodes.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Efficient Structured Prediction with Latent Variables for General Graphical Models.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Efficient Structured Prediction with Latent Variables for General Graphical Models.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Estimation and Marginalization using Kikuchi Approximation Methods.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Estimation and Marginalization using Kikuchi Approximation Methods.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Free Energy in Statistical Physics and Inference.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Free Energy in Statistical Physics and Inference.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Generalized Belief Propagation.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Generalized Belief Propagation.ppt -------------------------------------------------------------------------------- /Papers/Belief Propagation/Globally Convergent Dual MAP LP Relaxation Solvers using Fenchel-Young Margins.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Globally Convergent Dual MAP LP Relaxation Solvers using Fenchel-Young Margins.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Joint, Marginal, and Conditional Probability.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Joint, Marginal, and Conditional Probability.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Norm-Product Belief Propagation - Primal-Dual Message-Passing for Approximate Inference.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Norm-Product Belief Propagation - Primal-Dual Message-Passing for Approximate Inference.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Prioritized Asynchronous Belief Propagation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Prioritized Asynchronous Belief Propagation.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Residual Belief Propagation - Informed Scheduling for Asynchronous Message Passing.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Residual Belief Propagation - Informed Scheduling for Asynchronous Message Passing.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Residual Splash for Optimally Parallelizing Belief Propagation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Residual Splash for Optimally Parallelizing Belief Propagation.pdf -------------------------------------------------------------------------------- /Papers/Belief Propagation/Simplifying Generalized Belief Propagation on Redundant Region Graphs.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/Belief Propagation/Simplifying Generalized Belief Propagation on Redundant Region Graphs.pdf -------------------------------------------------------------------------------- /Papers/The Multiple-Try Method and Local Optimisation in Metropolis Sampling.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinlin192/GraphicalModel/fb16ff1475f86bd2f77fc20a32c5dd4fd9e0a765/Papers/The Multiple-Try Method and Local Optimisation in Metropolis Sampling.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | GraphicalModel 2 | ============== 3 | 4 | Courera Version of Graphical Model.. 5 | 6 | Contributor: 7 | 8 | **Jimmy Lin** ( *The University of Texas at Austin* ) 9 | 10 | **Jian Guo** ( *Australian National University* ) 11 | 12 | 13 | Study Scheme 14 | ============ 15 | 7.1 -> 7.6 : Review BN and MN ( week1 - week2 ) 16 | 7.7 -> 7.20 : Inference ( week3 - week5 ) 17 | 7.21 -> 8.10 : Learning ( week 6 - week 9 ) 18 | 19 | --------------------------------------------------------------------------------