Skip to content

Commit 915d2af

Browse files
author
bezzazi abir
committed
renamed class of svm from AISupporVectorMachinesSoftSGD to AISupportVectorMachines
1 parent bcce909 commit 915d2af

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/AI-SupportVectorMachines-Tests/AISupportVectorMachinesSoftSGDTest.class.st renamed to src/AI-SupportVectorMachines-Tests/AISupportVectorMachinesTest.class.st

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
An AISupportVectorMachinesSoftSGDTest is a test class for testing the behavior of AISupportVectorMachinesSoftSGD
33
"
44
Class {
5-
#name : #AISupportVectorMachinesSoftSGDTest,
5+
#name : #AISupportVectorMachinesTest,
66
#superclass : #TestCase,
77
#instVars : [
88
'model'
@@ -11,14 +11,14 @@ Class {
1111
}
1212

1313
{ #category : #running }
14-
AISupportVectorMachinesSoftSGDTest >> setUp [
14+
AISupportVectorMachinesTest >> setUp [
1515
super setUp.
1616

17-
model := AISupportVectorMachinesSoftSGD new
17+
model := AISupportVectorMachines new
1818
]
1919

2020
{ #category : #test }
21-
AISupportVectorMachinesSoftSGDTest >> testCalculateCostGradientXY [
21+
AISupportVectorMachinesTest >> testCalculateCostGradientXY [
2222

2323
| x y w res |
2424
x := #( #( 1 2 3 ) #( 4 5 6 ) #( 7 8 9 ) ).
@@ -31,7 +31,7 @@ AISupportVectorMachinesSoftSGDTest >> testCalculateCostGradientXY [
3131
]
3232

3333
{ #category : #test }
34-
AISupportVectorMachinesSoftSGDTest >> testCalculateDistancesForXY [
34+
AISupportVectorMachinesTest >> testCalculateDistancesForXY [
3535

3636
| x y w res |
3737
x := #( #( 1 2 3 ) #( 4 5 6 ) #( 7 8 9 ) ).
@@ -43,7 +43,7 @@ AISupportVectorMachinesSoftSGDTest >> testCalculateDistancesForXY [
4343
]
4444

4545
{ #category : #test }
46-
AISupportVectorMachinesSoftSGDTest >> testCalculateDistancesForXYForLittleNumbers [
46+
AISupportVectorMachinesTest >> testCalculateDistancesForXYForLittleNumbers [
4747

4848
| x y w res |
4949
x := #( #( 1 2 3 ) #( 4 5 6 ) #( 7 8 9 ) ).
@@ -55,7 +55,7 @@ AISupportVectorMachinesSoftSGDTest >> testCalculateDistancesForXYForLittleNumber
5555
]
5656

5757
{ #category : #test }
58-
AISupportVectorMachinesSoftSGDTest >> testComputeCostXY [
58+
AISupportVectorMachinesTest >> testComputeCostXY [
5959

6060
| x y w res |
6161
x := #( #( 1 2 3 ) #( 4 5 6 ) #( 7 8 9 ) ).
@@ -69,7 +69,7 @@ AISupportVectorMachinesSoftSGDTest >> testComputeCostXY [
6969
]
7070

7171
{ #category : #test }
72-
AISupportVectorMachinesSoftSGDTest >> testFitXY [
72+
AISupportVectorMachinesTest >> testFitXY [
7373

7474
| x y res |
7575
x := #( #( 1 0 0 ) #( 1 1 1 ) #( 1 3 3 ) #( 1 4 4 ) ).
@@ -88,7 +88,7 @@ AISupportVectorMachinesSoftSGDTest >> testFitXY [
8888
]
8989

9090
{ #category : #test }
91-
AISupportVectorMachinesSoftSGDTest >> testPredict [
91+
AISupportVectorMachinesTest >> testPredict [
9292

9393
| expectedOutput x testInput y actualOutput |
9494
x := #( #( 1 0 0 ) #( 1 1 1 ) #( 1 3 3 ) #( 1 4 4 ) ).

src/AI-SupportVectorMachines/AISupportVectorMachinesSoftSGD.class.st renamed to src/AI-SupportVectorMachines/AISupportVectorMachines.class.st

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
I implement the soft margin of Support Vector Machines with Stochastic Gradient Descent.
33
"
44
Class {
5-
#name : #AISupportVectorMachinesSoftSGD,
5+
#name : #AISupportVectorMachines,
66
#superclass : #Object,
77
#instVars : [
88
'weights',
@@ -14,7 +14,7 @@ Class {
1414
}
1515

1616
{ #category : #accessing }
17-
AISupportVectorMachinesSoftSGD >> calculateCostGradientX: inputMatrix y: outputVector [
17+
AISupportVectorMachines >> calculateCostGradientX: inputMatrix y: outputVector [
1818

1919
| distance dw di numberOfRows output input |
2020
numberOfRows := inputMatrix size.
@@ -40,15 +40,15 @@ AISupportVectorMachinesSoftSGD >> calculateCostGradientX: inputMatrix y: outputV
4040
]
4141

4242
{ #category : #'as yet unclassified' }
43-
AISupportVectorMachinesSoftSGD >> calculateDistancesForX: inputMatrix y: outputVector [
43+
AISupportVectorMachines >> calculateDistancesForX: inputMatrix y: outputVector [
4444

4545
| xDotWeights |
4646
xDotWeights := inputMatrix collect: [ :row | (row * weights) sum ].
4747
^ 1 - (outputVector * xDotWeights)
4848
]
4949

5050
{ #category : #accessing }
51-
AISupportVectorMachinesSoftSGD >> computeCostX: inputMatrix y: outputVector [
51+
AISupportVectorMachines >> computeCostX: inputMatrix y: outputVector [
5252

5353
| numberOfRows distances hingeLoss cost |
5454
numberOfRows := inputMatrix size.
@@ -64,7 +64,7 @@ AISupportVectorMachinesSoftSGD >> computeCostX: inputMatrix y: outputVector [
6464
]
6565

6666
{ #category : #'as yet unclassified' }
67-
AISupportVectorMachinesSoftSGD >> fitX: inputMatrix y: outputVector [
67+
AISupportVectorMachines >> fitX: inputMatrix y: outputVector [
6868

6969
"Stochastic Gradient Descent With Stoppage Criterion"
7070

@@ -93,40 +93,40 @@ AISupportVectorMachinesSoftSGD >> fitX: inputMatrix y: outputVector [
9393
]
9494

9595
{ #category : #accessing }
96-
AISupportVectorMachinesSoftSGD >> learningRate: aNumber [
96+
AISupportVectorMachines >> learningRate: aNumber [
9797
learningRate := aNumber
9898
]
9999

100100
{ #category : #accessing }
101-
AISupportVectorMachinesSoftSGD >> maxEpochs: aNumber [
101+
AISupportVectorMachines >> maxEpochs: aNumber [
102102
maxEpochs := aNumber
103103
]
104104

105105
{ #category : #'as yet unclassified' }
106-
AISupportVectorMachinesSoftSGD >> predict: inputMatrix [
106+
AISupportVectorMachines >> predict: inputMatrix [
107107

108108
^ self signFunction: inputMatrix
109109

110110

111111
]
112112

113113
{ #category : #accessing }
114-
AISupportVectorMachinesSoftSGD >> regularizationStrenght: aNumber [
114+
AISupportVectorMachines >> regularizationStrenght: aNumber [
115115
regularizationStrenght := aNumber
116116
]
117117

118118
{ #category : #'as yet unclassified' }
119-
AISupportVectorMachinesSoftSGD >> signFunction: inputMatrix [
119+
AISupportVectorMachines >> signFunction: inputMatrix [
120120

121121
^inputMatrix collect: [ :row | ((row * weights) sum) sign ]
122122
]
123123

124124
{ #category : #accessing }
125-
AISupportVectorMachinesSoftSGD >> weights [
125+
AISupportVectorMachines >> weights [
126126
^weights
127127
]
128128

129129
{ #category : #accessing }
130-
AISupportVectorMachinesSoftSGD >> weights: aCollection [
130+
AISupportVectorMachines >> weights: aCollection [
131131
weights := aCollection
132132
]

0 commit comments

Comments
 (0)