SlideShare uma empresa Scribd logo
1 de 7
Baixar para ler offline
COMPONENTS EXPLANATION USING MATLAB
Our online Tutors are available 24*7 to provide Help with Components Explanation
Homework/Assignment or a long term Graduate/Undergraduate Components Explanation Project.
Our Tutors being experienced and proficient in Components Explanation ensure to provide high
quality Components Explanation Homework Help. Upload your Components Explanation
Assignment at ‘Submit Your Assignment’ button or email it to info@assignmentpedia.com. You can
use our ‘Live Chat’ option to schedule an Online Tutoring session with our Components Explanation
Tutors.
BAYESIAN CLUSTERING WITH OUTLIERS AND MISSING VALUES
MatLab object for clustering incomplete data with extreme amounts of noise.
TestBRMM()
function TestBRMM()
%TestBRMM Test the Bayesian robust mixture model on synthetic data
%
% This routine tests the capabilities of the BRMM on synthetic data. It
% generates a set of features from a BRMM with unknown parameters and
% subsequently corrupts them by removing elements at random. Next, from
% these features alone, it estimates the hyper-parameters of the model
% responsible for generating them.
%
% (c) 2013 Gabriel Agamennoni.
% Set size options.
NumberOfComponents=3;
NumberOfFeatures=5;
NumberOfPoints=200;
NumberOfMisses=50;
% Set sampling options.
ConcentrationParameter=5;
SeparationParameter=3;
NoiseParameter=10;
OutlierParameter=5;
PrecisionParameter=100;
% Print header and display status.
fprintf('n')
fprintf('Sampling data ... ')
% Generate parameters for sampling.
[Proportions,Locations,Dispersions]=GenerateParameters(NumberOfComponents,...
NumberOfFeatures,ConcentrationParameter,SeparationParameter,NoiseParameter);
% Create model for sampling.
Model=BRMM(NumberOfComponents,NumberOfFeatures);
% Set constant.
Model.DegreesOfFreedom=OutlierParameter;
% Set hyper-parameters.
Model.ComponentProportions=Proportions;
Model.ComponentStrength=PrecisionParameter;
Model.ComponentLocations=Locations;
Model.ComponentScales(:)=PrecisionParameter;
Model.ComponentDispersions=Dispersions;
Model.ComponentShapes(:)=max(PrecisionParameter,NumberOfFeatures);
% Sample and corrupt data by adding outliers and removing entries.
[~,~,Features]=Model.Simulate(NumberOfPoints);
Features=CorruptFeatures(Features,NumberOfMisses);
% Update status.
fprintf('Donen')
fprintf('Estimating model ... ')
% Create model for estimation.
Model=BRMM(NumberOfComponents,NumberOfFeatures);
% Estimate model and posterior probabilities.
[Model,Bounds,Probabilities]=Model.Estimate(Features);
% Update status.
fprintf('Donen')
fprintf('Plotting results ... ')
% Close any existing figure.
close('all')
% Plot results.
PlotBounds(Bounds)
PlotResults(Features,Probabilities,Model.ComponentProportions,...
Model.ComponentLocations,Model.ComponentDispersions)
% Update status and print footer.
fprintf('Donen')
fprintf('n')
end
function [Proportions,Locations,Dispersions]=...
GenerateParameters(NumberOfComponents,NumberOfFeatures,...
ConcentrationParameter,SeparationParameter,NoiseParameter)
% Sample proportion parameters.
Proportions=randg(ConcentrationParameter,NumberOfComponents);
Proportions=Proportions/sum(Proportions);
% Sample location parameters.
Locations=SeparationParameter*randn(NumberOfFeatures,NumberOfComponents);
% Allocate space for dispersion parameters.
Dispersions=zeros(NumberOfFeatures,NumberOfFeatures,NumberOfComponents);
% Sample dispersion parameters.
for i=1:NumberOfComponents
Gain=randn(NumberOfFeatures,NumberOfFeatures+...
NoiseParameter)/sqrt(NumberOfFeatures+NoiseParameter);
Dispersions(:,:,i)=Gain*Gain';
end
end
function Features=CorruptFeatures(Features,NumberOfMisses)
% Store size.
[NumberOfFeatures,NumberOfPoints]=size(Features);
% Remove features at random.
Features(randi(NumberOfFeatures*NumberOfPoints,NumberOfMisses,1))=nan();
end
function PlotBounds(Bounds)
% Set options.
FontName='times';
FontSize=20;
LineColor=[0,0,1];
LineWidth=2;
MarkerSize=20;
% Create figure.
Figure=figure(...
'NumberTitle','off',...
'Name','Variational Lower Bound on the Model Evidence');
% Create axes.
Axes=axes(...
'Parent',Figure,...
'NextPlot','add',...
'Box','on',...
'Layer','top',...
'FontName',FontName,...
'FontSize',FontSize);
% Annotate axes.
set(get(Axes,'XLabel'),...
'String','Iteration',...
'FontName',FontName,...
'FontSize',FontSize)
set(get(Axes,'YLabel'),...
'String','Lower bound',...
'FontName',FontName,...
'FontSize',FontSize)
set(get(Axes,'Title'),...
'String','Variational lower bound on the model evidence',...
'FontName',FontName,...
'FontSize',FontSize)
% Plot lower bound.
line(...
'Parent',Axes,...
'XData',1:numel(Bounds),...
'YData',Bounds,...
'Color',LineColor,...
'LineWidth',LineWidth,...
'Marker','.',...
'MarkerSize',MarkerSize)
% Adjust axes.
set(Axes,...
'XLim',[0,numel(Bounds)+1])
end
function PlotResults(Features,Probabilities,Proportions,Locations,Dispersions)
% Set options.
FontName='times';
FontSize=20;
NumberOfColors=50;
DilutionOfColor=1/2;
LineWidth=2;
MarkerSize=20;
Margin=3/20;
Whisker=1/5;
Confidence=95/100;
% Store size.
[NumberOfFeatures,~]=size(Features);
[NumberOfComponents,~]=size(Probabilities);
% Build color map by quantizing colors.
Color=hsv(NumberOfComponents);
State=warning('Off','stats:kLocations:EmptyCluster');
[Indices,Colors]=kmeans(Probabilities'*Color,NumberOfColors,...
'Distance','cityblock',...
'EmptyAction','drop',...
'OnLinePhase','off');
warning(State)
% Create figure.
Figure=figure(...
'NumberTitle','off',...
'Name','Bayesian Clustering with Outliers and Missing Values');
% Create axes.
Axes=axes(...
'Parent',Figure,...
'NextPlot','add',...
'Box','on',...
'Layer','top',...
'FontName',FontName,...
'FontSize',FontSize);
% Annotate axes.
set(get(Axes,'Title'),...
'String','Bayesian clustering with outliers and missing values',...
'FontName',FontName,...
'FontSize',FontSize)
set(get(Axes,'XLabel'),...
'String','Feature dimensions',...
'FontName',FontName,...
'FontSize',FontSize)
set(get(Axes,'YLabel'),...
'String','Feature values',...
'FontName',FontName,...
'FontSize',FontSize)
% Plot features.
for i=1:NumberOfColors
for j=find(Indices==i)'
line(...
'Parent',Axes,...
'XData',1:NumberOfFeatures,...
'YData',Features(:,j),...
'Color',(1-DilutionOfColor)*Colors(i,:)+...
DilutionOfColor*get(Axes,'Color'),...
'LineWidth',LineWidth)
end
end
% Allocate space for line handles.
Line=zeros(NumberOfComponents,1);
% Plot model.
for i=1:NumberOfComponents
for j=1:NumberOfFeatures
% Store horizontal limits.
Left=j-Margin*((i-1)/max(NumberOfComponents-1,1)-1/2)-Whisker/2;
Right=j-Margin*((i-1)/max(NumberOfComponents-1,1)-1/2)+Whisker/2;
% Plot location.
Line(i)=line(...
'Parent',Axes,...
'XData',Left/2+Right/2,...
'YData',Locations(j,i),...
'Color',Color(i,:),...
'Marker','.',...
'MarkerSize',MarkerSize);
% Store vertical limits.
Low=Locations(j,i)-sqrt(2*Dispersions(j,j,i))*erfcinv(1-Confidence);
High=Locations(j,i)-sqrt(2*Dispersions(j,j,i))*erfcinv(1+Confidence);
% Plot dispersion.
line(...
'Parent',Axes,...
'XData',[Left,Right,nan(),Left/2+Right/2,...
Left/2+Right/2,nan(),Left,Right],...
'YData',[Low,Low,nan(),Low,High,nan(),High,High],...
'Color',Color(i,:),...
'LineWidth',LineWidth)
end
end
% Allocate space for labels.
Label=cell(NumberOfComponents,1);
% Create labels.
for i=1:NumberOfComponents
Label{i}=sprintf('Component %d: %2.1f%%',i,100*Proportions(i));
end
% Annotate plot.
set(legend(Line,Label{:}),...
'FontName',FontName,...
'FontSize',FontSize,...
'Location','northeast')
% Adjust axis limits.
set(Axes,...
'XTick',1:NumberOfFeatures,...
'XLim',[1/2,NumberOfFeatures+1/2])
end
visit us at www.assignmentpedia.com or email us at info@assignmentpedia.com or call us at +1 520 8371215

