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 | NEU-Gou/kernel-metric-learning-reid-master | icg_roc.m | .m | kernel-metric-learning-reid-master/Assistant Code/KISSME/toolbox/helper/icg_roc.m | 1,425 | utf_8 | 11d04e9c4c3db15aa1c3b9b771eff30e | function [tpr,fpr,thresh] = icg_roc(tp,confs)
% ICG_ROC computes ROC measures (tpr,fpr)
%
% Input:
% tp - [m x n] matrix of zero-one labels. one row per class.
% confs - [m x n] matrix of classifier scores. one row per class.
%
% Output:
% tpr - true positive rate in interval [0,1], [m x n+1] matrix
% ... |
github | NEU-Gou/kernel-metric-learning-reid-master | make.m | .m | kernel-metric-learning-reid-master/Assistant Code/KISSME/toolbox/lib/liblinear-2.1/matlab/make.m | 1,198 | utf_8 | 72532ef957c850421c786167742d0912 | % This make.m is for MATLAB and OCTAVE under Windows, Mac, and Unix
function make()
try
% This part is for OCTAVE
if(exist('OCTAVE_VERSION', 'builtin'))
mex libsvmread.c
mex libsvmwrite.c
mex -I.. train.c linear_model_matlab.c ../linear.cpp ../tron.cpp ../blas/daxpy.c ../blas/ddot.c ../blas/dnrm2.c ../blas/dsca... |
github | NEU-Gou/kernel-metric-learning-reid-master | lbp.m | .m | kernel-metric-learning-reid-master/Assistant Code/LBP/lbp.m | 6,280 | utf_8 | 57e3d9b82aa8caaa6045d2ef0e048479 | %LBP returns the local binary pattern image or LBP histogram of an image.
% J = LBP(I,R,N,MAPPING,MODE) returns either a local binary pattern
% coded image or the local binary pattern histogram of an intensity
% image I. The LBP codes are computed using N sampling points on a
% circle of radius R and using mapping... |
github | NEU-Gou/kernel-metric-learning-reid-master | getmapping.m | .m | kernel-metric-learning-reid-master/Assistant Code/LBP/getmapping.m | 5,222 | utf_8 | 54332fd445f20849f7554078eddeccef | %GETMAPPING returns a structure containing a mapping table for LBP codes.
% MAPPING = GETMAPPING(SAMPLES,MAPPINGTYPE) returns a
% structure containing a mapping table for
% LBP codes in a neighbourhood of SAMPLES sampling
% points. Possible values for MAPPINGTYPE are
% 'u2' for uniform LBP
% 'ri' fo... |
github | viniciusrpb/regiongrowing-master | filtroEDP.m | .m | regiongrowing-master/filtroEDP.m | 4,766 | UNKNOWN | b3e43d7c519ebff57c8935800b9e6864 | %Filtro de Suavizacao e Eliminacao de Ruidos baseado em Equacoes
% Diferenciais Parciais, proposto pela prof. Dra. Celia Aparecida
% Zorzo Barcelos.
%Implementado por Vinicius Ruela Pereira Borges, 08/01/2009
function U = filtroEDP(img,k,dt,T,LAMBDA)
% k = fator de suavizacao (quanto menor, maior eh a suavizacao)
... |
github | viniciusrpb/regiongrowing-master | cssDescriptor.m | .m | regiongrowing-master/cssDescriptor.m | 5,496 | utf_8 | f46b06ddc6581cb522a38cfec1189043 | function [descriptor,K] = cssDescriptor(x,y,sigma,numberOfPoints,thresh,dimensions)
nroPontos = length(x);
fator2 = 0.15;
sigmaAtual(1) = 0.05;
niveis = 1;
while(sigmaAtual(niveis) < sigma)
sigmaAtual(niveis+1) = double(sigmaAtual(niveis) + fator2);
niveis = niveis + 1;
end... |
github | viniciusrpb/regiongrowing-master | regionGrowingProcess.m | .m | regiongrowing-master/regionGrowingProcess.m | 3,272 | utf_8 | 6e7fb8a68cfff48e543c1cbf618cef61 | % Region growing algorithm based on Gonzalez, 2008: Digital Image Processing
% 3. ed.
% IMPORTANT: This implementation of region growing follows an iterative
% version proposed by Gonzalez et. al, 2008.
function bin = regionGrowingProcess(img,x,y,mu1,sigma1,mu2,sigma2,binTemp)
% Take the weight and width
[hei... |
github | viniciusrpb/regiongrowing-master | regionGrowingBasedSegmentation.m | .m | regiongrowing-master/regionGrowingBasedSegmentation.m | 8,994 | utf_8 | d6804b65e2d0e61efbb12c7f492aac1c | % INSTITUTO DE CIENCIAS MATEMATICAS E DE COMPUTACAO
% UNIVERSITY OF SAO PAULO, SAO CARLOS
% MATLAB CODE
% IMAGE SEGMEN
% LAST UPDATE: May, 12th 2016
function regionGrowingBasedSegmentation(path,pathSaida)
pngPath = sprintf('%s*.png',path);
list = dir(pngPath);
listSize = length(list);
%Flag write... |
github | viniciusrpb/regiongrowing-master | curvature.m | .m | regiongrowing-master/curvature.m | 1,504 | utf_8 | cc0ff9432463daedee472728b50699b3 | function [kappa,smoothKappa,normKappa] = curvature(x,y)
T = 25;
dt = 0.1;
tam = length(x);
smoothKappa(1:tam+2,1:T) = 0;
%Calcula angulo entre segmentos
kappa(1:tam+2) = 0;
xp(2:tam+1) = x;
yp(2:tam+1) = y;
xp(1) = x(end);
yp(1) = y(end);
xp(tam+2) = x(1);
yp(tam+2)... |
github | viniciusrpb/regiongrowing-master | cssSmoothing.m | .m | regiongrowing-master/cssSmoothing.m | 557 | utf_8 | 619e8ef9c63093c7f0b7bd3f20a56b4c | % Implementation of the Curvature Scale Space Descriptor
%
% INPUT: binary image img
% OUTPUT: the threshold cut at the CSS Map
function cutHere = cssSmoothing(img)
% Create background image
area = sum(sum(img));
boundaries = Extracao_Contorno(img);
x = boundaries(1,:);
y = boundaries(2,:);
... |
github | TWANG006/G-LS3U-master | fp_unwrapping.m | .m | G-LS3U-master/MatLab/fp_unwrapping.m | 1,456 | utf_8 | a8ab7fc56336415392af2fd6c3f0335d | function p=fp_unwrapping(p,start_x,start_y)
%FUNCTION
% p=fp_unwrapping(p,start_x,start_y)
%
%PURPOSE
% Line scanning phase unwrapping
%
%INPUTS
% p: wrapped phasethe phase distribution
% start_x: starting point for phase unwrapping, x
% start_y: starting point for phase unwrapping, y
%
%OUTPUT... |
github | TWANG006/G-LS3U-master | fp_wft2f.m | .m | G-LS3U-master/MatLab/fp_wft2f.m | 7,113 | utf_8 | cf0a15743672a522b91924255c402081 | function z=fp_wft2f(type,f,sigmax,wxl,wxi,wxh,sigmay,wyl,wyi,wyh,thr)
%FUNCTION
% z=fp_wft2f(type,f,sigmax,wxl,wxi,wxh,sigmay,wyl,wyi,wyh,thr)
%
%PURPOSE
% 2-D WFT [Fourier version]: Fourier transform is used to compute
% convolutions.
%
%INPUT
% type: 'wff' or 'wfr'
% f: 2D input signal
% sigmax: s... |
github | TWANG006/G-LS3U-master | fexpand.m | .m | G-LS3U-master/MatLab/fexpand.m | 368 | utf_8 | f4a53900abc7172106df6bc3bca744e7 | %INFO
% Last update: 28/07/2011, 05/10/2012, 12/12/2012
% Contact: mkmqian@ntu.edu.sg (Dr Qian Kemao)
% Copyright reserved.
%expand f to [m n]
%this function can be realized by padarray, but is slower
function f=fexpand(f,mm,nn)
%size f
[m n]=size(f);
%store f
f0=f;
%generate a larger matrix with size [mm nn]
f=... |
github | TWANG006/G-LS3U-master | fp_aia.m | .m | G-LS3U-master/MatLab/fp_aia.m | 2,791 | utf_8 | 8aa8e74c2df306eca3e82f276c92712e | function [phi delta iter err] = fp_aia(f, delta, max_iter, max_err)
%FUNCTION
% [phi delta iter err]=aia(f, delta, max_iter, max_err)
%
%PURPOSE
% Wang and Han's AIA for phase-shifting with arbitrary phase-shifts.
%
%INPUT
% f: 3-D matrix of size m*n*l (image size m*n, frame number l)
% delta: ini... |
github | facundoq/courses-master | submit.m | .m | courses-master/mlclassng/mlclass-ex4-005/submit.m | 17,129 | utf_8 | bf5c5c1ceefb6cad621d632888b78dd1 | function submit(partId, webSubmit)
%SUBMIT Submit your code and output to the ml-class servers
% SUBMIT() will connect to the ml-class server and submit your solution
fprintf('==\n== [ml-class] Submitting Solutions | Programming Exercise %s\n==\n', ...
homework_id());
if ~exist('partId', 'var') || isem... |
github | facundoq/courses-master | submitWeb.m | .m | courses-master/mlclassng/mlclass-ex4-005/submitWeb.m | 827 | utf_8 | bfb2fa08cac9d8d797e3071d3fdd7ca1 | % 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 | facundoq/courses-master | submit.m | .m | courses-master/mlclassng/mlclass-ex5-005/submit.m | 17,211 | utf_8 | 13a9995decf628307987cfb3364dd6a1 | function submit(partId, webSubmit)
%SUBMIT Submit your code and output to the ml-class servers
% SUBMIT() will connect to the ml-class server and submit your solution
fprintf('==\n== [ml-class] Submitting Solutions | Programming Exercise %s\n==\n', ...
homework_id());
if ~exist('partId', 'var') || isem... |
github | facundoq/courses-master | submitWeb.m | .m | courses-master/mlclassng/mlclass-ex5-005/submitWeb.m | 827 | utf_8 | bfb2fa08cac9d8d797e3071d3fdd7ca1 | % 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 | facundoq/courses-master | submit.m | .m | courses-master/mlclassng/mlclass-ex8-005/submit.m | 17,515 | utf_8 | f1320acecad5e41355ce270b4195c3db | function submit(partId, webSubmit)
%SUBMIT Submit your code and output to the ml-class servers
% SUBMIT() will connect to the ml-class server and submit your solution
fprintf('==\n== [ml-class] Submitting Solutions | Programming Exercise %s\n==\n', ...
homework_id());
if ~exist('partId', 'var') || isem... |
github | facundoq/courses-master | submitWeb.m | .m | courses-master/mlclassng/mlclass-ex8-005/submitWeb.m | 827 | utf_8 | bfb2fa08cac9d8d797e3071d3fdd7ca1 | % 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 | facundoq/courses-master | submit.m | .m | courses-master/mlclassng/mlclass-ex1-005/submit.m | 17,317 | utf_8 | c92fa7713d3c5747ef93f067dddcc54d | function submit(partId, webSubmit)
%SUBMIT Submit your code and output to the ml-class servers
% SUBMIT() will connect to the ml-class server and submit your solution
fprintf('==\n== [ml-class] Submitting Solutions | Programming Exercise %s\n==\n', ...
homework_id());
if ~exist('partId', 'var') || isem... |
github | facundoq/courses-master | submitWeb.m | .m | courses-master/mlclassng/mlclass-ex1-005/submitWeb.m | 827 | utf_8 | bfb2fa08cac9d8d797e3071d3fdd7ca1 | % 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 | facundoq/courses-master | submit.m | .m | courses-master/mlclassng/mlclass-ex2-005/mlclass-ex2/submit.m | 17,086 | utf_8 | 6f26069c12237f7a430ed09fc0c1b344 | function submit(partId, webSubmit)
%SUBMIT Submit your code and output to the ml-class servers
% SUBMIT() will connect to the ml-class server and submit your solution
fprintf('==\n== [ml-class] Submitting Solutions | Programming Exercise %s\n==\n', ...
homework_id());
if ~exist('partId', 'var') || isem... |
github | facundoq/courses-master | submitWeb.m | .m | courses-master/mlclassng/mlclass-ex2-005/mlclass-ex2/submitWeb.m | 827 | utf_8 | bfb2fa08cac9d8d797e3071d3fdd7ca1 | % 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 | facundoq/courses-master | submit.m | .m | courses-master/mlclassng/mlclass-ex6-005/submit.m | 16,836 | utf_8 | bbf9b999a1dae2f9a208e9edbfb6981a | function submit(partId, webSubmit)
%SUBMIT Submit your code and output to the ml-class servers
% SUBMIT() will connect to the ml-class server and submit your solution
fprintf('==\n== [ml-class] Submitting Solutions | Programming Exercise %s\n==\n', ...
homework_id());
if ~exist('partId', 'var') || isem... |
github | facundoq/courses-master | porterStemmer.m | .m | courses-master/mlclassng/mlclass-ex6-005/porterStemmer.m | 9,902 | utf_8 | 7ed5acd925808fde342fc72bd62ebc4d | function stem = porterStemmer(inString)
% Applies the Porter Stemming algorithm as presented in the following
% paper:
% Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14,
% no. 3, pp 130-137
% Original code modeled after the C version provided at:
% http://www.tartarus.org/~martin/PorterStemmer/c.tx... |
github | facundoq/courses-master | submitWeb.m | .m | courses-master/mlclassng/mlclass-ex6-005/submitWeb.m | 827 | utf_8 | bfb2fa08cac9d8d797e3071d3fdd7ca1 | % 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 | facundoq/courses-master | submit.m | .m | courses-master/mlclassng/mlclass-ex3-005/mlclass-ex3/submit.m | 17,041 | utf_8 | 3222eb8403790dbbf400354e1e71d0de | function submit(partId, webSubmit)
%SUBMIT Submit your code and output to the ml-class servers
% SUBMIT() will connect to the ml-class server and submit your solution
fprintf('==\n== [ml-class] Submitting Solutions | Programming Exercise %s\n==\n', ...
homework_id());
if ~exist('partId', 'var') || isem... |
github | facundoq/courses-master | submitWeb.m | .m | courses-master/mlclassng/mlclass-ex3-005/mlclass-ex3/submitWeb.m | 827 | utf_8 | bfb2fa08cac9d8d797e3071d3fdd7ca1 | % 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 | facundoq/courses-master | submit.m | .m | courses-master/mlclassng/mlclass-ex7-005/submit.m | 16,958 | utf_8 | 44af178969606b83916b59695dd1a568 | function submit(partId, webSubmit)
%SUBMIT Submit your code and output to the ml-class servers
% SUBMIT() will connect to the ml-class server and submit your solution
fprintf('==\n== [ml-class] Submitting Solutions | Programming Exercise %s\n==\n', ...
homework_id());
if ~exist('partId', 'var') || isem... |
github | facundoq/courses-master | submitWeb.m | .m | courses-master/mlclassng/mlclass-ex7-005/submitWeb.m | 827 | utf_8 | bfb2fa08cac9d8d797e3071d3fdd7ca1 | % 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 | facundoq/courses-master | ComputeExactMarginalsBP.m | .m | courses-master/pgm/p4/ComputeExactMarginalsBP.m | 2,013 | utf_8 | 356d51f3bd67254e5a4ff1a82fc31d4f | %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 | facundoq/courses-master | FactorSum.m | .m | courses-master/pgm/p4/FactorSum.m | 2,340 | utf_8 | d2e83cf81bd5e92fe61deaa53e6f4643 | % FactorSum Computes the sum of two factors.
% C = FactorProduct(A,B) computes the sum 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. [1 2 3]
% ... |
github | facundoq/courses-master | EliminateVar.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | IndexToAssignment.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | CliqueTreeCalibrate.m | .m | courses-master/pgm/p4/CliqueTreeCalibrate.m | 3,610 | utf_8 | 2c54be8808db19a03421528e2b0e6412 | %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 | facundoq/courses-master | FactorMarginalization.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | DecodedMarginalsToChars.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | MaxDecoding.m | .m | courses-master/pgm/p4/MaxDecoding.m | 933 | utf_8 | 5a3a81860c3e4efd46b5b7b9cb67d6f0 | %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 | facundoq/courses-master | FactorsSum.m | .m | courses-master/pgm/p4/FactorsSum.m | 707 | utf_8 | a03c697932279d1b1c7e0b84e8f119f8 | % FactorSum Computes the sum of two factors.
% C = FactorProduct(A,B) computes the sum 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. [1 2 3]
% ... |
github | facundoq/courses-master | FactorProduct.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | submit.m | .m | courses-master/pgm/p4/submit.m | 28,930 | utf_8 | 3e767e0b1938f984f7b29e22e066321d | 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 | facundoq/courses-master | StandardizeFactors.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | ComputeInitialPotentials.m | .m | courses-master/pgm/p4/ComputeInitialPotentials.m | 2,044 | utf_8 | a99695a5590d08313c5386fec70909a4 | %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 | facundoq/courses-master | GetValueOfAssignment.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | GetNextCliques.m | .m | courses-master/pgm/p4/GetNextCliques.m | 2,759 | utf_8 | 7e4effa84213f2cc1c89be9b6030a174 | %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 | facundoq/courses-master | FactorMaxMarginalization.m | .m | courses-master/pgm/p4/FactorMaxMarginalization.m | 1,968 | utf_8 | e662d931faa6c7201e6216627575204b | % 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 | facundoq/courses-master | ComputeMarginal.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | AssignmentToIndex.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | CreateCliqueTree.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | submitWeb.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | ComputeJointDistribution.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | eq_factors.m | .m | courses-master/pgm/p4/eq_factors.m | 372 | utf_8 | 0425650440c2e53ea5fb0979fb30200d | function eq=eq_factors(F1,F2)
assert(length(F1)==length(F2),'Both factor lists must have the same number of elements');
eq=true;
for i=1:length(F1)
if ~eq_factor(F1(i),F2(i))
eq=false;
break;
end
end
end
function eq=eq_factor(f1,f2)
eq= eq_eps(f1.var,f2.var) && e... |
github | facundoq/courses-master | comparedata.m | .m | courses-master/pgm/p4/comparedata.m | 12,980 | utf_8 | a7242d9a91fcd2959131f5fce367f085 | function retval=comparedata(data1, data2, context, Params)
% function retval=comparedata(data1, data2, context, Params)
% compares to see if data1 and data2 are roughly recursively equal. "Rough" here is defined by
% the Params. Note that matlabs ISEQUAL function is a test for exact equality. comparedata
% ... |
github | facundoq/courses-master | ObserveEvidence.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | SetValueOfAssignment.m | .m | courses-master/pgm/p4/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 | facundoq/courses-master | set_inclusion.m | .m | courses-master/pgm/p4/set_inclusion.m | 127 | utf_8 | 911e20355be2c91e5c65cb8350c2612a | %set_inclusion(a,b)
% true if all elements of vector a are in vector b
function r=set_inclusion(a,b)
r=all(ismember(a,b));
end |
github | facundoq/courses-master | EM_HMM.m | .m | courses-master/pgm/p9/EM_HMM.m | 6,667 | utf_8 | 94b98a6c15a38822e34e8dbad97b37e6 | % 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 i... |
github | facundoq/courses-master | ShowPose.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | lognormpdf.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | IndexToAssignment.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | CliqueTreeCalibrate.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | CreateCliqueTreeHMM.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | FitG.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | FactorMarginalization.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | RecognizeActions.m | .m | courses-master/pgm/p9/RecognizeActions.m | 3,320 | utf_8 | 397eca61a70e4305fe6aea2c683e9a87 | % 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 detail... |
github | facundoq/courses-master | estimate_initial_probabilities.m | .m | courses-master/pgm/p9/estimate_initial_probabilities.m | 1,383 | utf_8 | b597e18e197e28fee0bc8407b90e5618 | function dataset=estimate_initial_probabilities(dataset,k_poses)
for i=1:length(dataset)
action_samples=dataset(i);
[action_samples.InitialClassProb, action_samples.InitialPairProb]=estimate_initial_probabilities_class(action_samples,k_poses);
dataset(i)=action_samples;
end
end
function [class_prob,pair_... |
github | facundoq/courses-master | ComputeExactMarginalsHMM.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | submit.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | ComputeClassLikelihoodSample.m | .m | courses-master/pgm/p9/ComputeClassLikelihoodSample.m | 2,485 | utf_8 | a4d345390cfad113fd8a5395f8a8f243 | function class_l = ComputeClassLikelihoodSample(P, G, sample)
% You should compute the log likelihood of data as in eq. (12) and (13)
% in the PA description
% Hint: Use lognormpdf instead of log(normpdf) to prevent underflow.
% You may use log(sum(exp(logProb))) to do addition in the original
% space, sum... |
github | facundoq/courses-master | VisualizeDataset.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | AssignmentToIndex.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | submitWeb.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | FitLG.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | PrintFactor.m | .m | courses-master/pgm/p9/PrintFactor.m | 526 | utf_8 | 7ab925539a614f01ebbef8c4c001d3c2 | % Copyright (C) Daphne Koller, Stanford University, 2012
function [] = PrintFactor(F)
% Pretty print the factor F.
% The first row lists the variables and subsequent rows are
% the joint assignment and their associated factor value in
% the last column.
for i=1:length(F.var)
fprintf(1, '%d\t', F.var(i... |
github | facundoq/courses-master | EM_cluster.m | .m | courses-master/pgm/p9/EM_cluster.m | 3,444 | utf_8 | 2a65249f9f25c300a24cfe746ca6f417 | % File: EM_cluster.m
%
% Copyright (C) Daphne Koller, Stanford Univerity, 2012
function [P, loglikelihood, soft_labels] = 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 parameteriz... |
github | facundoq/courses-master | CompareData.m | .m | courses-master/pgm/p9/CompareData.m | 12,989 | utf_8 | c611d62554c31e24c84df3ec9447f6ce | function retval = CompareData(data1, data2, context, Params)
% function retval = comparedata(data1, data2, context, Params)
% compares to see if data1 and data2 are roughly recursively equal. "Rough" here is defined by
% the Params. Note that matlabs ISEQUAL function is a test for exact equality. comparedata
% ... |
github | facundoq/courses-master | expand_dataset.m | .m | courses-master/pgm/p9/expand_dataset.m | 2,139 | utf_8 | 0d6505d19cd7a2361aef5b353deb1717 | function datasetTrain=expand_dataset(datasetTrain,expand_factor,perturbation_factor)
expand_factor=expand_factor-1;
if expand_factor<=0
return
end
for i=1:length(datasetTrain)
class_samples=datasetTrain(i);
[new_actions,new_poses]=perturb_class_actions(class_samples.actionData,class_samples.poseData,expand... |
github | facundoq/courses-master | logsumexp.m | .m | courses-master/pgm/p9/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 | facundoq/courses-master | LearnCPDsGivenGraph.m | .m | courses-master/pgm/p9/LearnCPDsGivenGraph.m | 2,802 | utf_8 | eb48720161e07326645907476762e2bf | function [P] = LearnCPDsGivenGraph(dataset, G, soft_labels)
%
% Inputs:
% dataset: N x 10 x 3, N poses represented by 10 parts in (y, x, alpha)
% G: graph parameterization as explained in PA description
% labels: N x 2 true class labels for the examples. labels(i,j)=1 if the
% the ith example belongs to class ... |
github | facundoq/courses-master | ComputeExactMarginalsBP.m | .m | courses-master/pgm/p7/ComputeExactMarginalsBP.m | 2,261 | utf_8 | 7c623bc99a6cabc2bfb5379ab75c4e06 | %COMPUTEEXACTMARGINALSBP Runs exact inference and returns the marginals
%over all the variables.
% M = COMPUTEEXACTMARGINALSBP(F,E, isMax) Takes a list of factors F,
% evidence E and a flag isMax and run exact inference and returns the
% final marginals for the variables in the network. If isMax is 1, then
% ... |
github | facundoq/courses-master | FactorSum.m | .m | courses-master/pgm/p7/FactorSum.m | 2,208 | utf_8 | b32940673c307cf1e23efcd1dc3cc9fe | % FactorProduct Computes the product of two factors.
% C = FactorSum(A,B) computes the sum of 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. [1 2 3]
% ... |
github | facundoq/courses-master | LRSearchLambdaSGD.m | .m | courses-master/pgm/p7/LRSearchLambdaSGD.m | 1,256 | utf_8 | 8e8df067cee7994d967166097b9e4aeb | % function allAcc = LRSearchLambdaSGD(Xtrain, Ytrain, Xvalidation, Yvalidation, lambdas)
% For each value of lambda provided, fit parameters to the training data and return
% the accuracy in the validation data in the corresponding entry of allAcc.
% For instance, allAcc(i) = accuracy in the validation set using lambda... |
github | facundoq/courses-master | LRPredict.m | .m | courses-master/pgm/p7/LRPredict.m | 514 | utf_8 | 0cd38f90588722af4558c1227da54620 | % pred = LRPredict(X, theta) uses the LR classifier encoded by theta
% to predict the labels on data X.
%
% Inputs:
% X data. (numInstances x numFeatures matrix)
% theta LR parameters. (numFeatures x 1 vector)
%
% Outputs:
% pred predicted labels for X. (numInstances... |
github | facundoq/courses-master | EliminateVar.m | .m | courses-master/pgm/p7/EliminateVar.m | 1,344 | utf_8 | 5eee22473a7397f75d71157c426f2ea7 | % Function used in production of clique trees
%
% Copyright (C) Daphne Koller, Stanford Univerity, 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
% u... |
github | facundoq/courses-master | StochasticGradientDescent.m | .m | courses-master/pgm/p7/StochasticGradientDescent.m | 1,649 | utf_8 | 680d4fdda11ed5ed5db6772f70e8ecd3 | % function thetaOpt = StochasticGradientDescent (gradFunc, theta0, maxiter)
% runs gradient descent until convergence, returning the optimal parameters thetaOpt.
%
% Inputs:
% gradFunc function handle to a function [cost, grad] = gradFunc(theta, i)
% that computes the LR cost / objective function and... |
github | facundoq/courses-master | IndexToAssignment.m | .m | courses-master/pgm/p7/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 | facundoq/courses-master | LRCostSGD.m | .m | courses-master/pgm/p7/LRCostSGD.m | 1,496 | utf_8 | d971795e0a6b27c9bc5e105958f368f5 | % [cost, grad] = LRCostSGD(X, y, theta, lambda, i) calculates the LR cost / objective
% function with respect to data instance (i mod n), given the LR classifier parameterized
% by theta and where n = the number of data instances. Also returns the gradient of
% the cost function with respect to data instance (i mod ... |
github | facundoq/courses-master | CliqueTreeCalibrate.m | .m | courses-master/pgm/p7/CliqueTreeCalibrate.m | 5,314 | utf_8 | 08c84518c832001d732bd798e1518e67 | %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
% r... |
github | facundoq/courses-master | GenerateAllFeatures.m | .m | courses-master/pgm/p7/GenerateAllFeatures.m | 2,513 | utf_8 | d5e82ae09bde41bb49215839c7ce6c1b | % This function is called by InstanceNegLogLikelihood.
% Its input/output is specified there.
% If you're interested in the implementation details of CRFs,
% feel free to read through this code!
% For the purposes of this assignment, though, you don't
% have to understand how this code works.
%
% Copyright (C) Daphne K... |
github | facundoq/courses-master | FactorMarginalization.m | .m | courses-master/pgm/p7/FactorMarginalization.m | 1,551 | utf_8 | 470be9bc98bbb2fb7e2b10913db1da6d | % 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 | facundoq/courses-master | LRTrainSGD.m | .m | courses-master/pgm/p7/LRTrainSGD.m | 1,353 | utf_8 | d3ef910e60f9f60de975d70858e94283 | % thetaOpt = LRTrainSGD(X, y, lambda) trains a logistic regression
% classifier using stochastic gradient descent. It returns the optimal theta values.
%
% Inputs:
% X data. (numInstances x numFeatures matrix)
% X(:,1) is all ones, i.e., it encodes the intercept/bias term.
%... |
github | facundoq/courses-master | MaxDecoding.m | .m | courses-master/pgm/p7/MaxDecoding.m | 659 | utf_8 | 9168d0f003f618eb31f0006d6c83970d | %MAXDECODING Finds the best assignment for each variable from the marginals
%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 | facundoq/courses-master | LRAccuracy.m | .m | courses-master/pgm/p7/LRAccuracy.m | 658 | utf_8 | bf10b837298e6f94c490327c020e201e | % function acc = LRAccuracy(GroundTruth, Predictions) compares the
% vector of predictions with the vector of ground truth values,
% and returns the accuracy (fraction of predictions that are correct).
%
% Input:
% GroundTruth (numInstances x 1 vector)
% Predictions (numInstances x 1 vector)
%
% Output:
% err... |
github | facundoq/courses-master | FactorProduct.m | .m | courses-master/pgm/p7/FactorProduct.m | 2,160 | utf_8 | 7f87add7a3c8bfac085a23c8cb2ba03c | % 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 | facundoq/courses-master | submit.m | .m | courses-master/pgm/p7/submit.m | 20,967 | utf_8 | c1248b5f208f3aacb05dd313678cdb8b | 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 | facundoq/courses-master | ComputeInitialPotentials.m | .m | courses-master/pgm/p7/ComputeInitialPotentials.m | 3,604 | utf_8 | 737d72093cf516b5431db5e4878b5891 | %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 | facundoq/courses-master | GetValueOfAssignment.m | .m | courses-master/pgm/p7/GetValueOfAssignment.m | 834 | utf_8 | 0a65aef1740618807fb9e95821268dab | %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 | facundoq/courses-master | GetNextCliques.m | .m | courses-master/pgm/p7/GetNextCliques.m | 1,742 | utf_8 | ba635097f61dfeba09e3885c9ee936b4 | %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 current messages. Returns indices i and j
% such that clique i is ready to transmit a message to clique j.
% If no such cliques exist, returns i = j = 0
%
... |
github | facundoq/courses-master | FactorMaxMarginalization.m | .m | courses-master/pgm/p7/FactorMaxMarginalization.m | 1,694 | utf_8 | eaa4b78b713845fc6b57c262e4764292 | % FactorMaxMarginalization Takes the max of given variables when marginalizing 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.