-
Notifications
You must be signed in to change notification settings - Fork 0
/
de1.m
47 lines (39 loc) · 1.09 KB
/
de1.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
clc;
clear;
close all;
%% Load Data
data=CreateData();
load traininput.mat
load traintarget.mat
load testinput.mat
load testtarget.mat
data.TrainInputs=0;
data.TrainInputs=traininput;
data.TrainTargets=0;
data.TrainTargets=traintarget;
data.TestInputs=0;
data.TestInputs=testinput;
data.TestTargets=0;
data.TestTargets=testtarget;
%% Generate Basic FIS
fis=CreateInitialFIS(data,10);
%% Tarin Using DE
fis=TrainUsingDE(fis,data);
%% Results
% Train Data
figure;
TrainOutputs=evalfis(data.TrainInputs,fis);
PlotResults(data.TrainTargets,TrainOutputs,'Train Data');
figure;
% Test Data
TestOutputs=evalfis(data.TestInputs,fis);
PlotResults(data.TestTargets,TestOutputs,'Test Data');
%%
clear;
load carbig
X = [MPG,Acceleration,Displacement,Weight,Horsepower];
varNames = {'MPG'; 'Acceleration'; 'Displacement'; 'Weight'; 'Horsepower'};
figure
gplotmatrix(X,[],Cylinders,['c' 'b' 'm' 'g' 'r'],[],[],false);
text([.08 .24 .43 .66 .83], repmat(-.1,1,5), varNames, 'FontSize',8);
text(repmat(-.12,1,5), [.86 .62 .41 .25 .02], varNames, 'FontSize',8, 'Rotation',90);