Mais conteúdo relacionado

Destaque (6)

Innovation Nashville August Founders Panel - Band of Brothers Thurs August 4t...
Innovation Nashville August Founders Panel - Band of Brothers Thurs August 4t...Innovation Nashville August Founders Panel - Band of Brothers Thurs August 4t...
Innovation Nashville August Founders Panel - Band of Brothers Thurs August 4t...
 
AmeaçAs à Liberdade De ExpressãO
AmeaçAs à Liberdade De ExpressãOAmeaçAs à Liberdade De ExpressãO
AmeaçAs à Liberdade De ExpressãO
 
6 kalap
6 kalap6 kalap
6 kalap
 
Proyecto escuela rural mixta rio sevilla uno (invitados)
Proyecto escuela rural mixta rio sevilla uno (invitados)Proyecto escuela rural mixta rio sevilla uno (invitados)
Proyecto escuela rural mixta rio sevilla uno (invitados)
 
4.besp –
4.besp –4.besp –
4.besp –
 
Sea Snake (Lapemis hardwickii)
Sea Snake (Lapemis hardwickii)Sea Snake (Lapemis hardwickii)
Sea Snake (Lapemis hardwickii)
 

Semelhante a Components Explanation

Matlab practical and lab session
Matlab practical and lab sessionMatlab practical and lab session
Matlab practical and lab session
Dr. Krishna Mohbey
 
