Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.linear
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
bob
bob.learn.linear
Commits
fc57a620
There was a problem fetching the pipeline summary.
Commit
fc57a620
authored
6 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
[sphinx] Fixed doc test
parent
9359106c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/guide.rst
+14
-14
14 additions, 14 deletions
doc/guide.rst
with
14 additions
and
14 deletions
doc/guide.rst
+
14
−
14
View file @
fc57a620
...
@@ -39,16 +39,15 @@ in double-precision. Here is how to use a
...
@@ -39,16 +39,15 @@ in double-precision. Here is how to use a
.. doctest::
.. doctest::
>>> W = numpy.array([[0.5, 0.5], [1.0, 1.0]], 'float64')
>>> W = numpy.array([[0.5, 0.5], [1.0, 1.0]], 'float64')
>>> W
>>> numpy.allclose(W, [[ 0.5, 0.5], [ 1. , 1. ]])
array([[ 0.5, 0.5],
True
[ 1. , 1. ]])
>>> machine = bob.learn.linear.Machine(W)
>>> machine = bob.learn.linear.Machine(W)
>>> machine.shape
>>> machine.shape
(2, 2)
(2, 2)
>>> x = numpy.array([0.3, 0.4], 'float64')
>>> x = numpy.array([0.3, 0.4], 'float64')
>>> y = machine(x)
>>> y = machine(x)
>>>
y
>>>
numpy.allclose(y, [ 0.55, 0.55])
array([ 0.55, 0.55])
True
As was shown in the above example, the way to pass data through a machine is to
As was shown in the above example, the way to pass data through a machine is to
call its :py:meth:`bob.learn.linear.Machine.forward` method, for which the
call its :py:meth:`bob.learn.linear.Machine.forward` method, for which the
...
@@ -97,10 +96,10 @@ division. By default, :math:`s := 0.0` and :math:`d := 1.0`.
...
@@ -97,10 +96,10 @@ division. By default, :math:`s := 0.0` and :math:`d := 1.0`.
.. doctest::
.. doctest::
>>> machine.input_subtract
>>>
numpy.allclose(
machine.input_subtract
, [ 0., 0.])
array([ 0., 0.])
True
>>> machine.input_divide
>>>
numpy.allclose(
machine.input_divide
, [ 1., 1.])
array([ 1., 1.])
True
To set a new value for :math:`s` or :math:`d` just assign the desired machine
To set a new value for :math:`s` or :math:`d` just assign the desired machine
property:
property:
...
@@ -171,7 +170,7 @@ Next, input data can be projected using this learned projection matrix
...
@@ -171,7 +170,7 @@ Next, input data can be projected using this learned projection matrix
>>> e = numpy.array([3.2,-3.3,-10], 'float64')
>>> e = numpy.array([3.2,-3.3,-10], 'float64')
>>> print(machine(e))
>>> print(machine(e))
[
9.999 0.47 0.092]
[9.999 0.47
0.092]
Linear discriminant analysis
Linear discriminant analysis
...
@@ -204,11 +203,12 @@ for **PCA**. This is shown below.
...
@@ -204,11 +203,12 @@ for **PCA**. This is shown below.
>>> print(eig_vals) # doctest: +SKIP
>>> print(eig_vals) # doctest: +SKIP
[ 13.10097786 0. ]
[ 13.10097786 0. ]
>>> machine.resize(3,1) # Make the output space of dimension 1
>>> machine.resize(3,1) # Make the output space of dimension 1
>>> print(machine.weights)
# The new weights after the training procedure
>>> print(machine.weights) # The new weights after the training procedure
[[
0.609]
[[0.609]
[
0.785]
[
0.785]
[
0.111]]
[
0.111]]
Whitening
Whitening
==========
==========
...
...
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