These Matlab M-Files are written by Yu Hen Hu, and have been tested on Matlab V.7. You are welcomed to use them for education and research purposese. For commercial applications (including for-profit education services), please contact Prof. Hu at hu@engr.wisc.edu .

If you spot mistakes in these routines, I will be happy to hear from you to correct them. However, I am unable to provide free consultation to solve your problem on hand. Nor will I help solving your homework problem unless you are taking my class during the present semester.

If you are not familiar with Matlab, here are some useful pointers to learn it by yourself.

- bvv.m -- Bias versus variance trade-offs demonstration (use utility routines randomize.m and polyfit1d.m)
- lamexample.m -- Example of linear associative memory
- ghademo.m -- Principal component analysis using generalized Hebbian learning. (use ghafun.m)
- learner.m -- demonstration of error correcting learning (LMS) (use utility routines randomize.m)
- lmsdemo.m -- demonstration of LMS algorithm LMS learning
- perceptron.m -- perceptron learning algorithm (use utility routines sline.m, datasepf.m)

- bp.m -- MLP backpropagation driver program for classification tasks. (use utility routines scale.m, and randomize.m.) Other mfiles needed:
- bpconfig.m -- Initial configurations of a MLP
- cvgtest.m -- Convergence test routine (updated 10/16/01).
- bpdisplay.m -- Display intermediate and final result of BP training
- bptest.m, bptestap.m -- Test classification (bptest.m) and approximation (bptestap.m) results
- rsample.m -- random sample K out of Kr rows from matrix x.
- actfun.m, actfunp.m -- Compute activation function and their derivatives.
- partunef.m -- partition the training data samples x into a training set and a tuning set according to a user specified percentage ratio
- fsplit.m -- Random partition a matrix x row-wise according to ratio:1
- mlpdemo1.m -- demonstration of feedforward MLP's output as function of its two input
- mlp2.m -- a specialized 2-layer feedforward MLP network, called by mlpdemo1.m

- knndemo.m, knn.m: knearest neighbor classifier
- mldemo_uni.m: Maximum likelihood classifier using uni- variate Gaussian model, will call mltrain_uni.m
- mldemo.m: Maximum likelihood classifier with Gaussion mixture distribution. Call mltrainnew.m, mltestnew.m, mlgmm.m, csm.m, use utility routines datagen.m, and netlab routines: gmm.zip (updated: 10/2003)

- svmexample.m -- svm problem solving using
general nonlinear constrained optimization.

Will call svmexample_f.m. - svmdemo.m -- demonstration of
using libsvm to solve a classification problem using svm.

**Updated October 2008 with LibSVM v.2.87 matlab interface**: svmtrain.mexw32, and svmpredict.mexw32.

For Matlab version prior to v7.1 (R14sp3) on Window OS, you may download the following two files (LibSVM v.2.81, 2005) svmtrain.dll, and svmpredict.dll. Theutility routines datasepf.m, and datagen.m have also been updated.

If you run clusterdemo.m and found error message, it is likely that some of the routines call dist.m which conflicts with the built-in m-file dist.m distributed by Mathwork, Inc. The patch is to change dist to mydist and download mydist.m from the utility section. These programs have been updated on Nov. 2008 and should not give that error any more.

- learncl.m -- Competitive Learning
demonstration (use utility routines
datagen1.m). and

learncl1.m -- Annimation version of learncl.m - clusterdemo.m -- Kmean clustering algorithm demonstration. Call kmeansf.m, and utility routines datagen.m
- kmeansf.m -- A function implementing the kmeans clustering algorithm
- cinit.m -- initilize clustering algorithm, call c1d.m, 1D clustering algorithm
- somdemo.m -- Self Organizing Map demonstration program as well as utility routines datagen1.m and randomize.m
- kerneldemo.m - demonstration of Parzen window. Call kernel1d.m
- kmeantest.m - determine membership given clustering centers.

- rbndemo.m: Demonstration program combining type 1 and type 2. Call rbn.m, gauss.m, cinit.m, kmeansf.m
- rbfexample1.m example 1 in rbf note. Call kernel1d.m

- mademo.m -- Time series prediction demonstration program using the moving average (MA) model. Call mafun.m, and utility routines autocorr.m
- ardemo.m -- Time series prediction demonstration program using the auto-regressive (AR) model. Call utility routines autocorr.m and tsgenf.m

**Fuzzy Relation Composition Demonstration**

- fzrelationdemo.m -- Infer Mary's age from Dana's age, given that Dana is much_older than Mary
- fzcompose.m -- Max-min and Max- product fuzzy relationi composition rules
- maxmin.m composition rule
- maxproduct.m composition rule

**Fuzzy Logic Control Example: Dog Chases Cat**

- dogcatfz.m -- Dog catch cat main program
- ruledc.m -- the rule base.
- fsgen.m -- Fussy set generation;
- fuzify.m -- Fuzzification routine;
- defuz.m -- Defuzzification routine;
- infer.m -- Fuzzy inference engine;

- random_search.m -- demonstration of various solutions of TSA problem using randsom search methods, including exhaustive search (for 8 or fewer cities), genetic algorithm (using tsa_ga.m), random-search, heurstic greedy search, simulated annealing algorithm
- tsp_ga.m -- Joseph Kirk's implementation of TSP solver using genetic algorithm. Can be found at Matlab central.
- permugen.m -- generate all permutations of tours
- nbgen.m -- generate all permutations within a neighborhood of a specified distance
- rshift.m -- rotating shift of a vector

- dbmoon.m -- generate double moon data set shown in Figure 1.8 of Haykin neural network and learning machines, 3rd edition
- shadeplot.m -- illustrating how to plot a shaded area in a 2D region
- randomize.m -- randomize the row order of a matrix
- sline.m -- given a line function, compute the intersection of the line with the perimeter of a 2D box so that the line can be plotted. called by perceptron.m.
- datasepf.m -- generate two classes of data samples within unit square that are linearly separable.
- scale.m -- called by bp.m to linearly scale the input to a specified range.
- datagen.m -- 2D Gaussian Mixture data generation. May generate rotated, elliptic Gaussian clusteres. Labels can also be assigned. (Updated: 11/23/2005)datagen1.m -- variant of datagen.m.
- fungen.m -- generate 1 input, 1 output functions of (1) sinusoids; (2) piecewise linear functions; or (3) polynomials. fungenf.m -- callable function implementation of fungen.m
- polyfit1d.m -- fitting 1D data to a polynomial
- mydist.m -- calculate distance between two sets of points in L2, L1 and L_infinity norm
- autocorr.m -- calculate sample auto-correlation or autocovariance lags using rectangular window or triangular window.
- tsgenf.m -- generate time series and corresponding training and testing matrices. AR model, ligistic time series and rounding time series.

- xor -- XOR problem data file, M = 2, N = 1
- and -- AND problem data file, M = 2, N = 2
- parity4 -- 4-bit parity problem data file, M = 4, N = 1
- parity7 training data, and parity7 testing data -- 7-bit parity problem data file M = 7, N = 1
- IRIS training data IRIS testing data IRIS classification problem data file, M = 4, N = 3.