Skip to content

Commit

Permalink
Merge 47eaf1a into 5360c08
Browse files Browse the repository at this point in the history
  • Loading branch information
derNarr committed Apr 13, 2022
2 parents 5360c08 + 47eaf1a commit c4f1baf
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ git:
quiet: true

python:
- 3.10
- 3.9
- 3.8
- 3.7

install:
- pip3 install --upgrade pip # all three OSes agree about 'pip3'
Expand Down
12 changes: 7 additions & 5 deletions doc/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,15 @@ weight matrix by specifying the ``weight`` argument:
... betas=(0.1, 0.1), method='openmp', weights=weights)
>>> weights2 # doctest: +ELLIPSIS
<xarray.DataArray (outcomes: 8, cues: 15)>
array(...
array([[ 0.24...
...
...)
...]])
Coordinates:
* outcomes (outcomes) <U6 ...
* cues (cues) <U2 ...
Attributes: ...
* outcomes (outcomes) <U6 'hand' 'plural'...
* cues (cues) <U2 '#h' 'ha' 'an' 'nd'...
Attributes:
date:...
event_path:...
...
As you may have noticed already, :py:mod:`pyndl.ndl.ndl` provides you with meta
Expand Down
4 changes: 2 additions & 2 deletions pyndl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'David-Elias Künstle, Lennard Schneider, '
'Elnaz Shafaei-Bajestan')
__author_email__ = 'konstantin.sering@uni-tuebingen.de'
__version__ = '0.8.1'
__version__ = '0.8.2'
__license__ = 'MIT'
__description__ = ('Naive discriminative learning implements learning and '
'classification models based on the Rescorla-Wagner '
Expand All @@ -38,9 +38,9 @@
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS',
'Programming Language :: Python',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
Expand Down
23 changes: 20 additions & 3 deletions pyndl/wh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
pyndl.wh
--------
*pyndl.wh* provides functions in order to train WH models
*pyndl.wh* provides functions in order to train Widrow-Hoff (WH) models. In contrast
to the Rescorla-Wagner (RW) models in the WH models can not only have binary
cues and outcomes, but can code gradual intesities in there cues and outcomes
as real, continues values.
It is possible to calculate weights for continuous cues or continues outcomes,
while keeping the outcomes respectively cues binary. Finally, it is possible to
have both sides, cues and outcomes, to be continues and calculate the
Widrow-Hoff learning rule between them.
"""
from collections import defaultdict, OrderedDict
Expand Down Expand Up @@ -45,8 +53,17 @@ def wh(events, eta, *, cue_vectors=None, outcome_vectors=None,
verbose=False, temporary_directory=None,
events_per_temporary_file=10000000):
"""
Calculate the weights for all events using the Widrow-Hoff learning rule
and training as outcomes on sematic vectors in semantics.
Calculate the weights for all events using the Widrow-Hoff learning rule in
three different flavours.
In the first flavour, cues and outcomes both are vectors and the names in
the eventfiles refer to these vectors. The vectors for all cues and
outcomes are given as an xarrayDataArray with the arguments `cue_vectors`
and `outcome_vectors'.
In the second and third flavour, only the cues or only the outcomes are
treated as vectors but the ones not being treated as vectors are still
considered being present or not being present in a binary way.
This is a parallel python implementation using numpy, multithreading and
the binary format defined in preprocess.py.
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{37,38,39}-test, checkstyle, documentation
envlist = py{38,39,310}-test, checkstyle, documentation

[testenv]
usedevelop = True
Expand Down

0 comments on commit c4f1baf

Please sign in to comment.