Control Systems Using Matlab
Control Systems Using MatlabControl Systems Using Matlab
Control Systems Using Matlab
Assignmentpedia
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
Kurmendra Singh
 
Distributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation ProjectDistributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation Project
Assignmentpedia
 
Distributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation ProjectDistributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation Project
Assignmentpedia
 
SAS Macros part 4.1
SAS Macros part 4.1SAS Macros part 4.1
SAS Macros part 4.1
venkatam
 
Matlab simulation project
Matlab simulation projectMatlab simulation project
Matlab simulation project
Assignmentpedia
 
matlab-130408153714-phpapp02_lab123.ppsx
matlab-130408153714-phpapp02_lab123.ppsxmatlab-130408153714-phpapp02_lab123.ppsx
matlab-130408153714-phpapp02_lab123.ppsx
lekhacce
 
Basics of Image Processing using MATLAB
Basics of Image Processing using MATLABBasics of Image Processing using MATLAB
Basics of Image Processing using MATLAB
vkn13
 

Semelhante a Components Explanation (20)

Handout2.pdf
Handout2.pdfHandout2.pdf
Handout2.pdf
 
Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...Lab 2: Classification and Regression Prediction Models, training and testing ...
Lab 2: Classification and Regression Prediction Models, training and testing ...
 
Matlab practical and lab session
Matlab practical and lab sessionMatlab practical and lab session
Matlab practical and lab session
 
Matlab Basic Tutorial
Matlab Basic TutorialMatlab Basic Tutorial
Matlab Basic Tutorial
 
Control Systems Using Matlab
Control Systems Using MatlabControl Systems Using Matlab
Control Systems Using Matlab
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
 
Simulation lab
Simulation labSimulation lab
Simulation lab
 
Matlab commands
Matlab commandsMatlab commands
Matlab commands
 
Matlab commands
Matlab commandsMatlab commands
Matlab commands
 
Adding Statistical Functionality to the DATA Step with PROC FCMP
Adding Statistical Functionality to the DATA Step with PROC FCMPAdding Statistical Functionality to the DATA Step with PROC FCMP
Adding Statistical Functionality to the DATA Step with PROC FCMP
 
Gradient boosting for regression problems with example basics of regression...
Gradient boosting for regression problems with example   basics of regression...Gradient boosting for regression problems with example   basics of regression...
Gradient boosting for regression problems with example basics of regression...
 
Distributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation ProjectDistributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation Project
 
Distributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation ProjectDistributed Radar Tracking Simulation Project
Distributed Radar Tracking Simulation Project
 
SAS Macros part 4.1
SAS Macros part 4.1SAS Macros part 4.1
SAS Macros part 4.1
 
CSL0777-L07.pptx
CSL0777-L07.pptxCSL0777-L07.pptx
CSL0777-L07.pptx
 
Matlab simulation project
Matlab simulation projectMatlab simulation project
Matlab simulation project
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
matlab-130408153714-phpapp02_lab123.ppsx
matlab-130408153714-phpapp02_lab123.ppsxmatlab-130408153714-phpapp02_lab123.ppsx
matlab-130408153714-phpapp02_lab123.ppsx
 
Basics of Image Processing using MATLAB
Basics of Image Processing using MATLABBasics of Image Processing using MATLAB
Basics of Image Processing using MATLAB
 

Mais de Assignmentpedia

Transmitter side components
Transmitter side componentsTransmitter side components
Transmitter side components
Assignmentpedia
 
Single object range detection
Single object range detectionSingle object range detection
Single object range detection
Assignmentpedia
 
Sequential radar tracking
Sequential radar trackingSequential radar tracking
Sequential radar tracking
Assignmentpedia
 
Radar cross section project
Radar cross section projectRadar cross section project
Radar cross section project
Assignmentpedia
 
Radar application project help
Radar application project helpRadar application project help
Radar application project help
Assignmentpedia
 
Parallel computing homework help
Parallel computing homework helpParallel computing homework help
Parallel computing homework help
Assignmentpedia
 
Network costing analysis
Network costing analysisNetwork costing analysis
Network costing analysis
Assignmentpedia
 
Matlab programming project
Matlab programming projectMatlab programming project
Matlab programming project
Assignmentpedia
 
Image processing project using matlab
Image processing project using matlabImage processing project using matlab
Image processing project using matlab
Assignmentpedia
 
Help with root locus homework1
Help with root locus homework1Help with root locus homework1
Help with root locus homework1
Assignmentpedia
 
Theory of computation homework help
Theory of computation homework helpTheory of computation homework help
Theory of computation homework help
Assignmentpedia
 
Help With Digital Communication Project
Help With  Digital Communication ProjectHelp With  Digital Communication Project
Help With Digital Communication Project
Assignmentpedia
 

Mais de Assignmentpedia (20)

Transmitter side components
Transmitter side componentsTransmitter side components
Transmitter side components
 
Single object range detection
Single object range detectionSingle object range detection
Single object range detection
 
Sequential radar tracking
Sequential radar trackingSequential radar tracking
Sequential radar tracking
 
Resolution project
Resolution projectResolution project
Resolution project
 
Radar cross section project
Radar cross section projectRadar cross section project
Radar cross section project
 
Radar application project help
Radar application project helpRadar application project help
Radar application project help
 
Parallel computing homework help
Parallel computing homework helpParallel computing homework help
Parallel computing homework help
 
Network costing analysis
Network costing analysisNetwork costing analysis
Network costing analysis
 
Matlab programming project
Matlab programming projectMatlab programming project
Matlab programming project
 
Links design
Links designLinks design
Links design
 
Image processing project using matlab
Image processing project using matlabImage processing project using matlab
Image processing project using matlab
 
Help with root locus homework1
Help with root locus homework1Help with root locus homework1
Help with root locus homework1
 
Transmitter subsystem
Transmitter subsystemTransmitter subsystem
Transmitter subsystem
 
Computer Networks Homework Help
Computer Networks Homework HelpComputer Networks Homework Help
Computer Networks Homework Help
 
Theory of computation homework help
Theory of computation homework helpTheory of computation homework help
Theory of computation homework help
 
Econometrics Homework Help
Econometrics Homework HelpEconometrics Homework Help
Econometrics Homework Help
 
Video Codec
Video CodecVideo Codec
Video Codec
 
Radar Spectral Analysis
Radar Spectral AnalysisRadar Spectral Analysis
Radar Spectral Analysis
 
Pi Controller
Pi ControllerPi Controller
Pi Controller
 
Help With Digital Communication Project
Help With  Digital Communication ProjectHelp With  Digital Communication Project
Help With Digital Communication Project
 

Último

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Último (20)

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

