+1 (315) 557-6473 

Matlab Program to Create AI System Design Assignment Solution.


Instructions

Objective
If you need expert assistance with your artificial intelligence assignment, our team is here to help! In line with your request, we can create a program to design an AI system using MATLAB. In this program, we will utilize MATLAB's powerful tools and libraries to implement various AI algorithms and techniques. The AI system will be capable of learning from data, making intelligent decisions, and adapting to new information.

Requirements and Specifications



Homework Brief
ACADEMIC YEAR:
2021-22

Module Title: Artificial Intelligence and MachineLearning Module Code: EL4011
Level: 7

Artificial

Intelligence

System

Design





THE BRIEF/INSTRUCTIONS

This design study consists of two tasks. They are to give you an insight into various aspects of artificial intelligence (AI) system design and methods necessary to solve a specific practical machine learning problem. For the first task you are asked to come up with an application of artificial intelligence to a real- life problem of your choosing. For the second task you are asked to design a machine learning (ML) system to predict human activity from smartphone sensor signals. You will need to consider methods for feature selection, dimensionality reduction, classification and quantitative evaluation of the proposed solution.
This design study will test your ability to:
-> Design methods and processes necessary for deployment of an artificial intelligence system.
-> Recognize software design challenges behind implementations of machine learning algorithms.
-> Design and optimise machine learning system to meet specified requirements.
-> Design and provide a working solution for activity recognition.
These correspond to point 1, 2, 3 and 4 of the module learning outcomes.
Design Study Description and Objective
The objective of the first task is to identify a practical problem for which an artificial intelligence-based solution would be advantageous. The identified problem can reflect your personal interests and experience or reflect more general commercial or societal needs. This should not be a textbook example. After identifying the problem, you should discuss possible approaches to solve that problem, employing at least one AI/ML technique. This technique may be of any of the supervised, unsupervised, or self-supervised learning paradigms, and be used for either classification or regression. Your proposed solution should explain approaches to any necessary data collection, method selection and results validation. Consideration of practical implementation would also be welcomed. Although no practical experiments are expected for this part, you should discuss any issues related to ethics, safety and governance of your proposed system. You should not collect or use any data for this part. Indeed, it is not expected that you will provide algorithmic solution but rather discuss possible approaches to solve the posed problem. This part of the report should be between one and two pages in length (no more than 1,000 words).
The objective of the second task is to devise a solution for the recognition of human activity from smartphone sensor signals, given that the smartphone is on the person. One possible envisaged application of such system could be to monitor of vulnerable people, to allow for swift intervention when needed.
In the given setup, smartphone sensors provide a basis for extracting 60 features that may be used for that purpose, and the solution requires the determination of which out of 5 distinct activities the person is performing at any point in time, based on the values of the features at that point in time. The activities of interest are: sitting, standing, walking, running, and dancing. To facilitate this design study task, the data (freely available in Matlab) consisting of 20,000 training time samples is provided in the ”TrainingData.mat” file. The file contains the “Train_X” variable, which gives the computed features for each sample, and the “Train_Y” variable, which gives the corresponding activity ground truth information. A “Testdata.mat” file contains the “Test_X” variable that provides the features for 4,000 additional samples for which the corresponding activity information is withheld. Both ”TrainingData.mat” and “Testdata.mat” files are available on Blackboard in the EL4011 module materials section under the Coursework tab.
You are tasked with the development of this solution and should: consider a need for feature selection or dimensionality reduction; apply a suitable feature selection/reduction algorithm; select a machine learning algorithm appropriate for the task; train the selected machine learning algorithm; and quantitatively evaluate the design solution. You should also provide your solutions predictions on the test data, to allow for objective evaluation of the proposed solution during marking.

Marking scheme

Your report should contain the following elements; it will be marked in accordance with the following marking scheme:


Item

Weight(%)

ArtificialIntelligence System Design

1. Description of the selected problem

10

2. Consideration of any ethical, safety and governanceissues

10

3. Description of the AI methodology for solving the presented problem

20

ActivityRecognition

4. Feature selection / dimensionality reduction /data outliers detection

10

5. Machine Learning algorithm selection and training.
;
20

6. Quantitative evaluation of the proposed solution.

20

7. Presentation of the report, including conclusions.

10

Total

100

References

MATLAB (2018b or later): Classification Learner App

Bishop, C. M. (2006) Pattern Recognition and Machine Learning. Springer Marshal, S. (2009) Machine Learning, an Algorithmic Perspective. CRC Press

Source Code

clc, clear all, close all

%% Loas Data

load TestData.mat

load TrainingData.mat

%% Feature selection

% For this, we use MATLAB's fscmrmr function which rates all the

% features in the dataset. The function returns the index of the

% features with their scores. The most important features are those

% with the highest scores

[idx, scores] = fscmrmr(Train_X, Train_Y);

% Sort scores in descending order

[scores, scores_idx] = sort(scores, 'descend');

% Normalize scores

scores = (scores - min(scores))/(max(scores)-min(scores));

% Pick the index of the scores

idx = idx(scores_idx);

figure

bar(idx,scores)

xlabel('Number of feature')

ylabel('Score')

accs = zeros(1, 60);

for i = 1:60

I = idx(1:i);

Train_XX = Train_X(:, I);

Test_XX = Test_X(:, I);

%% Convert dataset to tables

% Define var names

varnames = {};

for i = 1:size(Train_XX, 2)

varnames{i} = char(sprintf("Var%d", i));

end

varnames_test = varnames;

varnames{size(Train_XX, 2)+1} = char("Class");

%% Convert data from arrays to table

train = [array2table(Train_XX), table(Train_Y)];

train.Properties.VariableNames = varnames;

test = array2table(Test_XX);

test.Properties.VariableNames = varnames_test;

%% Create Model

% We will use a Decision Tree since this is a Classification Model

% tic

tree = fitctree(train, 'Class', 'SplitCriterion', 'gdi', 'MaxNumSplits', 60, 'Surrogate', 'off');

% toc

% Predict on Training & Test sets

Y_CT_train = predict(tree,train);

Y_CT_test = predict(tree,test);

% view(tree,'mode','graph')

% Calculate confusion matrices using prediction results

% C_CT_train = confusionmat(Train_Y,Y_CT_train);

% Measure training accuracy

acc = sum(Y_CT_train == Train_Y)/length(Y_CT_train);

fprintf("The training accuracy of the model for %d features is %.2f%%\n", i, acc*100);

accs(i) = acc;

end

% Get the optimal number of features and the maximum accuracy

[max_acc, loc] = max(accs);

fprintf("The maximum accuracy was %.2f%% and was obtained when using the first %d most important features\n", max_acc, loc);

figure

plot(accs), grid on

xlabel('Number of features used')

ylabel('Accuracy')