Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Curio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jim Wallace
Curio
Commits
2b5fe9de
Commit
2b5fe9de
authored
1 year ago
by
Mingchung Xia
Browse files
Options
Downloads
Patches
Plain Diff
Minor styling changes
parent
7c3b180e
No related branches found
No related tags found
1 merge request
!13
HNSW Implementation with Testcases
Pipeline
#110563
failed
1 year ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sources/SwiftNLP/1. Data Collection/DeterministicSampleVectorIndex.swift
+2
-2
2 additions, 2 deletions
...P/1. Data Collection/DeterministicSampleVectorIndex.swift
Tests/SwiftNLPTests/2. Encoding/HNSWTests.swift
+1
-1
1 addition, 1 deletion
Tests/SwiftNLPTests/2. Encoding/HNSWTests.swift
with
3 additions
and
3 deletions
Sources/SwiftNLP/1. Data Collection/DeterministicSampleVectorIndex.swift
+
2
−
2
View file @
2b5fe9de
...
@@ -57,8 +57,8 @@ public struct DeterministicSampleVectorIndex<Vector: Collection & Codable> where
...
@@ -57,8 +57,8 @@ public struct DeterministicSampleVectorIndex<Vector: Collection & Codable> where
let
convertedVector
:
[
Double
]
=
vector
.
map
{
Double
(
$0
)
}
let
convertedVector
:
[
Double
]
=
vector
.
map
{
Double
(
$0
)
}
if
let
metricVector
=
convertedVector
as?
CartesianDistanceMetric
<
Vector
>.
Vector
{
if
let
metricVector
=
convertedVector
as?
CartesianDistanceMetric
<
Vector
>.
Vector
{
/// base.insert will returns an unused 'Key' type but will implicitly modify base
/// base.insert will returns an unused 'Key' type but will implicitly modify base
let
key
=
base
.
insert
(
metricVector
,
using
:
&
srng
)
let
_
=
base
.
insert
(
metricVector
,
using
:
&
srng
)
// let
key
= base.insert(metricVector, using: &drng)
// let
_
= base.insert(metricVector, using: &drng)
}
else
{
}
else
{
fatalError
(
"Unable to get metric vector"
)
fatalError
(
"Unable to get metric vector"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Tests/SwiftNLPTests/2. Encoding/HNSWTests.swift
+
1
−
1
View file @
2b5fe9de
...
@@ -84,7 +84,7 @@ final class HNSWTests: XCTestCase {
...
@@ -84,7 +84,7 @@ final class HNSWTests: XCTestCase {
corpus
.
addUntokenizedDocument
(
text
)
corpus
.
addUntokenizedDocument
(
text
)
}
}
}
}
//print("Loaded \(corpus.encodedDocuments.count) documents.")
//print("Loaded \(corpus.encodedDocuments.
base.vectors.
count) documents.")
XCTAssert
(
corpus
.
encodedDocuments
.
base
.
vectors
.
count
==
17999
)
XCTAssert
(
corpus
.
encodedDocuments
.
base
.
vectors
.
count
==
17999
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment