Beispiel #1
0
    def __init__(self, network_class, **overrides):
        '''Set up an experiment by parsing arguments and building a network.

        The only input this constructor needs is the Python class of the network
        to build. Other configuration---for example, creating the appropriate
        trainer class---typically takes place by parsing command-line argument
        values, or by a call to train(...).

        Any keyword arguments provided to the constructor will be used to
        override values passed on the command line. (Typically this is used to
        provide experiment-specific default values for command line arguments
        that have no global defaults, e.g., network architecture.)
        '''
        self.args, self.kwargs = climate.parse_args(**overrides)
        if 'activation' in self.kwargs:
            warnings.warn(
                'please use --hidden-activation instead of --activation',
                DeprecationWarning)
            self.kwargs['hidden_activation'] = self.kwargs.pop('activation')

        if self.kwargs.get('help_activation'):
            print(HELP_ACTIVATION)
            sys.exit(0)

        if self.kwargs.get('help_optimize'):
            print(HELP_OPTIMIZE)
            sys.exit(0)

        assert network_class is not feedforward.Network, \
            'use a concrete theanets.Network subclass ' \
            'like theanets.{Autoencoder,Regressor,...}'
        self.network = network_class(**self.kwargs)
Beispiel #2
0
    def __init__(self, network_class, **overrides):
        '''Set up an experiment by parsing arguments and building a network.

        The only input this constructor needs is the Python class of the network
        to build. Other configuration---for example, creating the appropriate
        trainer class---typically takes place by parsing command-line argument
        values, or by a call to train(...).

        Any keyword arguments provided to the constructor will be used to
        override values passed on the command line. (Typically this is used to
        provide experiment-specific default values for command line arguments
        that have no global defaults, e.g., network architecture.)
        '''
        self.args, self.kwargs = climate.parse_args(**overrides)
        if 'activation' in self.kwargs:
            warnings.warn(
                'please use --hidden-activation instead of --activation',
                DeprecationWarning)
            self.kwargs['hidden_activation'] = self.kwargs.pop('activation')

        if self.kwargs.get('help_activation'):
            print(HELP_ACTIVATION)
            sys.exit(0)

        if self.kwargs.get('help_optimize'):
            print(HELP_OPTIMIZE)
            sys.exit(0)

        assert network_class is not feedforward.Network, \
            'use a concrete theanets.Network subclass ' \
            'like theanets.{Autoencoder,Regressor,...}'
        self.network = network_class(**self.kwargs)
Beispiel #3
0
    def __init__(self, network_class, **overrides):
        '''Set up an experiment -- build a network and a trainer.

        The only input this constructor needs is the Python class of the network
        to build. Other configuration---for example, creating the appropriate
        trainer class---typically takes place by parsing command-line argument
        values.

        Datasets also need to be added to the experiment, either :

        - manually, by calling add_dataset(...), or
        - at runtime, by providing data to the run(train_data, valid_data)
          method.

        Datasets are typically provided as numpy arrays, but they can also be
        provided as callables, as described in the dataset module.

        Any keyword arguments provided to the constructor will be used to
        override values passed on the command line. (Typically this is used to
        provide experiment-specific default values for command line arguments
        that have no global defaults, e.g., network architecture.)
        '''
        self.trainers = []
        self.datasets = {}

        self.args, self.kwargs = climate.parse_args(**overrides)
        if 'activation' in self.kwargs:
            warnings.warn(
                'please use --hidden-activation instead of --activation',
                DeprecationWarning)
            activation = self.kwargs.pop('activation')
            if not self.kwargs.get('hidden_activation'):
                self.kwargs['hidden_activation'] = activation

        if self.kwargs.get('help_activation'):
            print(HELP_ACTIVATION)
            sys.exit(0)

        if self.kwargs.get('help_optimize'):
            print(HELP_OPTIMIZE)
            sys.exit(0)

        kw = {}
        kw.update(self.kwargs)
        self.network = self._build_network(network_class, **kw)

        kw = {}
        kw.update(self.kwargs)
        self._build_trainers(**kw)
Beispiel #4
0
    def __init__(self, network_class, **overrides):
        '''Set up an experiment -- build a network and a trainer.

        The only input this constructor needs is the Python class of the network
        to build. Other configuration---for example, creating the appropriate
        trainer class---typically takes place by parsing command-line argument
        values.

        Datasets also need to be added to the experiment, either :

        - manually, by calling add_dataset(...), or
        - at runtime, by providing data to the run(train_data, valid_data)
          method.

        Datasets are typically provided as numpy arrays, but they can also be
        provided as callables, as described in the dataset module.

        Any keyword arguments provided to the constructor will be used to
        override values passed on the command line. (Typically this is used to
        provide experiment-specific default values for command line arguments
        that have no global defaults, e.g., network architecture.)
        '''
        self.trainers = []
        self.datasets = {}

        self.args, self.kwargs = climate.parse_args(**overrides)
        if 'activation' in self.kwargs:
            warnings.warn(
                'please use --hidden-activation instead of --activation',
                DeprecationWarning)
            activation = self.kwargs.pop('activation')
            if not self.kwargs.get('hidden_activation'):
                self.kwargs['hidden_activation'] = activation

        if self.kwargs.get('help_activation'):
            print(HELP_ACTIVATION)
            sys.exit(0)

        if self.kwargs.get('help_optimize'):
            print(HELP_OPTIMIZE)
            sys.exit(0)

        kw = {}
        kw.update(self.kwargs)
        self.network = self._build_network(network_class, **kw)

        kw = {}
        kw.update(self.kwargs)
        self._build_trainers(**kw)
import os, sys
import transform
import util
from transform import transformFFT
import numpy as np
import re
from scipy.signal import blackmanharris as blackmanharris
import climate

if __name__ == "__main__":
    if len(sys.argv) > -1:
        climate.add_arg('--db', help="the dataset path")
        climate.add_arg('--feature_path',
                        help="the path where to save the features")
    kwargs = climate.parse_args()
    db = None
    if kwargs.__getattribute__('db'):
        db = kwargs.__getattribute__('db')
    # else:
    #     db='/home/marius/Documents/Database/iKala/'
    if kwargs.__getattribute__('feature_path'):
        feature_path = kwargs.__getattribute__('feature_path')
    else:
        feature_path = os.path.join(db, 'transforms', 't1')
    assert os.path.isdir(
        db
    ), "Please input the directory for the iKala dataset with --db path_to_iKala"

    tt = None
    for f in os.listdir(os.path.join(db, "Wavfile")):