Join/Login

Business Software

Open Source Software

For Vendors

Blog

About

More

Articles

Create

SourceForge Podcast

Site Documentation

Subscribe to our Newsletter

Support Request

For Vendors Help Create Join Login

Business Software

Open Source Software

SourceForge Podcast

Resources

Articles

Case Studies

Blog

Menu

Help

Create

Join

Login

Home

Browse

The Simple SVM toolbox

Code

The Simple SVM toolbox Code

Brought to you by: gloosli

Summary

Files

Reviews

Support

Code

Menu ▾ ▴

Browse Commits

Browse Files

[r9]: / OCSVM / solveLinearSystem.m  Maximize  Restore  History

Download this file

93 lines (77 with data), 4.1 kB

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

function solveLinearSystem

global svModel;

% calculer le noyau

%===================================================================

if svModel.temp.new_active>0 % on a ajoute un point

% if svModel.temp.relative(svModel.temp.new_active)==0 % n'est pas un point qui revient de C

% mise a jour des indices

svModel.temp.n_H = sort([svModel.temp.n_H,svModel.temp.free(1)]);

svModel.temp.relative(svModel.temp.new_active) = svModel.temp.free(1);

svModel.temp.inverse = svModel.temp.relative([svModel.temp.active]);

[temp, svModel.temp.reverse] = sort(svModel.temp.inverse);

if max(svModel.temp.inverse)>length(svModel.temp.inverse)

[temp, svModel.temp.inverse] = sort(svModel.temp.reverse);

end

% calcul des nouvelles valeurs de H

new_valueH =kernelPol(svModel.kernel,...

svModel.data.trainvec(:,[svModel.temp.active]), ...

svModel.data.trainvec(:,svModel.temp.new_active), ...

svModel.data.trainlab([svModel.temp.active]), ...

svModel.data.trainlab(svModel.temp.new_active)); % points dans l'ordre des donnees, donc de actif

% valeurs pour G

u = new_valueH(svModel.temp.reverse);

shermanMorrison(u,svModel.temp.free(1));

% derniere mise a jour

svModel.temp.free(1) = [];

if isempty(svModel.temp.free)

svModel.temp.free = max(svModel.temp.n_H)+1;

end

elseif svModel.temp.new_active<0

% if length(find(svModel.temp.inactive==-svModel.temp.new_active))>0 % on a retir� un point

remove = find(svModel.temp.n_H==svModel.temp.relative(-svModel.temp.new_active)); % place du point � enlever dans nH

% calcul des nouvelles valeurs de H

new_valueH =kernelPol(svModel.kernel,...

svModel.data.trainvec(:,sort([svModel.temp.active;-svModel.temp.new_active])), ...

svModel.data.trainvec(:,-svModel.temp.new_active), ...

svModel.data.trainlab(sort([svModel.temp.active;-svModel.temp.new_active])), ...

svModel.data.trainlab(-svModel.temp.new_active)); % points dans l'ordre des donnees, donc de actif

% suppression des valeurs

u = new_valueH(svModel.temp.reverse);

shermanMorrison(u,-svModel.temp.relative(-svModel.temp.new_active));

% mise a jours des indices

svModel.temp.free = sort([svModel.temp.free,...

svModel.temp.relative(-svModel.temp.new_active)]);

svModel.temp.n_H(remove)=[];

svModel.temp.inverse = svModel.temp.relative(svModel.temp.active);

[temp, svModel.temp.reverse] = sort(svModel.temp.inverse);

if max(svModel.temp.inverse)>length(svModel.temp.inverse)

[temp, svModel.temp.inverse] = sort(svModel.temp.reverse);

end

svModel.temp.relative(-svModel.temp.new_active) = 0;

end

% mettre les elements dans l'ordre de H!!

A = svModel.data.trainlab([svModel.temp.active]);%; svModel.temp.bounded]);

[a b] = sort(svModel.temp.inverse(1:svModel.temp.n_active));

A = A(b);

%be = svModel.nu*svModel.temp.n;

be = 1;

ce = zeros(1,svModel.temp.n_active);

if svModel.temp.n_bounded > 0

% mise à jour de GC

svModel.temp.GC = svModel.C(svModel.temp.bounded)'*(kernelPol(svModel.kernel,...

svModel.data.trainvec(:,svModel.temp.bounded), ...

svModel.data.trainvec(:,svModel.temp.active), ...

svModel.data.trainlab(svModel.temp.bounded), ...

svModel.data.trainlab(svModel.temp.active)));

ce= ce - svModel.temp.GC(b);

be= be - svModel.C(svModel.temp.bounded)'*svModel.data.trainlab(svModel.temp.bounded);

end

M = svModel.model.G1(svModel.temp.n_H,svModel.temp.n_H)*A;

N = svModel.model.G1(svModel.temp.n_H,svModel.temp.n_H)*ce';

svModel.model.mu = (-be+A'*N)/(A'*M);

svModel.model.alpha=N-svModel.model.mu*M;

% remettre alpha dans l'ordre de l'active set

[a b] = sort(svModel.temp.inverse(1:svModel.temp.n_active));

[c d] = sort(b);

svModel.model.alpha = ...

svModel.model.alpha(d);

SourceForge

Create a Project

Open Source Software

Business Software

Top Downloaded Projects

Company

About

Team

SourceForge Headquarters
225 Broadway Suite 1600
San Diego, CA 92101
+1 (858) 422-6466

Resources

Support

Site Documentation

Site Status

SourceForge Reviews

© 2025 Slashdot Media. All Rights Reserved.

Terms Privacy Opt Out Advertise

×
Want the latest updates on software, tech news, and AI?

Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.

Submit