Components Explanation

  • 1. COMPONENTS EXPLANATION USING MATLAB Our online Tutors are available 24*7 to provide Help with Components Explanation Homework/Assignment or a long term Graduate/Undergraduate Components Explanation Project. Our Tutors being experienced and proficient in Components Explanation ensure to provide high quality Components Explanation Homework Help. Upload your Components Explanation Assignment at ‘Submit Your Assignment’ button or email it to info@assignmentpedia.com. You can use our ‘Live Chat’ option to schedule an Online Tutoring session with our Components Explanation Tutors. BAYESIAN CLUSTERING WITH OUTLIERS AND MISSING VALUES MatLab object for clustering incomplete data with extreme amounts of noise. TestBRMM() function TestBRMM() %TestBRMM Test the Bayesian robust mixture model on synthetic data % % This routine tests the capabilities of the BRMM on synthetic data. It % generates a set of features from a BRMM with unknown parameters and % subsequently corrupts them by removing elements at random. Next, from % these features alone, it estimates the hyper-parameters of the model % responsible for generating them. % % (c) 2013 Gabriel Agamennoni. % Set size options. NumberOfComponents=3; NumberOfFeatures=5; NumberOfPoints=200; NumberOfMisses=50; % Set sampling options. ConcentrationParameter=5; SeparationParameter=3; NoiseParameter=10; OutlierParameter=5; PrecisionParameter=100; % Print header and display status. fprintf('n') fprintf('Sampling data ... ') % Generate parameters for sampling. [Proportions,Locations,Dispersions]=GenerateParameters(NumberOfComponents,... NumberOfFeatures,ConcentrationParameter,SeparationParameter,NoiseParameter);
  • 2. % Create model for sampling. Model=BRMM(NumberOfComponents,NumberOfFeatures); % Set constant. Model.DegreesOfFreedom=OutlierParameter; % Set hyper-parameters. Model.ComponentProportions=Proportions; Model.ComponentStrength=PrecisionParameter; Model.ComponentLocations=Locations; Model.ComponentScales(:)=PrecisionParameter; Model.ComponentDispersions=Dispersions; Model.ComponentShapes(:)=max(PrecisionParameter,NumberOfFeatures); % Sample and corrupt data by adding outliers and removing entries. [~,~,Features]=Model.Simulate(NumberOfPoints); Features=CorruptFeatures(Features,NumberOfMisses); % Update status. fprintf('Donen') fprintf('Estimating model ... ') % Create model for estimation. Model=BRMM(NumberOfComponents,NumberOfFeatures); % Estimate model and posterior probabilities. [Model,Bounds,Probabilities]=Model.Estimate(Features); % Update status. fprintf('Donen') fprintf('Plotting results ... ') % Close any existing figure. close('all') % Plot results. PlotBounds(Bounds) PlotResults(Features,Probabilities,Model.ComponentProportions,... Model.ComponentLocations,Model.ComponentDispersions) % Update status and print footer. fprintf('Donen') fprintf('n') end function [Proportions,Locations,Dispersions]=...
  • 3. GenerateParameters(NumberOfComponents,NumberOfFeatures,... ConcentrationParameter,SeparationParameter,NoiseParameter) % Sample proportion parameters. Proportions=randg(ConcentrationParameter,NumberOfComponents); Proportions=Proportions/sum(Proportions); % Sample location parameters. Locations=SeparationParameter*randn(NumberOfFeatures,NumberOfComponents); % Allocate space for dispersion parameters. Dispersions=zeros(NumberOfFeatures,NumberOfFeatures,NumberOfComponents); % Sample dispersion parameters. for i=1:NumberOfComponents Gain=randn(NumberOfFeatures,NumberOfFeatures+... NoiseParameter)/sqrt(NumberOfFeatures+NoiseParameter); Dispersions(:,:,i)=Gain*Gain'; end end function Features=CorruptFeatures(Features,NumberOfMisses) % Store size. [NumberOfFeatures,NumberOfPoints]=size(Features); % Remove features at random. Features(randi(NumberOfFeatures*NumberOfPoints,NumberOfMisses,1))=nan(); end function PlotBounds(Bounds) % Set options. FontName='times'; FontSize=20; LineColor=[0,0,1]; LineWidth=2; MarkerSize=20; % Create figure. Figure=figure(... 'NumberTitle','off',... 'Name','Variational Lower Bound on the Model Evidence');
  • 4. % Create axes. Axes=axes(... 'Parent',Figure,... 'NextPlot','add',... 'Box','on',... 'Layer','top',... 'FontName',FontName,... 'FontSize',FontSize); % Annotate axes. set(get(Axes,'XLabel'),... 'String','Iteration',... 'FontName',FontName,... 'FontSize',FontSize) set(get(Axes,'YLabel'),... 'String','Lower bound',... 'FontName',FontName,... 'FontSize',FontSize) set(get(Axes,'Title'),... 'String','Variational lower bound on the model evidence',... 'FontName',FontName,... 'FontSize',FontSize) % Plot lower bound. line(... 'Parent',Axes,... 'XData',1:numel(Bounds),... 'YData',Bounds,... 'Color',LineColor,... 'LineWidth',LineWidth,... 'Marker','.',... 'MarkerSize',MarkerSize) % Adjust axes. set(Axes,... 'XLim',[0,numel(Bounds)+1]) end function PlotResults(Features,Probabilities,Proportions,Locations,Dispersions) % Set options. FontName='times'; FontSize=20; NumberOfColors=50; DilutionOfColor=1/2;
  • 5. LineWidth=2; MarkerSize=20; Margin=3/20; Whisker=1/5; Confidence=95/100; % Store size. [NumberOfFeatures,~]=size(Features); [NumberOfComponents,~]=size(Probabilities); % Build color map by quantizing colors. Color=hsv(NumberOfComponents); State=warning('Off','stats:kLocations:EmptyCluster'); [Indices,Colors]=kmeans(Probabilities'*Color,NumberOfColors,... 'Distance','cityblock',... 'EmptyAction','drop',... 'OnLinePhase','off'); warning(State) % Create figure. Figure=figure(... 'NumberTitle','off',... 'Name','Bayesian Clustering with Outliers and Missing Values'); % Create axes. Axes=axes(... 'Parent',Figure,... 'NextPlot','add',... 'Box','on',... 'Layer','top',... 'FontName',FontName,... 'FontSize',FontSize); % Annotate axes. set(get(Axes,'Title'),... 'String','Bayesian clustering with outliers and missing values',... 'FontName',FontName,... 'FontSize',FontSize) set(get(Axes,'XLabel'),... 'String','Feature dimensions',... 'FontName',FontName,... 'FontSize',FontSize) set(get(Axes,'YLabel'),... 'String','Feature values',... 'FontName',FontName,... 'FontSize',FontSize) % Plot features. for i=1:NumberOfColors
  • 6. for j=find(Indices==i)' line(... 'Parent',Axes,... 'XData',1:NumberOfFeatures,... 'YData',Features(:,j),... 'Color',(1-DilutionOfColor)*Colors(i,:)+... DilutionOfColor*get(Axes,'Color'),... 'LineWidth',LineWidth) end end % Allocate space for line handles. Line=zeros(NumberOfComponents,1); % Plot model. for i=1:NumberOfComponents for j=1:NumberOfFeatures % Store horizontal limits. Left=j-Margin*((i-1)/max(NumberOfComponents-1,1)-1/2)-Whisker/2; Right=j-Margin*((i-1)/max(NumberOfComponents-1,1)-1/2)+Whisker/2; % Plot location. Line(i)=line(... 'Parent',Axes,... 'XData',Left/2+Right/2,... 'YData',Locations(j,i),... 'Color',Color(i,:),... 'Marker','.',... 'MarkerSize',MarkerSize); % Store vertical limits. Low=Locations(j,i)-sqrt(2*Dispersions(j,j,i))*erfcinv(1-Confidence); High=Locations(j,i)-sqrt(2*Dispersions(j,j,i))*erfcinv(1+Confidence); % Plot dispersion. line(... 'Parent',Axes,... 'XData',[Left,Right,nan(),Left/2+Right/2,... Left/2+Right/2,nan(),Left,Right],... 'YData',[Low,Low,nan(),Low,High,nan(),High,High],... 'Color',Color(i,:),... 'LineWidth',LineWidth) end end % Allocate space for labels. Label=cell(NumberOfComponents,1);
  • 7. % Create labels. for i=1:NumberOfComponents Label{i}=sprintf('Component %d: %2.1f%%',i,100*Proportions(i)); end % Annotate plot. set(legend(Line,Label{:}),... 'FontName',FontName,... 'FontSize',FontSize,... 'Location','northeast') % Adjust axis limits. set(Axes,... 'XTick',1:NumberOfFeatures,... 'XLim',[1/2,NumberOfFeatures+1/2]) end visit us at www.assignmentpedia.com or email us at info@assignmentpedia.com or call us at +1 520 8371215