File Exchange

image thumbnail

Machine Learning with MATLAB

version 1.3.0.1 (882 KB) by

These are the supporting MATLAB files for the MathWorks webinar of the same name.

4.33333
16 Ratings

120 Downloads

Updated

View License

** Update: The webinar recording is available at:
http://www.mathworks.com/videos/machine-learning-with-matlab-81984.html
In this webinar you will learn how to get started using machine learning tools to detect patterns and build predictive models from your datasets. In this session, you will learn about several machine learning techniques available in MATLAB and how to quickly explore your data, evaluate machine learning algorithms, compare the results, and apply the best machine learning for your problem.

Highlights include unsupervised and supervised machine learning techniques including:
• K-means and other clustering tools
• Neural Networks
• Decision trees and ensemble learning
• Naïve Bayes Classification
• Linear, logistic and nonlinear regression

Comments and Ratings (35)

Abhishek Gupta

Abhishek Gupta (view profile)

Scholar,
The data for the classification example is available here:
http://archive.ics.uci.edu/ml/datasets/Bank+Marketing
I have mentioned this in the readme.

SCHOLAR

Hi sir,
which dataset you have used in your code.

Abhishek Gupta

Abhishek Gupta (view profile)

srikantanss ss: Please contact technical support for further help:
http://www.mathworks.com/support/contact_us/index.html

K. Kojima

i could not run this in 2016a
please advise

Abhishek Gupta

Abhishek Gupta (view profile)

Jianshe,

I tried executing the code in the recent releases of MATLAB and am unable to reproduce the errors. This maybe something specific to your setup. Please contact technical support for further help:
http://www.mathworks.com/support/contact_us/index.html

Jianshe Feng

Hi Gupta,

Thanks for your webinar, which is very helpful. However, when I try your code in MATLAB 2016b, here is the error:

Error using textscan
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in ImportBankData (line 53)
dataArray = textscan(fileID, formatSpec, endRow(1)-startRow(1)+1, 'Delimiter', delimiter, 'EmptyValue'
,NaN,'HeaderLines', startRow(1)-1, 'ReturnOnError', false);

Error in MachineLearning (line 65)
bank = ImportBankData('bank-full.csv');

Could you help to fix it? Thanks!

Jianshe

Abhishek Gupta

Abhishek Gupta (view profile)

Renato,

I wrote these functions specific to the data set at hand. Minor modifications may be needed for these functions to work with another data set. Please contact technical support for further help:
http://www.mathworks.com/support/contact_us/index.html

You should be able to apply similar principles with larger number of inputs and/or classify into as many categories, as needed.

I could replicate the results but when I change the input, return na error. My database has 2.400 arguments

Trial>> comparisonPlot
Not enough input arguments.

Error in comparisonPlot (line 6)
[nRows, nCols] = size(Cmat);

Abhishek Gupta

Abhishek Gupta (view profile)

Jie,

Most of the machine learning techniques reside in the Statistics and Machine Learning Toolbox. Machine learning techniques related to neural networks reside in Neural Network Toolbox.

I am only leveraging Fuzzy C-means clustering from Fuzzy Logic Toolbox.

In these examples, Parallel Computing Toolbox is is used to speed up the analysis by explicitly leveraging the additional cores/processors on a desktop/laptop. It is not required.

If you have fewer toolboxes, you should still be able to re-use parts of these examples.

Jie YANG

Dear Abhishek Gupta,

Thank you for sharing your code. May I ask that the required products should be installed especailly for MATLAB 2012b due to I am lack of the toolboxes.

Abhishek Gupta

Abhishek Gupta (view profile)

biomechanic92: In this submission, MachineLearning.m contains the whole classification example including everything covered in Presentation.m. Thus, I didn't include Presentation.m as it would be redundant.

biomechanic92

Is there is a reason why Presentation.m file is not on here? or is it located somewhere else like the bank.csv file?

Eshaan Ghosh

Steps to follow
1. Go to http://archive.ics.uci.edu/ml/datasets/Bank+Marketing
Data folder>Bank.zip
2. Open any of the excel files
3. Select Column A
4. Data> Text to Columns> Delimited
5. Pres Next, Select Semicolon, select Next
6. Finish

