-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
import dataset | ||
import nn | ||
import tools |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# File : echotorch/nn/FreeRunReservoir.py | ||
# Description : Implement the Echo State Network neural network with feed backs. | ||
# Date : 6th of April, 2017 | ||
# | ||
# This file is part of EchoTorch. EchoTorch is free software: you can | ||
# redistribute it and/or modify it under the terms of the GNU General Public | ||
# License as published by the Free Software Foundation, version 2. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, write to the Free Software Foundation, Inc., 51 | ||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Copyright Nils Schaetti <nils.schaetti@unine.ch> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# File : echotorch/nn/LeakyReservoir.py | ||
# Description : Implement the Echo State Network neural network with leaky units. | ||
# Date : 6th of April, 2017 | ||
# | ||
# This file is part of EchoTorch. EchoTorch is free software: you can | ||
# redistribute it and/or modify it under the terms of the GNU General Public | ||
# License as published by the Free Software Foundation, version 2. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, write to the Free Software Foundation, Inc., 51 | ||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Copyright Nils Schaetti <nils.schaetti@unine.ch> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# File : echotorch/nn/Reservoir.py | ||
# Description : Implement the Echo State Network neural network. | ||
# Date : 6th of April, 2017 | ||
# | ||
# This file is part of EchoTorch. EchoTorch is free software: you can | ||
# redistribute it and/or modify it under the terms of the GNU General Public | ||
# License as published by the Free Software Foundation, version 2. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, write to the Free Software Foundation, Inc., 51 | ||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Copyright Nils Schaetti <nils.schaetti@unine.ch> | ||
|
||
import torch | ||
import torch.nn as nn | ||
|
||
|
||
# Echo State Network Reservoir module | ||
class Reservoir(nn.Module): | ||
|
||
def __init__(self, input_features, reservoir_features, output_features, bias=True): | ||
# Params | ||
self.input_features = input_features | ||
self.reservoir_features = reservoir_features | ||
self.output_features = output_features | ||
|
||
# Parameters | ||
self.weight = nn.Parameter(torch.Tensor(output_features)) | ||
|
||
# If bias | ||
if bias: | ||
self.bias = nn.Parameter(torch.Tensor(reservoir_features)) | ||
else: | ||
self.register_parameter('bias', None) | ||
# end if | ||
|
||
# Initialize reservoir weights randomly | ||
self.w = torch.Tensor.random_(-1, 2) | ||
|
||
# end __init__ | ||
|
||
|
||
# Forward | ||
def forward(self, input): | ||
return Reservoir()(input, self.weight, self.bias) | ||
# end forward | ||
|
||
# end Reservoir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
from Reservoir import * | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
|
||
import echotorch.nn | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
# Create Echo State Network | ||
esn = echotorch.nn.Reservoir(input_features=40, reservoir_features=100, output_features=10, bias=True) | ||
|
||
# end if |