plateform
stringclasses
1 value
repo_name
stringlengths
13
113
name
stringlengths
3
74
ext
stringclasses
1 value
path
stringlengths
12
229
size
int64
23
843k
source_encoding
stringclasses
9 values
md5
stringlengths
32
32
text
stringlengths
23
843k
github
RoardFruit/pgm-master
ComputeJointDistribution.m
.m
pgm-master/PGM_Programming_Assignment_7/ComputeJointDistribution.m
906
utf_8
9a44d68defaa54e26172513735c2f85d
%ComputeJointDistribution Computes the joint distribution defined by a set % of given factors % % Joint = ComputeJointDistribution(F) computes the joint distribution % defined by a set of given factors % % Joint is a factor that encapsulates the joint distribution given by F % F is a vector of factors (s...
github
RoardFruit/pgm-master
InstanceNegLogLikelihood.m
.m
pgm-master/PGM_Programming_Assignment_7/InstanceNegLogLikelihood.m
3,401
utf_8
8736eaff12b944528990223073ed2a91
% function [nll, grad] = InstanceNegLogLikelihood(X, y, theta, modelParams) % returns the negative log-likelihood and its gradient, given a CRF with parameters theta, % on data (X, y). % % Inputs: % X Data. (numCharacters x numImageFeatures matrix) % X(:,1) is all ones...
github
RoardFruit/pgm-master
ObserveEvidence.m
.m
pgm-master/PGM_Programming_Assignment_7/ObserveEvidence.m
1,905
utf_8
be2baaabecfb90454113523ffef414c2
% ObserveEvidence Modify a vector of factors given some evidence. % F = ObserveEvidence(F, E) sets all entries in the vector of factors, F, % that are not consistent with the evidence, E, to zero. F is a vector of % factors, each a data structure with the following fields: % .var Vector of variables in the...
github
RoardFruit/pgm-master
SetValueOfAssignment.m
.m
pgm-master/PGM_Programming_Assignment_7/SetValueOfAssignment.m
856
utf_8
b9b9de205d3d14c0abd0cc805bae2fc8
%SETVALUEOFASSIGNMENT Sets the value of a variable assignment in a factor. % % F = SETVALUEOFASSIGNMENT(F, A, v) sets the value of a variable assignment, % A, in factor F to v. The order of the variables in A are assumed to be the % same as the order in F.var. % % F = SETVALUEOFASSIGNMENT(F, A, v, VO) set...
github
RoardFruit/pgm-master
IndexToAssignment.m
.m
pgm-master/PGM_Programming_Assignment_2/IndexToAssignment.m
598
utf_8
91464eb3a4bee675ea43f291e36754f6
% IndexToAssignment Convert index to variable assignment. % % A = IndexToAssignment(I, D) converts an index, I, into the .val vector % into an assignment over variables with cardinality D. If I is a vector, % then the function produces a matrix of assignments, one assignment % per row. % % See also A...
github
RoardFruit/pgm-master
submit.m
.m
pgm-master/PGM_Programming_Assignment_2/submit.m
26,858
utf_8
3d05a059f947090116edcf9659a11f24
function submit(partId, webSubmit) %SUBMIT Submit your code and output to the pgm-class servers % SUBMIT() will connect to the pgm-class server and submit your solution % There is no penalty for submitting, so go ahead and try this! % % If this function does not work for you, use the web-submission mechanism. % ...
github
RoardFruit/pgm-master
GetValueOfAssignment.m
.m
pgm-master/PGM_Programming_Assignment_2/GetValueOfAssignment.m
805
utf_8
0cdb098df0b0778650c51563f7710e12
% GetValueOfAssignment Gets the value of a variable assignment in a factor. % % v = GetValueOfAssignment(F, A) returns the value of a variable assignment, % A, in factor F. The order of the variables in A are assumed to be the % same as the order in F.var. % % v = GetValueOfAssignment(F, A, VO) gets the v...
github
RoardFruit/pgm-master
AssignmentToIndex.m
.m
pgm-master/PGM_Programming_Assignment_2/AssignmentToIndex.m
600
utf_8
429d0a6516a1cc5724d602ccf3df86e0
% AssignmentToIndex Convert assignment to index. % % I = AssignmentToIndex(A, D) converts an assignment, A, over variables % with cardinality D to an index into the .val vector for a factor. % If A is a matrix then the function converts each row of A to an index. % % See also IndexToAssignment.m and Samp...
github
RoardFruit/pgm-master
submitWeb.m
.m
pgm-master/PGM_Programming_Assignment_2/submitWeb.m
523
utf_8
6bbecf7bb45a5031ca74002e71845d3e
% submitWeb Creates files from your code and output for web submission. % % If the submit function does not work for you, use the web-submission mechanism. % Call this function to produce a file for the part you wish to submit. Then, % submit the file to the class servers using the "Web Submission" button on ...
github
RoardFruit/pgm-master
SetValueOfAssignment.m
.m
pgm-master/PGM_Programming_Assignment_2/SetValueOfAssignment.m
1,154
utf_8
33321dcc114579d30b93c1fc99b35e17
% SetValueOfAssignment Sets the value of a variable assignment in a factor. % % F = SetValueOfAssignment(F, A, v) sets the value of a variable assignment, % A, in factor F to v. The order of the variables in A are assumed to be the % same as the order in F.var. % % F = SetValueOfAssignment(F, A, v, VO) se...
github
RoardFruit/pgm-master
RunInference.m
.m
pgm-master/PGM_Programming_Assignment_3/RunInference.m
1,768
utf_8
3081367cc94df2ef86e1a944d0b2a35d
function pred = RunInference (factors) % This function performs inference for a Markov network specified as a list % of factors. % % Input: % factors: An array of struct factors, each containing 'var', 'card', and % 'val' fields. % % Output: % pred: An array of predictions for every variable. In particular, % ...
github
RoardFruit/pgm-master
IndexToAssignment.m
.m
pgm-master/PGM_Programming_Assignment_3/IndexToAssignment.m
585
utf_8
5b59626ed9c81a59a158ac9e48e2c257
% IndexToAssignment Convert index to variable assignment. % % A = IndexToAssignment(I, D) converts an index, I, into the .val vector % into an assignment over variables with cardinality D. If I is a vector, % then the function produces a matrix of assignments, one assignment % per row. % % See also A...
github
RoardFruit/pgm-master
submit.m
.m
pgm-master/PGM_Programming_Assignment_3/submit.m
21,118
utf_8
b49fc354ceeadf746a58dfc4abae826f
function submit(partId, webSubmit) %SUBMIT Submit your code and output to the pgm-class servers % SUBMIT() will connect to the pgm-class server and submit your solution % There is no penalty for submitting, so go ahead and try this! % % If this function does not work for you, use the web-submission mechanism. % ...
github
RoardFruit/pgm-master
GetValueOfAssignment.m
.m
pgm-master/PGM_Programming_Assignment_3/GetValueOfAssignment.m
835
utf_8
e0d34fcad4369e061ca88650da3397c9
%GETVALUEOFASSIGNMENT Gets the value of a variable assignment in a factor. % % v = GETVALUEOFASSIGNMENT(F, A) returns the value of a variable assignment, % A, in factor F. The order of the variables in A are assumed to be the % same as the order in F.var. % % v = GETVALUEOFASSIGNMENT(F, A, VO) gets the va...
github
RoardFruit/pgm-master
AssignmentToIndex.m
.m
pgm-master/PGM_Programming_Assignment_3/AssignmentToIndex.m
652
utf_8
98d4cfb7615e1a71bb4c77d5982ddabf
% AssignmentToIndex Convert assignment to index. % % I = AssignmentToIndex(A, D) converts an assignment, A, over variables % with cardinality D to an index into the .val vector for a factor. % If A is a matrix then the function converts each row of A to an index. % % See also IndexToAssignment.m and Samp...
github
RoardFruit/pgm-master
submitWeb.m
.m
pgm-master/PGM_Programming_Assignment_3/submitWeb.m
581
utf_8
40868cac2a1f7de8fbdc5855c255d44d
% submitWeb Creates files from your code and output for web submission. % % If the submit function does not work for you, use the web-submission mechanism. % Call this function to produce a file for the part you wish to submit. Then, % submit the file to the class servers using the "Web Submission" button on ...
github
RoardFruit/pgm-master
SetValueOfAssignment.m
.m
pgm-master/PGM_Programming_Assignment_3/SetValueOfAssignment.m
856
utf_8
2165785a0cb20136c69297b48edfd77e
%SETVALUEOFASSIGNMENT Sets the value of a variable assignment in a factor. % % F = SETVALUEOFASSIGNMENT(F, A, v) sets the value of a variable assignment, % A, in factor F to v. The order of the variables in A are assumed to be the % same as the order in F.var. % % F = SETVALUEOFASSIGNMENT(F, A, v, VO) set...
github
RoardFruit/pgm-master
EM_HMM.m
.m
pgm-master/PGM_Programming_Assignment_9/EM_HMM.m
8,386
utf_8
4aa14051881ce16e6900f34ee47c3979
% File: EM_HMM.m % % Copyright (C) Daphne Koller, Stanford Univerity, 2012 function [P loglikelihood ClassProb PairProb] = EM_HMM(actionData, poseData, G, InitialClassProb, InitialPairProb, maxIter) % INPUTS % actionData: structure holding the actions as described in the PA % poseData: N x 10 x 3 matrix, where N is n...
github
RoardFruit/pgm-master
ShowPose.m
.m
pgm-master/PGM_Programming_Assignment_9/ShowPose.m
1,415
utf_8
d88d1852aab394ef850174ee2185f4bd
% File: ShowPose.m % % Copyright (C) Daphne Koller, Stanford Univerity, 2012 % visualize a configuration the body parts function img = ShowPose( pose ) % pose 10 x 3. 10 : body parts, % 3 : y, x, alpha pose(:,1) = pose(:,1) + 100; pose(:,2) = pose(:,2) + 150; pose = reshape(pose, [10 3]); part_leng...
github
RoardFruit/pgm-master
lognormpdf.m
.m
pgm-master/PGM_Programming_Assignment_9/lognormpdf.m
556
utf_8
93179aac759911fb170081a38b7025a8
% File: lognormpdf.m % % Copyright (C) Daphne Koller, Stanford Univerity, 2012 function [log_prob] = lognormpdf(x,mu,sigma) % LOGNORMPDF Natural logarithm of the normal probability density function (pdf) % Y = lognormpdf(X,MU,SIGMA) returns the log of the pdf of the normal % distribution parameterized by mean MU and ...
github
RoardFruit/pgm-master
RecognizeUnknownActions.m
.m
pgm-master/PGM_Programming_Assignment_9/RecognizeUnknownActions.m
1,550
utf_8
5c0912c4f852469b8cb3f0455ede53e8
% You should put all your code for recognizing unknown actions in this file. % Describe the method you used in YourMethod.txt. % Don't forget to call SavePrediction() at the end with your predicted labels to save them for submission, then submit using submit.m % File: RecognizeActions.m % % Copyright (C) Daphne Koller...
github
RoardFruit/pgm-master
IndexToAssignment.m
.m
pgm-master/PGM_Programming_Assignment_9/IndexToAssignment.m
587
utf_8
16baab12b20308058dd13e7565a96e60
% IndexToAssignment Convert index to variable assignment. % % A = IndexToAssignment(I, D) converts an index, I, into the .val vector % into an assignment over variables with cardinality D. If I is a vector, % then the function produces a matrix of assignments, one assignment % per row. % % See also Assignme...
github
RoardFruit/pgm-master
CliqueTreeCalibrate.m
.m
pgm-master/PGM_Programming_Assignment_9/CliqueTreeCalibrate.m
3,196
utf_8
b2d6a4c7d27c772e31acc30dbf52518b
%CLIQUETREECALIBRATE Performs sum-product or max-product algorithm for %clique tree calibration. % P = CLIQUETREECALIBRATE(P, isMax) calibrates a given clique tree, P % according to the value of isMax flag. If isMax is 1, it uses max-product % message passing, otherwise uses sum-product. This function % ret...
github
RoardFruit/pgm-master
CreateCliqueTreeHMM.m
.m
pgm-master/PGM_Programming_Assignment_9/CreateCliqueTreeHMM.m
2,423
utf_8
89c8f4dc2a761a58cf501fad96aa5b9a
% CreateCliqueTreeHMM Takes in a list of factors F and returns a clique % tree. Should only be called when F meets the following conditions: % % 1) Factors are over 1 or 2 variables % 2) All 2-variable factors are over variables (i,i+1) % 3) All variables have the same cardinality % % Roughly, these conditions mean tha...
github
RoardFruit/pgm-master
FitG.m
.m
pgm-master/PGM_Programming_Assignment_9/FitG.m
352
utf_8
1c8b5ca906775262ec10c160aa613b83
% File: FitG.m % % Copyright (C) Daphne Koller, Stanford Univerity, 2012 function [mu sigma] = FitG(X, W) % X: (N x 1): N examples (1 dimensional) % W: (N x 1): Weights over examples (W(i) is the weight for X(i)) % Fit N(mu, sigma^2) to the empirical distribution mu = 0; sigma = 1; mu = W'*X/sum(W); v = W'*(X.*X)/...
github
RoardFruit/pgm-master
Recognize.m
.m
pgm-master/PGM_Programming_Assignment_9/Recognize.m
4,409
utf_8
49b25558d67d38cc6937204f5510dd68
% File: RecognizeActions.m % % Copyright (C) Daphne Koller, Stanford Univerity, 2012 function [predicted_labels] = Recognize(datasetTrain, datasetTest, G, maxIter) % INPUTS % datasetTrain: dataset for training models, see PA for details % datasetTest: dataset for testing models, see PA for details % G: graph paramete...
github
RoardFruit/pgm-master
FactorMarginalization.m
.m
pgm-master/PGM_Programming_Assignment_9/FactorMarginalization.m
821
utf_8
9481d98b85585038c22e4faa9583992c
% FactorMarginalization Sums given variables out of a factor in log space. % B = FactorMarginalization(A,V) computes the factor with the variables % in V summed out. The factor data structure has the following fields: % .var Vector of variables in the factor, e.g. [1 2 3] % .card Vector of cardin...
github
RoardFruit/pgm-master
RecognizeActions.m
.m
pgm-master/PGM_Programming_Assignment_9/RecognizeActions.m
4,489
utf_8
4e632b8b222b74b71ae237f301671354
% File: RecognizeActions.m % % Copyright (C) Daphne Koller, Stanford Univerity, 2012 function [accuracy, predicted_labels] = RecognizeActions(datasetTrain, datasetTest, G, maxIter) % INPUTS % datasetTrain: dataset for training models, see PA for details % datasetTest: dataset for testing models, see PA for details % ...
github
RoardFruit/pgm-master
ComputeExactMarginalsHMM.m
.m
pgm-master/PGM_Programming_Assignment_9/ComputeExactMarginalsHMM.m
1,613
utf_8
d2dad5ff1748ef025220bd22df9876ad
%COMPUTEEXACTMARGINALSHMM Runs exact inference and returns the marginals %over all the variables and the calibrated clique tree. % M = COMPUTEEXACTMARGINALSHMM(F) Takes a list of factors F, % and runs exact inference and returns the calibrated clique tree (unnormalized) and % final marginals (normalized) for the...
github
RoardFruit/pgm-master
submit.m
.m
pgm-master/PGM_Programming_Assignment_9/submit.m
22,612
utf_8
3c90403ef5f9b0b52e55bbf559b97d22
function submit(partId, webSubmit) %SUBMIT Submit your code and output to the pgm-class servers % SUBMIT() will connect to the pgm-class server and submit your solution % There is no penalty for submitting, so go ahead and try this! % % If this function does not work for you, use the web-submission mechanism. % ...
github
RoardFruit/pgm-master
VisualizeDataset.m
.m
pgm-master/PGM_Programming_Assignment_9/VisualizeDataset.m
243
utf_8
ce8d4d0fc87937b06c2daa5552ff0330
% File: VisualizeDataset.m % % Copyright (C) Daphne Koller, Stanford Univerity, 2012 function VisualizeDataset(Dataset) figure for i=1:size(Dataset,1) img = ShowPose(reshape(Dataset(i,:,:), [10 3])); imshow(img); pause(0.3); end
github
RoardFruit/pgm-master
AssignmentToIndex.m
.m
pgm-master/PGM_Programming_Assignment_9/AssignmentToIndex.m
609
utf_8
3c17a18df90fc3a49aeebcb3e418e23f
% AssignmentToIndex Convert assignment to index. % % I = AssignmentToIndex(A, D) converts an assignment, A, over variables % with cardinality D to an index into the .val vector for a factor. % If A is a matrix then the function converts each row of A to an index. % % See also IndexToAssignment.m % % Copyright ...
github
RoardFruit/pgm-master
submitWeb.m
.m
pgm-master/PGM_Programming_Assignment_9/submitWeb.m
580
utf_8
5f4510147426716d140b1e22e95d36d7
% submitWeb Creates files from your code and output for web submission. % % If the submit function does not work for you, use the web-submission mechanism. % Call this function to produce a file for the part you wish to submit. Then, % submit the file to the class servers using the "Web Submission" button on ...
github
RoardFruit/pgm-master
FitLG.m
.m
pgm-master/PGM_Programming_Assignment_9/FitLG.m
1,648
utf_8
fb35b5bf14764213e24bf53eeba348ea
% File: FitLG.m % % Copyright (C) Daphne Koller, Stanford Univerity, 2012 function [Beta sigma] = FitLG(X, U, W) % Estimate parameters of the linear Gaussian model: % X|U ~ N(Beta(1)*U(1) + ... + Beta(K)*U(K) + Beta(K+1), sigma^2); % Note that Matlab index from 1, we can't write Beta(0). So Beta(K+1) is % essentiall...
github
RoardFruit/pgm-master
EM_cluster.m
.m
pgm-master/PGM_Programming_Assignment_9/EM_cluster.m
5,447
utf_8
8446f09ce75c0f3f0f149bf1513fb54f
% File: EM_cluster.m % % Copyright (C) Daphne Koller, Stanford Univerity, 2012 function [P loglikelihood ClassProb] = EM_cluster(poseData, G, InitialClassProb, maxIter) % INPUTS % poseData: N x 10 x 3 matrix, where N is number of poses; % poseData(i,:,:) yields the 10x3 matrix for pose i. % G: graph parameterizatio...
github
RoardFruit/pgm-master
logsumexp.m
.m
pgm-master/PGM_Programming_Assignment_9/logsumexp.m
341
utf_8
4a201a5a36500a989a523c436ac4b69e
% File: logsumexp.m % % Copyright (C) Daphne Koller, Stanford Univerity, 2012 function out = logsumexp(A) % LOGSUMEXP % Computes log( sum( exp( ) ) ) of each row in A in a way that avoids underflow. % If A is an N x M matrix, then out is a N x 1 vector. pi_max = max(A, [], 2); out = pi_max + log(sum(exp(bsxfun(@minu...
github
RoardFruit/pgm-master
ShowPose.m
.m
pgm-master/PGM_Programming_Assignment_8/ShowPose.m
1,432
utf_8
480c7ad39d9caf52ad16fd8cc5253326
% Copyright (C) Daphne Koller, Stanford Univerity, 2012 % % Author: Huayan Wang, Andrew Duchi % visualize a configuration the body parts function img = ShowPose( pose ) % pose 10 x 3. 10 : body parts, % 3 : y, x, alpha pose(:,1) = pose(:,1) + 100; pose(:,2) = pose(:,2) + 150; pose = reshape(pose, [...
github
RoardFruit/pgm-master
lognormpdf.m
.m
pgm-master/PGM_Programming_Assignment_8/lognormpdf.m
159
utf_8
145eafca5ce4cf649ea5bd971005f278
% % Copyright (C) Daphne Koller, Stanford Univerity, 2012 function val = lognormpdf(x, mu, sigma) val = - (x - mu).^2 / (2*sigma^2) - log (sqrt(2*pi) * sigma);
github
RoardFruit/pgm-master
VisualizeModels.m
.m
pgm-master/PGM_Programming_Assignment_8/VisualizeModels.m
629
utf_8
f55ff303692ab3b671abf8d6655d3345
% Copyright (C) Daphne Koller, Stanford Univerity, 2012 % % Author: Huayan Wang function VisualizeModels(P, G) K = length(P.c); f = figure; while(1) for k=1:K subplot(1,K,k); if size(G,3) == 1 % same graph structure for all classes pose = SamplePose(P,G,k); ...
github
RoardFruit/pgm-master
submit.m
.m
pgm-master/PGM_Programming_Assignment_8/submit.m
24,472
utf_8
fe506b2c798ad661b509d57cbddf4bf3
function submit(partId, webSubmit) %SUBMIT Submit your code and output to the pgm-class servers % SUBMIT() will connect to the pgm-class server and submit your solution % There is no penalty for submitting, so go ahead and try this! % % If this function does not work for you, use the web-submission mechanism. % ...
github
RoardFruit/pgm-master
VisualizeDataset.m
.m
pgm-master/PGM_Programming_Assignment_8/VisualizeDataset.m
316
utf_8
6cc0340af48645e3dae1185bb480284d
% Copyright (C) Daphne Koller, Stanford Univerity, 2012 % % Author: Huayan Wang function VisualizeDataset(Dataset) f = figure; for i=1:size(Dataset,1) img = ShowPose(reshape(Dataset(i,:,:), [10 3])); imshow(img); pause(0.3) if (~ishandle(f)) break; end; % quit loop when user closes the figure end
github
RoardFruit/pgm-master
MaxSpanningTree.m
.m
pgm-master/PGM_Programming_Assignment_8/MaxSpanningTree.m
2,102
utf_8
e2eb7e917fac0c48eb37d69923cae975
function adj = MaxSpanningTree (weights) % MAXSPANNINGTREE Maximum weight spanning tree % % adj = MaxSpanningTree(weights) takes an n-by-n weight matrix, which % should be symmetric, and returns an adjacency list representation of % the maximum weight spanning tree. The adjacency list will be directed, % i.e...
github
RoardFruit/pgm-master
submitWeb.m
.m
pgm-master/PGM_Programming_Assignment_8/submitWeb.m
580
utf_8
5f4510147426716d140b1e22e95d36d7
% submitWeb Creates files from your code and output for web submission. % % If the submit function does not work for you, use the web-submission mechanism. % Call this function to produce a file for the part you wish to submit. Then, % submit the file to the class servers using the "Web Submission" button on ...
github
RoardFruit/pgm-master
SampleMultinomial.m
.m
pgm-master/PGM_Programming_Assignment_8/SampleMultinomial.m
302
utf_8
1d4d597a8553fbb1755bcb12fc4896e4
% Copyright (C) Daphne Koller, Stanford Univerity, 2012 function sample = SampleMultinomial(probabilities) dice = rand(1,1); accumulate = 0; for i=1:length(probabilities) accumulate = accumulate + probabilities(i); if accumulate/sum(probabilities) > dice break end end sample = i;
github
RoardFruit/pgm-master
ConvertAtoG.m
.m
pgm-master/PGM_Programming_Assignment_8/ConvertAtoG.m
496
utf_8
87fd4ba90b7e638012bb98d0af9ac21d
% File: ConvertAtoG.m % % Copyright (C) Daphne Koller, Stanford Univerity, 2012 % % Author: Huayan Wang function G = ConvertAtoG(A) G = zeros(10,2); A = A + A'; G(1,:) = [0 0]; visited = zeros(10,1); visited(1) = 1; cnt = 0; while sum(visited) < 10 cnt = cnt+1; for i=2:10 for j=1:10 if ...
github
RoardFruit/pgm-master
IndexToAssignment.m
.m
pgm-master/PGM-Programming_Assignment_1/IndexToAssignment.m
599
utf_8
ae992bdc926d3d43576329d3737682a2
% IndexToAssignment Convert index to variable assignment. % % A = IndexToAssignment(I, D) converts an index, I, into the .val vector % into an assignment over variables with cardinality D. If I is a vector, % then the function produces a matrix of assignments, one assignment % per row. % % See also A...
github
RoardFruit/pgm-master
FactorMarginalization.m
.m
pgm-master/PGM-Programming_Assignment_1/FactorMarginalization.m
1,663
utf_8
e13f6090c12d9a954c56893a8b8526d0
% FactorMarginalization Sums given variables out of a factor. % B = FactorMarginalization(A,V) computes the factor with the variables % in V summed out. The factor data structure has the following fields: % .var Vector of variables in the factor, e.g. [1 2 3] % .card Vector of cardinalities cor...
github
RoardFruit/pgm-master
FactorProduct.m
.m
pgm-master/PGM-Programming_Assignment_1/FactorProduct.m
2,400
utf_8
cdd7f3aedfa0173fb43e9fafcc51baf4
% FactorProduct Computes the product of two factors. % C = FactorProduct(A,B) computes the product between two factors, A and B, % where each factor is defined over a set of variables with given dimension. % The factor data structure has the following fields: % .var Vector of variables in the factor,...
github
RoardFruit/pgm-master
submit.m
.m
pgm-master/PGM-Programming_Assignment_1/submit.m
22,940
utf_8
a27c89f0871722dbca10d1936da76cae
function submit(partId, webSubmit) %SUBMIT Submit your code and output to the pgm-class servers % SUBMIT() will connect to the pgm-class server and submit your solution % There is no penalty for submitting, so go ahead and try this! % Call this function without arguments (i.e. submit). Make sure your working % ...
github
RoardFruit/pgm-master
StandardizeFactors.m
.m
pgm-master/PGM-Programming_Assignment_1/StandardizeFactors.m
580
utf_8
7a3d0747a3a6e0c14ac93de9d8daad84
% Function that sorts the variables in F and returns an equivalent % factor G. Used only to standardize output for grading purposes. function G = StandardizeFactors(F) G = struct('var', [], 'card', [], 'val', []); for i = 1:length(F) G(i) = StandardizeFactor(F(i)); end function G = StandardizeFactor(F) G = struc...
github
RoardFruit/pgm-master
GetValueOfAssignment.m
.m
pgm-master/PGM-Programming_Assignment_1/GetValueOfAssignment.m
806
utf_8
a63908225b529b3a7d605707c809a0a2
% GetValueOfAssignment Gets the value of a variable assignment in a factor. % % v = GetValueOfAssignment(F, A) returns the value of a variable assignment, % A, in factor F. The order of the variables in A are assumed to be the % same as the order in F.var. % % v = GetValueOfAssignment(F, A, VO) gets the v...
github
RoardFruit/pgm-master
ComputeMarginal.m
.m
pgm-master/PGM-Programming_Assignment_1/ComputeMarginal.m
1,409
utf_8
acfca93e1eeae09797944ca2648dbf94
%ComputeMarginal Computes the marginal over a set of given variables % M = ComputeMarginal(V, F, E) computes the marginal over variables V % in the distribution induced by the set of factors F, given evidence E % % M is a factor containing the marginal over variables V % V is a vector containing the variab...
github
RoardFruit/pgm-master
AssignmentToIndex.m
.m
pgm-master/PGM-Programming_Assignment_1/AssignmentToIndex.m
601
utf_8
2c6715c575574bb93ebc1dd4a52002ac
% AssignmentToIndex Convert assignment to index. % % I = AssignmentToIndex(A, D) converts an assignment, A, over variables % with cardinality D to an index into the .val vector for a factor. % If A is a matrix then the function converts each row of A to an index. % % See also IndexToAssignment.m and Fact...
github
RoardFruit/pgm-master
submitWeb.m
.m
pgm-master/PGM-Programming_Assignment_1/submitWeb.m
829
utf_8
f9a016a2c73dbb464925709b4f7c2f51
% submitWeb Creates files from your code and output for web submission. % % If the submit function does not work for you, use the web-submission mechanism. % Call this function to produce a file for the part you wish to submit. Then, % submit the file to the class servers using the "Web Submission" button on ...
github
RoardFruit/pgm-master
ComputeJointDistribution.m
.m
pgm-master/PGM-Programming_Assignment_1/ComputeJointDistribution.m
1,187
utf_8
7895a06efc121b109820aaba0e8e9f5d
%ComputeJointDistribution Computes the joint distribution defined by a set % of given factors % % Joint = ComputeJointDistribution(F) computes the joint distribution % defined by a set of given factors % % Joint is a factor that encapsulates the joint distribution given by F % F is a vector of factors (s...
github
RoardFruit/pgm-master
ObserveEvidence.m
.m
pgm-master/PGM-Programming_Assignment_1/ObserveEvidence.m
2,086
utf_8
1530655648211964ad075bff5e8b2873
% ObserveEvidence Modify a vector of factors given some evidence. % F = ObserveEvidence(F, E) sets all entries in the vector of factors, F, % that are not consistent with the evidence, E, to zero. F is a vector of % factors, each a data structure with the following fields: % .var Vector of variables in...
github
RoardFruit/pgm-master
SetValueOfAssignment.m
.m
pgm-master/PGM-Programming_Assignment_1/SetValueOfAssignment.m
1,155
utf_8
8c432b1246dea3f405d525c595d2a82f
% SetValueOfAssignment Sets the value of a variable assignment in a factor. % % F = SetValueOfAssignment(F, A, v) sets the value of a variable assignment, % A, in factor F to v. The order of the variables in A are assumed to be the % same as the order in F.var. % % F = SetValueOfAssignment(F, A, v, VO) se...
github
RoardFruit/pgm-master
ComputeExactMarginalsBP.m
.m
pgm-master/PGM-Programming_Assignment_4/ComputeExactMarginalsBP.m
1,647
utf_8
451e9b8376cf11dadc170d308e631bb1
%COMPUTEEXACTMARGINALSBP Runs exact inference and returns the marginals %over all the variables (if isMax == 0) or the max-marginals (if isMax == 1). % % M = COMPUTEEXACTMARGINALSBP(F, E, isMax) takes a list of factors F, % evidence E, and a flag isMax, runs exact inference and returns the % final marginals for ...
github
RoardFruit/pgm-master
EliminateVar.m
.m
pgm-master/PGM-Programming_Assignment_4/EliminateVar.m
1,346
utf_8
d107c19a06837def63e9460f88420c58
% Function used in production of clique trees % % Copyright (C) Daphne Koller, Stanford University, 2012 function [newF C E] = EliminateVar(F, C, E, Z) useFactors = []; scope = []; for i=1:length(F) if any(F(i).var == Z) useFactors = [useFactors i]; scope = union(scope, F(i).var); end end % ...
github
RoardFruit/pgm-master
IndexToAssignment.m
.m
pgm-master/PGM-Programming_Assignment_4/IndexToAssignment.m
641
utf_8
4500d5b7500f21f11c89b80922de3c42
% IndexToAssignment Convert index to variable assignment. % % A = IndexToAssignment(I, D) converts an index, I, into the .val vector % into an assignment over variables with cardinality D. If I is a vector, % then the function produces a matrix of assignments, one assignment % per row. % % See also Assignme...
github
RoardFruit/pgm-master
CliqueTreeCalibrate.m
.m
pgm-master/PGM-Programming_Assignment_4/CliqueTreeCalibrate.m
2,820
utf_8
54c591e9667fcf8b407de64fc7875510
%CLIQUETREECALIBRATE Performs sum-product or max-product algorithm for %clique tree calibration. % P = CLIQUETREECALIBRATE(P, isMax) calibrates a given clique tree, P % according to the value of isMax flag. If isMax is 1, it uses max-sum % message passing, otherwise uses sum-product. This function % returns...
github
RoardFruit/pgm-master
FactorMarginalization.m
.m
pgm-master/PGM-Programming_Assignment_4/FactorMarginalization.m
1,691
utf_8
1a6c278432109b94853fa27ff43fe933
% FactorMarginalization Sums given variables out of a factor. % B = FactorMarginalization(A,V) computes the factor with the variables % in V summed out. The factor data structure has the following fields: % .var Vector of variables in the factor, e.g. [1 2 3] % .card Vector of cardinalities corresp...
github
RoardFruit/pgm-master
DecodedMarginalsToChars.m
.m
pgm-master/PGM-Programming_Assignment_4/DecodedMarginalsToChars.m
218
utf_8
02261a4f2b86ec598a6e1c7e98525853
% Copyright (C) Daphne Koller, Stanford University, 2012 function DecodedMarginalsToChars(decodedMarginals) chars = 'abcdefghijklmnopqrstuvwxyz'; fprintf('%c', chars(decodedMarginals)); fprintf('\n'); end
github
RoardFruit/pgm-master
MaxDecoding.m
.m
pgm-master/PGM-Programming_Assignment_4/MaxDecoding.m
887
utf_8
4f091e534c5df5b64aba764e74978683
%MAXDECODING Finds the best assignment for each variable from the marginals M %passed in. Returns A such that A(i) returns the index of the best %instantiation for variable i. % % For instance: Let's say we have two variables 1 and 2. % Marginals for 1 = [0.1, 0.3, 0.6] % Marginals for 2 = [0.92, 0.08] % A(1) ...
github
RoardFruit/pgm-master
FactorProduct.m
.m
pgm-master/PGM-Programming_Assignment_4/FactorProduct.m
2,357
utf_8
06035e60b1296257aaf43c3e4e8aa15c
% FactorProduct Computes the product of two factors. % C = FactorProduct(A,B) computes the product between two factors, A and B, % where each factor is defined over a set of variables with given dimension. % The factor data structure has the following fields: % .var Vector of variables in the factor, e.g...
github
RoardFruit/pgm-master
submit.m
.m
pgm-master/PGM-Programming_Assignment_4/submit.m
28,922
utf_8
b8b1d235d74470e02883bb719fbc8e8c
function submit(partId, webSubmit) %SUBMIT Submit your code and output to the pgm-class servers % SUBMIT() will connect to the pgm-class server and submit your solution % There is no penalty for submitting, so go ahead and try this! % % If this function does not work for you, use the web-submission mechanism. % ...
github
RoardFruit/pgm-master
StandardizeFactors.m
.m
pgm-master/PGM-Programming_Assignment_4/StandardizeFactors.m
621
utf_8
f622aaecac8d0b7e4493aacd074eda6c
% Function that sorts the variables in F and returns an equivalent % factor G. Used only to standardize output for grading purposes. function G = StandardizeFactors(F) G = struct('var', [], 'card', [], 'val', []); for i = 1:length(F) G(i) = StandardizeFactor(F(i)); end function G = StandardizeFactor(F); G = stru...
github
RoardFruit/pgm-master
ComputeInitialPotentials.m
.m
pgm-master/PGM-Programming_Assignment_4/ComputeInitialPotentials.m
2,354
utf_8
77a5fe2874dc780c030856afa5b5a255
%COMPUTEINITIALPOTENTIALS Sets up the cliques in the clique tree that is %passed in as a parameter. % % P = COMPUTEINITIALPOTENTIALS(C) Takes the clique tree skeleton C which is a % struct with three fields: % - nodes: cell array representing the cliques in the tree. % - edges: represents the adjacency matrix o...
github
RoardFruit/pgm-master
GetValueOfAssignment.m
.m
pgm-master/PGM-Programming_Assignment_4/GetValueOfAssignment.m
838
utf_8
44eefd1a7a3ae4efe72c80711a4ac67d
% GetValueOfAssignment Gets the value of a variable assignment in a factor. % % v = GetValueOfAssignment(F, A) returns the value of a variable assignment, % A, in factor F. The order of the variables in A are assumed to be the % same as the order in F.var. % % v = GetValueOfAssignment(F, A, VO) gets the value o...
github
RoardFruit/pgm-master
GetNextCliques.m
.m
pgm-master/PGM-Programming_Assignment_4/GetNextCliques.m
1,802
utf_8
b29734f0efb9a5aa49155ef80d99d370
%GETNEXTCLIQUES Find a pair of cliques ready for message passing % [i, j] = GETNEXTCLIQUES(P, messages) finds ready cliques in a given % clique tree, P, and a matrix of current messages. Returns indices i and j % such that clique i is ready to transmit a message to clique j. % % We are doing clique tree message...
github
RoardFruit/pgm-master
FactorMaxMarginalization.m
.m
pgm-master/PGM-Programming_Assignment_4/FactorMaxMarginalization.m
2,024
utf_8
7d45c387b40a9d630826afeb61ffba82
% FactorMaxMarginalization Max-marginalizes a factor % by taking the max over a given set variables. % % B = FactorMaxMarginalization(A,V) computes the factor with the variables % in V maxed out. The factor data structure has the following fields: % .var Vector of variables in the factor, e.g. [1 2 3] % ...
github
RoardFruit/pgm-master
ComputeMarginal.m
.m
pgm-master/PGM-Programming_Assignment_4/ComputeMarginal.m
1,227
utf_8
67b61710048f402adfa7ea23875b4872
%ComputeMarginal Computes the marginal over a set of given variables % M = ComputeMarginal(V, F, E) computes the marginal over variables V % in the distribution induced by the set of factors F, given evidence E % % M is a factor containing the marginal over variables V % V is a vector containing the variables i...
github
RoardFruit/pgm-master
AssignmentToIndex.m
.m
pgm-master/PGM-Programming_Assignment_4/AssignmentToIndex.m
622
utf_8
3da521179d034588af2bfe11ed13f8f7
% AssignmentToIndex Convert assignment to index. % % I = AssignmentToIndex(A, D) converts an assignment, A, over variables % with cardinality D to an index into the .val vector for a factor. % If A is a matrix then the function converts each row of A to an index. % % See also IndexToAssignment.m % % Copyright ...
github
RoardFruit/pgm-master
CreateCliqueTree.m
.m
pgm-master/PGM-Programming_Assignment_4/CreateCliqueTree.m
2,238
utf_8
0b309fb32a6aee40615f6221d60a710e
%CREATECLIQUETREE Takes in a list of factors F, Evidence and returns a %clique tree after calling ComputeInitialPotentials at the end. % % P = CREATECLIQUETREE(F, Evidence) Takes a list of factors and creates a clique % tree. The value of the cliques should be initialized to % the initial potential. % It ret...
github
RoardFruit/pgm-master
submitWeb.m
.m
pgm-master/PGM-Programming_Assignment_4/submitWeb.m
581
utf_8
40868cac2a1f7de8fbdc5855c255d44d
% submitWeb Creates files from your code and output for web submission. % % If the submit function does not work for you, use the web-submission mechanism. % Call this function to produce a file for the part you wish to submit. Then, % submit the file to the class servers using the "Web Submission" button on ...
github
RoardFruit/pgm-master
ComputeJointDistribution.m
.m
pgm-master/PGM-Programming_Assignment_4/ComputeJointDistribution.m
1,270
utf_8
f5233de99da1f71ac79340c59698670d
%ComputeJointDistribution Computes the joint distribution defined by a set % of given factors % % Joint = ComputeJointDistribution(F) computes the joint distribution % defined by a set of given factors % % Joint is a factor that encapsulates the joint distribution given by F % F is a vector of factors (s...
github
RoardFruit/pgm-master
ObserveEvidence.m
.m
pgm-master/PGM-Programming_Assignment_4/ObserveEvidence.m
2,193
utf_8
4af4a267a25aaff99190410099accb86
% ObserveEvidence Modify a vector of factors given some evidence. % F = ObserveEvidence(F, E) sets all entries in the vector of factors, F, % that are not consistent with the evidence, E, to zero. F is a vector of % factors, each a data structure with the following fields: % .var Vector of variables in the...
github
RoardFruit/pgm-master
SetValueOfAssignment.m
.m
pgm-master/PGM-Programming_Assignment_4/SetValueOfAssignment.m
1,181
utf_8
6a83e76d1be90e51b6e7eba649f9f209
% SetValueOfAssignment Sets the value of a variable assignment in a factor. % % F = SetValueOfAssignment(F, A, v) sets the value of a variable assignment, % A, in factor F to v. The order of the variables in A are assumed to be the % same as the order in F.var. % % F = SetValueOfAssignment(F, A, v, VO) sets the...
github
RoardFruit/pgm-master
BlockLogDistribution.m
.m
pgm-master/PGM-Programming_Assignment_5/BlockLogDistribution.m
3,141
utf_8
27f9e393ddc6677c6660a82b2eb481f2
%BLOCKLOGDISTRIBUTION % % LogBS = BlockLogDistribution(V, G, F, A) returns the log of a % block-sampling array (which contains the log-unnormalized-probabilities of % selecting each label for the block), given variables V to block-sample in % network G with factors F and current assignment A. Note that the var...
github
RoardFruit/pgm-master
ComputeExactMarginalsBP.m
.m
pgm-master/PGM-Programming_Assignment_5/ComputeExactMarginalsBP.m
1,647
utf_8
451e9b8376cf11dadc170d308e631bb1
%COMPUTEEXACTMARGINALSBP Runs exact inference and returns the marginals %over all the variables (if isMax == 0) or the max-marginals (if isMax == 1). % % M = COMPUTEEXACTMARGINALSBP(F, E, isMax) takes a list of factors F, % evidence E, and a flag isMax, runs exact inference and returns the % final marginals for ...
github
RoardFruit/pgm-master
randi.m
.m
pgm-master/PGM-Programming_Assignment_5/randi.m
832
utf_8
d476049b924b22f35261e4d287bbe4b3
% Copyright (C) Daphne Koller, Stanford University, 2012 function [num mv] = randi(arg1,arg2,arg3) num = -1; persistent x_i; persistent p1; persistent p2; if(isempty(x_i)) x_i = 1; p1 = 160481183; p2 = 179424673; end mv=p2; if(ischar(arg1)==1) if(strcmp(arg1,'seed')) if(nargin>1) x_i = arg2; n...
github
RoardFruit/pgm-master
IndexToAssignment.m
.m
pgm-master/PGM-Programming_Assignment_5/IndexToAssignment.m
641
utf_8
4500d5b7500f21f11c89b80922de3c42
% IndexToAssignment Convert index to variable assignment. % % A = IndexToAssignment(I, D) converts an index, I, into the .val vector % into an assignment over variables with cardinality D. If I is a vector, % then the function produces a matrix of assignments, one assignment % per row. % % See also Assignme...
github
RoardFruit/pgm-master
CliqueTreeCalibrate.m
.m
pgm-master/PGM-Programming_Assignment_5/CliqueTreeCalibrate.m
2,820
utf_8
54c591e9667fcf8b407de64fc7875510
%CLIQUETREECALIBRATE Performs sum-product or max-product algorithm for %clique tree calibration. % P = CLIQUETREECALIBRATE(P, isMax) calibrates a given clique tree, P % according to the value of isMax flag. If isMax is 1, it uses max-sum % message passing, otherwise uses sum-product. This function % returns...
github
RoardFruit/pgm-master
ExtractMarginalsFromSamples.m
.m
pgm-master/PGM-Programming_Assignment_5/ExtractMarginalsFromSamples.m
1,091
utf_8
529a32b21a4c107460200c7c4c5a8e6a
%EXTRACTMARGINALSFROMSAMPLES % % ExtractMarginalsFromSamples takes in a probabilistic network G, a list of samples, and a set % of indices into samples that specify which samples to use in the computation of the % marginals. The marginals are then computed using this subset of samples and returned. % % Samples...
github
RoardFruit/pgm-master
randsample.m
.m
pgm-master/PGM-Programming_Assignment_5/randsample.m
1,542
utf_8
c010fcf86cbd91a7dc9bb6cc67f2d289
%randsample(V,n,true,distribution) returns a set of n values sampled % at random from the integers 1 through V with replacement using distribution % 'distribution' % % replacing true with false causes sampling w/out replacement % omitting the distribution causes a default to the uniform distribution % % Copyright (C) ...
github
RoardFruit/pgm-master
ClusterGraphCalibrate.m
.m
pgm-master/PGM-Programming_Assignment_5/ClusterGraphCalibrate.m
3,994
utf_8
835edc342e6b31e3bd9ea8928fb1d507
% CLUSTERGRAPHCALIBRATE Loopy belief propagation for cluster graph calibration. % P = CLUSTERGRAPHCALIBRATE(P, useSmart) calibrates a given cluster graph, G, % and set of of factors, F. The function returns the final potentials for % each cluster. % The cluster graph data structure has the following fields: % ...
github
RoardFruit/pgm-master
FactorMarginalization.m
.m
pgm-master/PGM-Programming_Assignment_5/FactorMarginalization.m
1,750
utf_8
c5e05c8d4059cb32dcd028428a787bb2
% FactorMarginalization Sums given variables out of a factor. % B = FactorMarginalization(A,V) computes the factor with the variables % in V summed out. The factor data structure has the following fields: % .var Vector of variables in the factor, e.g. [1 2 3] % .card Vector of cardinalities corresp...
github
RoardFruit/pgm-master
VisualizeMCMCMarginals.m
.m
pgm-master/PGM-Programming_Assignment_5/VisualizeMCMCMarginals.m
2,554
utf_8
a52cdac6ed53a41190ef3528b2068e49
% VISUALIZEMCMCMARGINALS % % This function accepts a list of sample lists, each from a different MCMC run. It then visualizes % the estimated marginals for each variable in V over the lifetime of the MCMC run. % % samples_list - a list of sample lists; each sample list is a m-by-n matrix where m is the % number of sam...
github
RoardFruit/pgm-master
smooth.m
.m
pgm-master/PGM-Programming_Assignment_5/smooth.m
431
utf_8
e49120038d1ea24bfca2efe6051e172a
% Copyright (C) Daphne Koller, Stanford University, 2012 function [YY] = smooth(Y,window) if(~exist('window','var')) window =5; end if(mod(window,2)==0) window = window+1; end mid = (window+1)/2; len = length(Y); Smoother =zeros(len); for i=1:len dev = min([mid-1 min([i-1 len-i])]); % dev Smoother(i,(i-dev...
github
RoardFruit/pgm-master
FactorProduct.m
.m
pgm-master/PGM-Programming_Assignment_5/FactorProduct.m
2,357
utf_8
06035e60b1296257aaf43c3e4e8aa15c
% FactorProduct Computes the product of two factors. % C = FactorProduct(A,B) computes the product between two factors, A and B, % where each factor is defined over a set of variables with given dimension. % The factor data structure has the following fields: % .var Vector of variables in the factor, e.g...
github
RoardFruit/pgm-master
LogProbOfJointAssignment.m
.m
pgm-master/PGM-Programming_Assignment_5/LogProbOfJointAssignment.m
341
utf_8
3b24866daccab9ccaa5bde84906c38d2
% Returns the log probability of an assignment A in a distribution defined by factors F % % Copyright (C) Daphne Koller, Stanford University, 2012 function logp = LogProbOfJointAssignment(F, A) % work in log-space to prevent underflow logp = 0.0; for i = 1:length(F) logp = logp + log(GetValueOfAssignment(F(i), A,...
github
RoardFruit/pgm-master
MHSWTrans.m
.m
pgm-master/PGM-Programming_Assignment_5/MHSWTrans.m
4,272
utf_8
b25596cbd17ae5706be42003039457f4
% MHSWTRANS % % MCMC Metropolis-Hastings transition function that % utilizes the Swendsen-Wang proposal distribution. % A - The current joint assignment. This should be % updated to be the next assignment % G - The network % F - List of all factors % variant - a number (1 or 2) indicating the variant of Swe...
github
RoardFruit/pgm-master
submit.m
.m
pgm-master/PGM-Programming_Assignment_5/submit.m
37,742
utf_8
af0d03d5e8bbc6f624767b9f623ea8f8
function submit(partId, webSubmit) %SUBMIT Submit your code and output to the pgm-class servers % SUBMIT() will connect to the pgm-class server and submit your solution % There is no penalty for submitting, so go ahead and try this! % % If this function does not work for you, use the web-submission mechanism. % ...
github
RoardFruit/pgm-master
ConstructRandNetwork.m
.m
pgm-master/PGM-Programming_Assignment_5/ConstructRandNetwork.m
1,907
utf_8
eecd8be58b912f3050983100aa964b07
% % This is a script that constructs the toy network and outputs toy_network and toy_factors into % the environment. You should modify this file to change the parameters of the toy network. % % In this file, on_diag_weight represents the weight of the on-diagonal elements % in your pairwise CPDs (weight of agreement) ...
github
RoardFruit/pgm-master
NaiveGetNextClusters.m
.m
pgm-master/PGM-Programming_Assignment_5/NaiveGetNextClusters.m
1,337
utf_8
4c0440156c06acd7c81feb028ea45e2c
%NAIVEGETNEXTCLUSTERS Takes in a node adjacency matrix and returns the indices % of the nodes between which the m+1th message should be passed. % % Output [i j] % i = the origin of the m+1th message % j = the destination of the m+1th message % % This method should iterate over the messages in increasing o...
github
RoardFruit/pgm-master
ComputeInitialPotentials.m
.m
pgm-master/PGM-Programming_Assignment_5/ComputeInitialPotentials.m
2,155
utf_8
4e9e6a70ffa892c07c08a35886997c9b
%COMPUTEINITIALPOTENTIALS Sets up the cliques in the clique tree that is %passed in as a parameter. % P = COMPUTEINITIALPOTENTIALS(C) Takes the clique tree C which is a % struct with three fields: % - nodes: represents the cliques in the tree. % - edges: represents the adjacency matrix of the tree. % - facto...
github
RoardFruit/pgm-master
MHUniformTrans.m
.m
pgm-master/PGM-Programming_Assignment_5/MHUniformTrans.m
1,025
utf_8
53ca4f7dd2ec4457da23252d3c1dc269
% MHUNIFORMTRANS % % MCMC Metropolis-Hastings transition function that % utilizes the uniform proposal distribution. % A - The current joint assignment. This should be % updated to be the next assignment % G - The network % F - List of all factors % % Copyright (C) Daphne Koller, Stanford University, 2012 f...
github
RoardFruit/pgm-master
GetValueOfAssignment.m
.m
pgm-master/PGM-Programming_Assignment_5/GetValueOfAssignment.m
837
utf_8
5be53ec21ee2dc20753b783db51acd8c
%GETVALUEOFASSIGNMENT Gets the value of a variable assignment in a factor. % % v = GETVALUEOFASSIGNMENT(F, A) returns the value of a variable assignment, % A, in factor F. The order of the variables in A are assumed to be the % same as the order in F.var. % % v = GETVALUEOFASSIGNMENT(F, A, VO) gets the va...
github
RoardFruit/pgm-master
ComputeApproxMarginalsBP.m
.m
pgm-master/PGM-Programming_Assignment_5/ComputeApproxMarginalsBP.m
2,511
utf_8
7ec81a88af5fae6cfbf1630a5d456e01
% COMPUTEAPPROXMARGINALSBP Computation of approximate marginals using Loopy BP % M = COMPUTEAPPROXMARGINALSBP(F,E ) returns the approximate marginals over % each variable in F given the evidence E. % . % The Factor list F has the following fields: % - .var: indices of variables in the specified cluste...
github
RoardFruit/pgm-master
rand.m
.m
pgm-master/PGM-Programming_Assignment_5/rand.m
442
utf_8
305621a863b56b3e13a94716c53e494b
% Copyright (C) Daphne Koller, Stanford University, 2012 function [val] = rand(arg1,arg2); val = -1; gran = 1e6; if(nargin>0&&ischar(arg1)) if(nargin==1) arg2=1; end randi(arg1,arg2); val=0; else if(nargin==0) val = randi(1e6)/(1e6); else if(nargin==1) if(length(arg1)>1) arg2=arg...