Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
1dd9888b
"src/geometry/cuda/geometry_op_impl.hip" did not exist on "619d735df5dc2a62eca5a00e11e4290407169cb1"
Commit
1dd9888b
authored
Aug 08, 2013
by
Davis King
Browse files
Added more comments about sparse vectors to the python examples
parent
0660dc02
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
python_examples/sequence_segmenter.py
python_examples/sequence_segmenter.py
+4
-1
python_examples/svm_struct.py
python_examples/svm_struct.py
+5
-1
No files found.
python_examples/sequence_segmenter.py
View file @
1dd9888b
...
...
@@ -49,7 +49,10 @@ def sentence_to_vectors(sentence):
# than the above form when you have very high dimensional vectors that are mostly full of
# zeros. In dlib, each sparse vector is represented as an array of pair objects. Each
# pair contains an index and value. Any index not listed in the vector is implicitly
# associated with a value of zero.
# associated with a value of zero. Additionally, when using sparse vectors with
# dlib.train_sequence_segmenter() you can use "unsorted" sparse vectors. This means you
# can add the index/value pairs into your sparse vectors in any order you want and don't
# need to worry about them being in sorted order.
def
sentence_to_sparse_vectors
(
sentence
):
vects
=
dlib
.
sparse_vectors
()
has_cap
=
dlib
.
sparse_vector
()
...
...
python_examples/svm_struct.py
View file @
1dd9888b
...
...
@@ -204,7 +204,11 @@ class three_class_classifier_problem:
# problem. So you need to pick a PSI that doesn't make the label maximization step
# intractable but also still well models your problem.
# Create a dense vector object.
# Create a dense vector object (note that you can also use unsorted sparse vectors
# (i.e. dlib.sparse_vector objects) to represent your PSI vector. This is useful
# if you have very high dimensional PSI vectors that are mostly zeros. In the
# context of this example, you would simply return a dlib.sparse_vector at the end
# of make_psi() and the rest of the example would still work properly. ).
psi
=
dlib
.
vector
()
# Set it to have 9 dimensions. Note that the elements of the vector are 0
# initialized.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment