Skip to content

Commit 27d1d39

Browse files
authored
Update README.md
1 parent 6572c44 commit 27d1d39

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,36 @@
1414
+ Knowledge sharing on wrapper feature selection
1515
+ Assists others in data mining projects
1616

17+
### Example 1
18+
```code
19+
%% Particle Swarm Optimization (PSO)
20+
clear, clc, close;
21+
22+
% Parameters settings
23+
opts.k = 5;
24+
ho = 0.2;
25+
opts.N = 10;
26+
opts.T = 100;
27+
opts.c1 = 2;
28+
opts.c2 = 2;
29+
opts.w = 0.9;
30+
31+
% Prepare data
32+
load ionosphere.mat;
33+
HO = cvpartition(label,'HoldOut',ho);
34+
opts.Model = HO;
35+
36+
% Feature selection
37+
FS = jfs('pso',feat,label,opts);
38+
39+
% Define index of selected features
40+
sf_idx = FS.sf;
41+
42+
% Accuracy
43+
Acc = jknn(feat(:,sf_idx),label,opts);
44+
45+
```
46+
1747
## Requirement
1848

1949
* MATLAB 2014 or above

0 commit comments

Comments
 (0)