Skip to content

Commit e3e6aee

Browse files
fix: resolve merge conflicts with base autoloop branch
Accept the base branch's version of 43 conflicted files to resolve merge conflicts and unblock PR merge. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7c85654 commit e3e6aee

43 files changed

Lines changed: 242 additions & 586 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/bicluster/bicluster.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ function svd2(
2727
for (let _iter = 0; _iter < 30; _iter++) {
2828
const u = new Float64Array(m);
2929
for (let i = 0; i < m; i++) {
30-
for (let j = 0; j < n; j++) u[i] += (matrix[i]?.[j] ?? 0) * (v[j] ?? 0);
30+
for (let j = 0; j < n; j++)
31+
u[i]! += (matrix[i]?.[j] ?? 0) * (v[j] ?? 0);
3132
}
3233
const newV = new Float64Array(n);
3334
for (let i = 0; i < m; i++) {
3435
for (let j = 0; j < n; j++)
35-
newV[j] += (matrix[i]?.[j] ?? 0) * (u[i] ?? 0);
36+
newV[j]! += (matrix[i]?.[j] ?? 0) * (u[i] ?? 0);
3637
}
3738
let norm = 0;
3839
for (let j = 0; j < n; j++) norm += (newV[j] ?? 0) ** 2;
@@ -42,7 +43,7 @@ function svd2(
4243
}
4344
const u = new Float64Array(m);
4445
for (let i = 0; i < m; i++) {
45-
for (let j = 0; j < n; j++) u[i] += (matrix[i]?.[j] ?? 0) * (v[j] ?? 0);
46+
for (let j = 0; j < n; j++) u[i]! += (matrix[i]?.[j] ?? 0) * (v[j] ?? 0);
4647
}
4748
let sigma = 0;
4849
for (let i = 0; i < m; i++) sigma += (u[i] ?? 0) ** 2;
@@ -95,12 +96,12 @@ function kmeansSimple(X: Float64Array[], k: number, maxIter = 100): Int32Array {
9596
for (let j = 0; j < k; j++) centers[j] = new Float64Array(d);
9697
for (let i = 0; i < n; i++) {
9798
const c = labels[i]!;
98-
counts[c]++;
99+
counts[c]!++;
99100
for (let l = 0; l < d; l++) centers[c]![l]! += X[i]?.[l] ?? 0;
100101
}
101102
for (let j = 0; j < k; j++) {
102103
if ((counts[j] ?? 0) > 0) {
103-
for (let l = 0; l < d; l++) centers[j]![l]! /= counts[j];
104+
for (let l = 0; l < d; l++) centers[j]![l]! /= counts[j] ?? 1;
104105
}
105106
}
106107
}
@@ -196,8 +197,8 @@ export class SpectralCoclustering {
196197
const colSums = new Float64Array(nCols);
197198
for (let i = 0; i < nRows; i++) {
198199
for (let j = 0; j < nCols; j++) {
199-
rowSums[i] += X[i]?.[j] ?? 0;
200-
colSums[j] += X[i]?.[j] ?? 0;
200+
rowSums[i]! += X[i]?.[j] ?? 0;
201+
colSums[j]! += X[i]?.[j] ?? 0;
201202
}
202203
}
203204
const normalized = X.map((row, i) => {

src/cluster/hdbscan.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class HDBSCAN {
123123
!inMST[v] &&
124124
mrd[u]![v]! < (minEdge[v] ?? Number.POSITIVE_INFINITY)
125125
) {
126-
minEdge[v]! = mrd[u]![v];
126+
minEdge[v] = mrd[u]![v] ?? 0;
127127
parent[v]! = u;
128128
}
129129
}
@@ -137,7 +137,7 @@ export class HDBSCAN {
137137
const find = (x: number): number => {
138138
let cur = x;
139139
while (uf[cur] !== cur) {
140-
uf[cur]! = uf[uf[cur]!];
140+
uf[cur] = uf[uf[cur]!] ?? cur;
141141
cur = uf[cur]!;
142142
}
143143
return cur;
@@ -177,7 +177,7 @@ export class HDBSCAN {
177177
const sz = clusterSizes[root] ?? 1;
178178
if (sz >= this.minClusterSize) {
179179
if (!rootToCluster.has(root)) rootToCluster.set(root, nextCluster++);
180-
labels[i]! = rootToCluster.get(root);
180+
labels[i] = rootToCluster.get(root) ?? -1;
181181
}
182182
}
183183

src/covariance/mcd.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class MinCovDet {
103103
const n = indices.length;
104104
const mean = new Float64Array(p);
105105
for (const idx of indices)
106-
for (let j = 0; j < p; j++) mean[j] += (X[idx]![j] ?? 0) / n;
106+
for (let j = 0; j < p; j++) mean[j]! += (X[idx]![j] ?? 0) / n;
107107
const cov: Float64Array[] = Array.from(
108108
{ length: p },
109109
() => new Float64Array(p),
@@ -113,7 +113,7 @@ export class MinCovDet {
113113
for (let j = 0; j < p; j++) diff[j] = (X[idx]![j] ?? 0) - (mean[j] ?? 0);
114114
for (let i = 0; i < p; i++)
115115
for (let j = 0; j < p; j++)
116-
cov[i]![j] += ((diff[i] ?? 0) * (diff[j] ?? 0)) / (n - 1);
116+
cov[i]![j]! += ((diff[i] ?? 0) * (diff[j] ?? 0)) / (n - 1);
117117
}
118118
return { mean, cov };
119119
}

src/covariance/shrinkage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ function centerMatrix(
4545
): Float64Array {
4646
const means = new Float64Array(nFeatures);
4747
for (let i = 0; i < nSamples; i++)
48-
for (let j = 0; j < nFeatures; j++) means[j]! += X[i * nFeatures + j];
48+
for (let j = 0; j < nFeatures; j++) means[j]! += X[i * nFeatures + j] ?? 0;
4949
for (let j = 0; j < nFeatures; j++) means[j]! /= nSamples;
5050
for (let i = 0; i < nSamples; i++)
51-
for (let j = 0; j < nFeatures; j++) X[i * nFeatures + j]! -= means[j];
51+
for (let j = 0; j < nFeatures; j++) X[i * nFeatures + j]! -= means[j] ?? 0;
5252
return means;
5353
}
5454

src/cross_decomposition/pls.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,6 @@ export class PLSRegression {
204204
qy[j] = (qy[j] ?? 0) + (yi[j] ?? 0) * (t[i] ?? 0);
205205
}
206206
}
207-
if (sNorm2 > 1e-15)
208-
for (let j = 0; j < q; j++) qy[j] = (qy[j] ?? 0) / sNorm2;
209207

210208
this.xWeights_[comp] = u;
211209
this.yWeights_[comp] = v;
@@ -220,13 +218,13 @@ export class PLSRegression {
220218
Xc = Xc.map((xi, i) => {
221219
const out = new Float64Array(p);
222220
for (let j = 0; j < p; j++)
223-
out[j] = (xi[j] ?? 0) - (tFull[i] ?? 0) * (px[j] ?? 0);
221+
out[j] = (xi[j] ?? 0) - (t[i] ?? 0) * (px[j] ?? 0);
224222
return out;
225223
});
226224
Yc = Yc.map((yi, i) => {
227225
const out = new Float64Array(q);
228226
for (let j = 0; j < q; j++)
229-
out[j] = (yi[j] ?? 0) - (tFull[i] ?? 0) * (qy[j] ?? 0);
227+
out[j] = (yi[j] ?? 0) - (t[i] ?? 0) * (qy[j] ?? 0);
230228
return out;
231229
});
232230
}

src/cross_decomposition/pls_svd.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ export class PLSSVDExt {
122122
const v = new Float64Array(nTargets);
123123
for (let j = 0; j < nFeatures; j++)
124124
for (let l = 0; l < nTargets; l++)
125-
v[l] += (C[j]?.[l] ?? 0) * (u[j] ?? 0);
125+
v[l]! += (C[j]?.[l] ?? 0) * (u[j] ?? 0);
126126
const normV = Math.sqrt(v.reduce((s, v2) => s + v2 ** 2, 0)) || 1;
127127
for (let l = 0; l < nTargets; l++) v[l] = (v[l] ?? 0) / normV;
128128

129129
// u = C v
130130
const uNew = new Float64Array(nFeatures);
131131
for (let j = 0; j < nFeatures; j++)
132132
for (let l = 0; l < nTargets; l++)
133-
uNew[j] += (C[j]?.[l] ?? 0) * (v[l] ?? 0);
133+
uNew[j]! += (C[j]?.[l] ?? 0) * (v[l] ?? 0);
134134

135135
// Orthogonalize against previous
136136
for (const pu of xWeights) {
@@ -149,7 +149,7 @@ export class PLSSVDExt {
149149
const v = new Float64Array(nTargets);
150150
for (let j = 0; j < nFeatures; j++)
151151
for (let l = 0; l < nTargets; l++)
152-
v[l] += (C[j]?.[l] ?? 0) * (u[j] ?? 0);
152+
v[l]! += (C[j]?.[l] ?? 0) * (u[j] ?? 0);
153153
const normV = Math.sqrt(v.reduce((s, v2) => s + v2 ** 2, 0)) || 1;
154154
for (let l = 0; l < nTargets; l++) v[l] = (v[l] ?? 0) / normV;
155155

src/datasets/openml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export async function fetchOpenML(
6464
// Parse the dataset list to find the actual dataset ID
6565
let actualDataId = dataId;
6666
if (actualDataId == null) {
67-
const datasets = json.data as { dataset?: { did?: number }[] } | undefined;
67+
const datasets = json.data;
6868
const did = datasets?.dataset?.[0]?.did;
6969
if (did == null)
7070
throw new Error(`fetchOpenML: dataset "${name}" not found`);

src/decomposition/ica.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class FastICA {
101101
for (let j = 0; j < p; j++) {
102102
for (let l = j; l < p; l++) {
103103
cov[j]![l]! += (Xc[i]![j] ?? 0) * (Xc[i]![l] ?? 0);
104-
if (l !== j) cov[l]![j]! = cov[j]![l];
104+
if (l !== j) cov[l]![j] = cov[j]![l] ?? 0;
105105
}
106106
}
107107
}

src/decomposition/online_pca.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ export class IncrementalPCAOnline {
109109
const u = new Float64Array(rows);
110110
for (let i = 0; i < rows; i++) {
111111
for (let j = 0; j < cols; j++)
112-
u[i] += (augmented[i]?.[j] ?? 0) * (V[c]?.[j] ?? 0);
112+
u[i]! += (augmented[i]?.[j] ?? 0) * (V[c]?.[j] ?? 0);
113113
}
114114
const vNew = new Float64Array(cols);
115115
for (let i = 0; i < rows; i++) {
116116
for (let j = 0; j < cols; j++)
117-
vNew[j] += (augmented[i]?.[j] ?? 0) * (u[i] ?? 0);
117+
vNew[j]! += (augmented[i]?.[j] ?? 0) * (u[i] ?? 0);
118118
}
119119
// Orthogonalize against previous
120120
for (let p = 0; p < c; p++) {

src/discriminant_analysis/qda.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class QuadraticDiscriminantAnalysis {
5959
// Class mean
6060
const mean = new Float64Array(nFeatures);
6161
for (const x of classX) {
62-
for (let j = 0; j < nFeatures; j++) mean[j] += (x[j] ?? 0) / nc;
62+
for (let j = 0; j < nFeatures; j++) mean[j]! += (x[j] ?? 0) / nc;
6363
}
6464
this.means_.push(mean);
6565

@@ -71,14 +71,14 @@ export class QuadraticDiscriminantAnalysis {
7171
for (const x of classX) {
7272
for (let j = 0; j < nFeatures; j++) {
7373
for (let k = 0; k < nFeatures; k++) {
74-
cov[j]![k] +=
74+
cov[j]![k]! +=
7575
(((x[j] ?? 0) - mean[j]!) * ((x[k] ?? 0) - mean[k]!)) / (nc - 1);
7676
}
7777
}
7878
}
7979
// Regularization
8080
if (this.regParam > 0) {
81-
for (let j = 0; j < nFeatures; j++) cov[j]![j] += this.regParam;
81+
for (let j = 0; j < nFeatures; j++) cov[j]![j]! += this.regParam;
8282
}
8383

8484
if (this.storeCovariance) this.covariance_.push(cov);

0 commit comments

Comments
 (0)