You got the bank file for your computation

andres razo

diculpen en el descargable no existe el archivo bank-full.csv y el bank.csv por lo que da el error al ejecutar el programa

En el trabajo

top notch work.
and Abhishek answered my questions in an off-line email - that's what makes Matlab great.

Shihab Khan

Mark Knecht

Sadly, another case of creeping package usage in MatLab. Great for people who have access to everything MatLab offers. Not so good for the rest of us.

Birsen

Birsen (view profile)

The presentation.m is not in the download folders as in the webinar.
The webinar is not for someone is new in that subject, the explanations are for the ones who already knows machine learning

Alecesa

Hi Gupta,

I am new to Matlab but in trying to replicate the code script provided, I had the same error as reported by Saida. tried the Bank.csv and Bank-full.csv and the problem repeats as follows:

Trial>> bank = ImportBankData('bank-full.csv');
names = bank.Properties.VarNames;
Undefined function 'ImportBankData' for input arguments of type 'char'.

Any support/suggestion would be appreciated.

Regards/Alex

Abhishek Gupta

Abhishek Gupta (view profile)

Hi Benjamin,

Excellent question. Currently, there is no way to inform SEQUENTIALFS about the categorical predictors. Thus, it treats all predictors as numeric. The development team is aware and they plan to add this capability in a future release of our tools.

Hi Himakshi,

It is hard for me to predict (no pun intended) the cause of the error at your end. Please feel free to reach out to our technical support team:
http://www.mathworks.com/support/contact_us/index.html

Benjamin

How are the categorical predictors handled in the sequentialfs step in MachineLearning.m line 430 if the logical matrix catPred isn't used in the critfun or in sequentialfs? Thanks for the clarification.

Benjamin

Gareth Thomas

hi, I have run your code as i have to do similar work but your code is not reading data from the file bank-full.csv and is returning 0 rows. As the error is
??? Error using ==> cvpartition>cvpartition.cvpartition at 137
The number of observations must be a positive integer greater than one.
 I am not able to understand why it is not reading data from rows of csv file

Abhishek Gupta

Abhishek Gupta (view profile)

Hi Azadeh and Saida,

I tried executing all the code in the recent releases of MATLAB and am unable to reproduce the errors. This maybe something specific to your setup. Please contact technical support for further help:
http://www.mathworks.com/support/contact_us/index.html

Saida

Saida (view profile)

I keep trying to follow your code but the very first line gives me an error.

>> bank=ImportBankData('bank-full.csv');
Undefined function 'ImportBankData' for input arguments of type 'char'.

Azadeh

Azadeh (view profile)

I run MachineLearning.m on sample dataset bank-full.csv and got this error:

Default value is not a member of type "nntype.performance_fcn".
Error using nnetParamInfo (line 28)
Too many input arguments.

Error in patternnet>get_info (line 85)
  info = nnfcnNetwork(mfilename,'Pattern Recognition Neural Network',fcnversion, ...

Error in patternnet (line 41)
  if isempty(INFO), INFO = get_info; end

Error in NNfun (line 18)
net = patternnet(hiddenLayerSize);

Error in MachineLearning (line 191)
[~, net] = NNfun(XtrainNN,YtrainNN);

Mehmet

Mehmet (view profile)

Abhishek Gupta

Abhishek Gupta (view profile)

Hi Remi,

The data for the classification example is available here:
http://archive.ics.uci.edu/ml/datasets/Bank+Marketing

I believe that I have mentioned this in the readme.

The CSV file is missing ('bank-full.csv').

Wenwu

Wenwu (view profile)

Thanks, nice webinar and supplementary files.

PRIYA

PRIYA (view profile)

Sergey

Sergey (view profile)

Updates

1.3.0.1

Updated license

1.3

Updated webinar link

1.2

Added webinar link

MATLAB Release
MATLAB 8.1 (R2013a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Machine Learning/Classification/html/

Machine Learning/Clustering/html/