2
2
3
3
@implementation T4StandardNormalizer
4
4
5
- -initWithMean : (T4Matrix*)aMean standardDeviation : (T4Matrix*)aStandardDeviation
5
+ -initWithMeans : (T4Matrix*)someMeans standardDeviations : (T4Matrix*)someStandardDeviations
6
6
{
7
7
if ( (self = [super init ]) )
8
8
{
9
- if ([aMean numberOfRows ] != [aStandardDeviation numberOfRows ])
9
+ if ([someMeans numberOfRows ] != [someStandardDeviations numberOfRows ])
10
10
T4Error (@" StandardNormalizer: mean and standard deviation matrices do not match!!!" );
11
11
12
- mean = [aMean retainAndKeepWithAllocator: allocator];
13
- standardDeviation = [aStandardDeviation retainAndKeepWithAllocator: allocator];
12
+ means = [someMeans retainAndKeepWithAllocator: allocator];
13
+ standardDeviations = [someStandardDeviations retainAndKeepWithAllocator: allocator];
14
14
}
15
15
16
16
return self;
@@ -21,20 +21,20 @@ @implementation T4StandardNormalizer
21
21
int numRows;
22
22
int numExamples;
23
23
int totalNumColumns;
24
- T4Matrix *aMean ;
25
- T4Matrix *aStandardDeviation ;
24
+ T4Matrix *someMeans ;
25
+ T4Matrix *someStandardDeviations ;
26
26
real *meanColumn;
27
27
real *standardDeviationColumn;
28
28
int r, c, e;
29
29
30
30
numExamples = [aDataset count ];
31
31
numRows = [[[aDataset objectAtIndex: 0 ] objectAtIndex: anIndex] numberOfRows ];
32
- aMean = [[[T4Matrix alloc ] initWithNumberOfRows: numRows] keepWithAllocator: allocator];
33
- aStandardDeviation = [[[T4Matrix alloc ] initWithNumberOfRows: numRows] keepWithAllocator: allocator];
34
- meanColumn = [aMean firstColumn ];
35
- standardDeviationColumn = [aStandardDeviation firstColumn ];
36
- [aMean zero ];
37
- [aStandardDeviation zero ];
32
+ someMeans = [[[T4Matrix alloc ] initWithNumberOfRows: numRows] keepWithAllocator: allocator];
33
+ someStandardDeviations = [[[T4Matrix alloc ] initWithNumberOfRows: numRows] keepWithAllocator: allocator];
34
+ meanColumn = [someMeans firstColumn ];
35
+ standardDeviationColumn = [someStandardDeviations firstColumn ];
36
+ [someMeans zero ];
37
+ [someStandardDeviations zero ];
38
38
totalNumColumns = 0 ;
39
39
40
40
for (e = 0 ; e < numExamples; e++)
@@ -64,7 +64,7 @@ @implementation T4StandardNormalizer
64
64
standardDeviationColumn[r] = sqrt (standardDeviationColumn[r]);
65
65
}
66
66
67
- return [self initWithMean: aMean standardDeviation: aStandardDeviation ];
67
+ return [self initWithMeans: someMeans standardDeviations: someStandardDeviations ];
68
68
}
69
69
70
70
-initWithDataset : (NSArray *)aDataset
@@ -94,8 +94,8 @@ @implementation T4StandardNormalizer
94
94
{
95
95
int numColumns = [aMatrix numberOfColumns ];
96
96
int numRows = [aMatrix numberOfRows ];
97
- real *meanColumn = [mean firstColumn ];
98
- real *standardDeviationColumn = [standardDeviation firstColumn ];
97
+ real *meanColumn = [means firstColumn ];
98
+ real *standardDeviationColumn = [standardDeviations firstColumn ];
99
99
int r, c;
100
100
101
101
for (c = 0 ; c < numColumns; c++)
@@ -112,29 +112,29 @@ @implementation T4StandardNormalizer
112
112
return self;
113
113
}
114
114
115
- -(T4Matrix*)mean
115
+ -(T4Matrix*)means
116
116
{
117
- return mean ;
117
+ return means ;
118
118
}
119
119
120
- -(T4Matrix*)standardDeviation
120
+ -(T4Matrix*)standardDeviations
121
121
{
122
- return standardDeviation ;
122
+ return standardDeviations ;
123
123
}
124
124
125
125
-initWithCoder : (NSCoder *)aCoder
126
126
{
127
127
self = [super initWithCoder: aCoder];
128
- mean = [[aCoder decodeObject ] retainAndKeepWithAllocator: allocator];
129
- standardDeviation = [[aCoder decodeObject ] retainAndKeepWithAllocator: allocator];
128
+ means = [[aCoder decodeObject ] retainAndKeepWithAllocator: allocator];
129
+ standardDeviations = [[aCoder decodeObject ] retainAndKeepWithAllocator: allocator];
130
130
return self;
131
131
}
132
132
133
133
-(void )encodeWithCoder : (NSCoder *)aCoder
134
134
{
135
135
[super encodeWithCoder: aCoder];
136
- [aCoder encodeObject: mean ];
137
- [aCoder encodeObject: standardDeviation ];
136
+ [aCoder encodeObject: means ];
137
+ [aCoder encodeObject: standardDeviations ];
138
138
}
139
139
140
140
@end
0 commit comments